YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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

namespace  yarp
 The main, catch-all namespace for YARP.
 
namespace  yarp::conf
 
namespace  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.
 
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.
 
std::string yarp::conf::environment::get_string (const std::string &key, bool *found=nullptr)
 Read a string from an environment variable.
 
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.
 
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.
 
std::vector< std::string > yarp::conf::environment::get_path (const std::string &key, bool *found=nullptr)
 Read a path from an environment variable.
 
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.
 
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.
 
bool yarp::conf::environment::get_bool (const std::string &key, bool defaultValue=false)
 Read a bool value from an environment variable.
 
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.
 
bool yarp::conf::environment::set_string (const std::string &key, const std::string &value)
 Set a string to an environment variable.
 
bool yarp::conf::environment::set_path (const std::string &key, const std::vector< std::string > &value)
 Set a path to an environment variable.
 
bool yarp::conf::environment::set_bool (const std::string &key, bool value)
 Set a bool to an environment variable (as 1 or 0).
 
template<typename T >
bool yarp::conf::environment::set_numeric (const std::string &key, bool value)
 Set a numeric value to an environment variable.
 
bool yarp::conf::environment::unset (const std::string &key)
 Remove an environment variable.
 
bool yarp::conf::environment::is_set (const std::string &key)
 Check if an environment variable is set.
 
std::string yarp::conf::environment::getEnvironment (const char *key, bool *found=nullptr)
 Read a string from an environment variable.
 
void yarp::conf::environment::setEnvironment (const std::string &key, const std::string &value)
 Set or change an environment variable.
 
void yarp::conf::environment::unsetEnvironment (const std::string &key)
 Remove an environment variable.
 

Variables

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