LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
lbann::utils::EnvVariable< AccessPolicy > Class Template Reference

An environment variable. More...

#include <environment_variable.hpp>

Public Member Functions

Constructors
 EnvVariable (std::string const &var_name)
 Construct from a string. More...
 
 EnvVariable (std::string &&var_name)
 Construct from a temporary string. More...
 
Queries
bool exists () const
 Test if the variable exists in the environment. More...
 
Accessors
std::string const & name () const noexcept
 Get the name of the environment variable. More...
 
std::string raw_value () const
 Get the string value of the environment variable. More...
 
template<typename T >
value () const
 Get the value of the environment variable as a certain type. More...
 

Private Attributes

std::string name_
 The name of the variable. More...
 

Detailed Description

template<typename AccessPolicy = GetEnvAccessor>
class lbann::utils::EnvVariable< AccessPolicy >

An environment variable.

Values are acquired lazily. The only maintained state is the name.

Definition at line 49 of file environment_variable.hpp.

Constructor & Destructor Documentation

◆ EnvVariable() [1/2]

template<typename AccessPolicy >
lbann::utils::EnvVariable< AccessPolicy >::EnvVariable ( std::string const &  var_name)
inline

Construct from a string.

Definition at line 98 of file environment_variable.hpp.

◆ EnvVariable() [2/2]

template<typename AccessPolicy >
lbann::utils::EnvVariable< AccessPolicy >::EnvVariable ( std::string &&  var_name)
inline

Construct from a temporary string.

Definition at line 103 of file environment_variable.hpp.

Member Function Documentation

◆ exists()

template<typename AccessPolicy >
bool lbann::utils::EnvVariable< AccessPolicy >::exists ( ) const
inline

Test if the variable exists in the environment.

Existence means set to a nonempty string.

Definition at line 108 of file environment_variable.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

template<typename AccessPolicy >
std::string const & lbann::utils::EnvVariable< AccessPolicy >::name ( ) const
inlinenoexcept

Get the name of the environment variable.

Definition at line 114 of file environment_variable.hpp.

Here is the caller graph for this function:

◆ raw_value()

template<typename AccessPolicy >
std::string lbann::utils::EnvVariable< AccessPolicy >::raw_value ( ) const
inline

Get the string value of the environment variable.

Definition at line 120 of file environment_variable.hpp.

Here is the caller graph for this function:

◆ value()

template<typename AccessPolicy >
template<typename T >
T lbann::utils::EnvVariable< AccessPolicy >::value ( ) const

Get the value of the environment variable as a certain type.

Definition at line 128 of file environment_variable.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ name_

template<typename AccessPolicy = GetEnvAccessor>
std::string lbann::utils::EnvVariable< AccessPolicy >::name_
private

The name of the variable.

Definition at line 89 of file environment_variable.hpp.


The documentation for this class was generated from the following file: