Celeritas
0.5.0-86+4a8eea4
|
Interrogate and extend environment variables. More...
#include <Environment.hh>
Public Member Functions | |
mapped_type const & | operator[] (key_type const &) |
Get an environment variable from current or system enviroments. | |
bool | insert (value_type const &value) |
Set a single environment variable that hasn't yet been set. More... | |
VecKVRef const & | ordered_environment () const |
Get an ordered (by access) vector of key/value pairs. | |
void | clear () |
Remove all entries. | |
void | merge (Environment const &other) |
Insert but don't override from another environment. | |
Interrogate and extend environment variables.
This makes it easier to generate reproducible runs, launch Celeritas remotely, or integrate with application drivers. The environment variables may be encoded as JSON input to supplement or override system environment variables, or set programmatically via this API call. Later the environment class can be interrogated to find which environment variables were accessed.
Unlike the standard environment which returns a null pointer for an unset variable, this returns an empty string.
celeritas::getenv
free function however is safe, although it should only be used in setup (single-thread) steps. celeritas::environment() = {};
but that could result in the end-of-run diagnostic reporting different values than the ones actually used during the code's setup. bool celeritas::Environment::insert | ( | value_type const & | value | ) |
Set a single environment variable that hasn't yet been set.
Existing environment variables will not be overwritten.