20 #ifndef ENVIRONMENT_VARIABLE_H
21 #define ENVIRONMENT_VARIABLE_H
31 #include <unordered_map>
105 const std::string& key =
"",
106 const std::string& delim =
";");
121 static std::shared_ptr<Dictionary>
GetDictionary(
const std::string& envvar,
122 const std::string& delim =
";");
142 Dictionary(
const std::string& envvar,
const std::string& delim =
";");
180 static bool Set(
const std::string&
variable,
const std::string& value);
214 using DictionaryList = std::unordered_map<std::string, std::shared_ptr<Dictionary>>;
Key, value dictionary for a single environment variable.
Dictionary(const std::string &envvar, const std::string &delim=";")
Constructor.
KeyFoundType Get(const std::string &key="") const
Get the value corresponding to a key from this dictionary.
std::unordered_map< std::string, std::string > KeyValueStore
Key, value store type.
std::string m_variable
The raw environment variable.
bool m_exists
Whether the environment variable exists in the environment.
KeyValueStore m_dict
The key, value store.
KeyValueStore GetStore() const
Get the underlying store, for iterating.
Hold key,value dictionaries for environment variables.
static DictionaryList & Instance()
Access the DictionaryStore instance.
EnvironmentVariable()=delete
static KeyFoundType Get(const std::string &envvar, const std::string &key="", const std::string &delim=";")
Get the value corresponding to a key from an environment variable.
static bool Unset(const std::string &variable)
Unset an environment variable.
std::unordered_map< std::string, std::shared_ptr< Dictionary > > DictionaryList
How Dictionaries are stored.
std::pair< bool, std::string > KeyFoundType
Result of a key lookup.
EnvironmentVariable & operator=(const EnvironmentVariable &)=delete
static void Clear()
Clear the instance, forcing all new lookups.
EnvironmentVariable & operator=(EnvironmentVariable &&)=delete
static bool Set(const std::string &variable, const std::string &value)
Set an environment variable.
EnvironmentVariable(EnvironmentVariable &&)=delete
static std::shared_ptr< Dictionary > GetDictionary(const std::string &envvar, const std::string &delim=";")
Get the dictionary for a particular environment variable.
EnvironmentVariable(const EnvironmentVariable &)=delete
EnvironmentVariable tests.
std::string variable
variable or class member
Every class exported by the ns3 library is enclosed in the ns3 namespace.