27 #ifndef LBANN_UTILS_ENVIRONMENT_VARIABLE_HPP_INCLUDED 28 #define LBANN_UTILS_ENVIRONMENT_VARIABLE_HPP_INCLUDED 41 std::string
get(std::string
const& var_name)
const;
48 template <
typename AccessPolicy = GetEnvAccessor>
76 std::string
const& name()
const noexcept;
79 std::string raw_value()
const;
97 template <
typename AccessPolicy>
102 template <
typename AccessPolicy>
104 :
name_{std::move(var_name)}
107 template <
typename AccessPolicy>
113 template <
typename AccessPolicy>
119 template <
typename AccessPolicy>
123 return access.get(
name_);
126 template <
typename AccessPolicy>
127 template <
typename T>
bool exists() const
Test if the variable exists in the environment.
std::string raw_value() const
Get the string value of the environment variable.
std::string const & name() const noexcept
Get the name of the environment variable.
T value() const
Get the value of the environment variable as a certain type.
Access environment variables using getenv.
std::string name_
The name of the variable.
EnvVariable(std::string const &var_name)
Construct from a string.
int exists(const char *filename)