9#ifndef ENVIRONMENT_VARIABLE_H
10#define ENVIRONMENT_VARIABLE_H
20#include <unordered_map>
94 const std::string& key =
"",
95 const std::string& delim =
";");
110 static std::shared_ptr<Dictionary>
GetDictionary(
const std::string& envvar,
111 const std::string& delim =
";");
131 Dictionary(
const std::string& envvar,
const std::string& delim =
";");
169 static bool Set(
const std::string& variable,
const std::string& value);
179 static bool Unset(
const std::string& variable);
203 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.
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::pair< bool, std::string > KeyFoundType
Result of a key lookup.
static void Clear()
Clear the instance, forcing all new lookups.
std::unordered_map< std::string, std::shared_ptr< Dictionary > > DictionaryList
How Dictionaries are stored.
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.