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);
190 static bool Unset(
const std::string& variable);
214 using DictionaryList = std::unordered_map<std::string, std::shared_ptr<Dictionary>>;
Key, value dictionary for a single environment variable.
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.
EnvironmentVariable & operator=(const EnvironmentVariable &)=delete
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.
EnvironmentVariable & operator=(EnvironmentVariable &&)=delete
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.
static void Clear()
Clear the instance, forcing all new lookups.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.