YARP
Yet Another Robot Platform
environment.h File Reference
#include <yarp/conf/api.h>
#include <yarp/conf/system.h>
#include <yarp/conf/numeric.h>
#include <yarp/conf/string.h>
#include <cstdlib>
#include <numeric>
#include <regex>
#include <string>
#include <type_traits>
#include <vector>
+ Include dependency graph for environment.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 yarp
 The main, catch-all namespace for YARP.
 
 yarp::conf
 
 yarp::conf::environment
 

Functions

template<typename ContainerT = std::vector<std::string>>
ContainerT yarp::conf::environment::split_path (const typename ContainerT::value_type &s)
 Utility to split a string containing a path separated by the path_separator, which depends on the system, into a vector of strings. More...
 
template<typename ContainerT = std::vector<std::string>>
ContainerT::value_type yarp::conf::environment::join_path (const ContainerT &v)
 Utility to join a vector of strings into a single string separated by the proper path_separator, which depends on the system. More...
 
std::string yarp::conf::environment::get_string (const std::string &key, bool *found=nullptr)
 Read a string from an environment variable. More...
 
std::string yarp::conf::environment::get_string (const std::string &key, const std::string &defaultValue)
 Read a string from an environment variable with a default value. More...
 
std::string yarp::conf::environment::get_string (const std::string &key, const std::string &altKey, const std::string &altDefaultValue, const std::string &altAppend={})
 Read a string from an environment variable with with a fallback. More...
 
std::vector< std::string > yarp::conf::environment::get_path (const std::string &key, bool *found=nullptr)
 Read a path from an environment variable. More...
 
std::vector< std::string > yarp::conf::environment::get_path (const std::string &key, const std::string &defaultValue)
 Read a path from an environment variable with a default value. More...
 
std::vector< std::string > yarp::conf::environment::get_path (const std::string &key, const std::string &altKey, const std::string &altDefaultValue, const std::string &altAppend={})
 Read a path from an environment variable with a fallback. More...
 
bool yarp::conf::environment::get_bool (const std::string &key, bool defaultValue=false)
 Read a bool value from an environment variable. More...
 
template<typename T >
yarp::conf::environment::get_numeric (const std::string &key, T defaultValue=static_cast< T >(0))
 Read an numeric value from an environment variable. More...
 
bool yarp::conf::environment::set_string (const std::string &key, const std::string &value)
 Set a string to an environment variable. More...
 
bool yarp::conf::environment::set_path (const std::string &key, const std::vector< std::string > &value)
 Set a path to an environment variable. More...
 
bool yarp::conf::environment::set_bool (const std::string &key, bool value)
 Set a bool to an environment variable (as 1 or 0). More...
 
template<typename T >
bool yarp::conf::environment::set_numeric (const std::string &key, bool value)
 Set a numeric value to an environment variable. More...
 
bool yarp::conf::environment::unset (const std::string &key)
 Remove an environment variable. More...
 
bool yarp::conf::environment::is_set (const std::string &key)
 Check if an environment variable is set. More...
 
std::string yarp::conf::environment::getEnvironment (const char *key, bool *found=nullptr)
 Read a string from an environment variable. More...
 
void yarp::conf::environment::setEnvironment (const std::string &key, const std::string &value)
 Set or change an environment variable. More...
 
void yarp::conf::environment::unsetEnvironment (const std::string &key)
 Remove an environment variable. More...
 

Variables

static constexpr char yarp::conf::environment::path_separator = ':'