Elements  5.8
A C++ base framework for the Euclid Software.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Enumerations | Functions | Variables
Elements::Path Namespace Reference

Enumerations

enum  Type {
  Type::executable, Type::library, Type::python, Type::configuration,
  Type::auxiliary
}
 

Functions

template<typename T , typename U >
boost::filesystem::path getPathFromLocations (const T &file_name, const std::vector< U > &locations)
 retrieve path from a file name and a set of location to look into More...
 
template<typename T , typename U >
std::vector
< boost::filesystem::path > 
getAllPathFromLocations (const T &file_name, const std::vector< U > &locations)
 retrieve all the paths from a file name and a set of location to look into More...
 
template<typename T >
boost::filesystem::path getPathFromEnvVariable (const T &file_name, const std::string &path_variable)
 retrieve path from a file name and an environment variable to look into More...
 
template<typename T >
std::string joinPath (const std::vector< T > path_list)
 collate a vector of path into a string using PATH_SEP More...
 
template<typename T , typename U >
std::vector
< boost::filesystem::path > 
multiPathAppend (const std::vector< T > &initial_locations, const std::vector< U > &suffixes)
 
ELEMENTS_API std::vector
< boost::filesystem::path > 
getLocationsFromEnv (const std::string &path_variable, bool exist_only=false)
 function to get the locations from an environment variable More...
 
template<typename T , typename U >
ELEMENTS_API
boost::filesystem::path 
getPathFromLocations (const T &file_name, const std::vector< U > &locations)
 retrieve path from a file name and a set of location to look into More...
 
template ELEMENTS_API
boost::filesystem::path 
getPathFromLocations (const boost::filesystem::path &file_name, const std::vector< boost::filesystem::path > &locations)
 
template ELEMENTS_API
boost::filesystem::path 
getPathFromLocations (const boost::filesystem::path &file_name, const std::vector< std::string > &locations)
 
template ELEMENTS_API
boost::filesystem::path 
getPathFromLocations (const std::string &file_name, const std::vector< boost::filesystem::path > &locations)
 
template ELEMENTS_API
boost::filesystem::path 
getPathFromLocations (const std::string &file_name, const std::vector< std::string > &locations)
 
template<typename T , typename U >
ELEMENTS_API std::vector
< boost::filesystem::path > 
getAllPathFromLocations (const T &file_name, const std::vector< U > &locations)
 retrieve all the paths from a file name and a set of location to look into More...
 
template ELEMENTS_API
std::vector
< boost::filesystem::path > 
getAllPathFromLocations (const boost::filesystem::path &file_name, const std::vector< boost::filesystem::path > &locations)
 
template ELEMENTS_API
std::vector
< boost::filesystem::path > 
getAllPathFromLocations (const boost::filesystem::path &file_name, const std::vector< std::string > &locations)
 
template ELEMENTS_API
std::vector
< boost::filesystem::path > 
getAllPathFromLocations (const std::string &file_name, const std::vector< boost::filesystem::path > &locations)
 
template ELEMENTS_API
std::vector
< boost::filesystem::path > 
getAllPathFromLocations (const std::string &file_name, const std::vector< std::string > &locations)
 
template<typename T >
ELEMENTS_API
boost::filesystem::path 
getPathFromEnvVariable (const T &file_name, const std::string &path_variable)
 retrieve path from a file name and an environment variable to look into More...
 
template ELEMENTS_API
boost::filesystem::path 
getPathFromEnvVariable< boost::filesystem::path > (const boost::filesystem::path &file_name, const std::string &path_variable)
 
template ELEMENTS_API
boost::filesystem::path 
getPathFromEnvVariable< std::string > (const std::string &file_name, const std::string &path_variable)
 
template<typename T >
ELEMENTS_API std::string joinPath (const std::vector< T > path_list)
 collate a vector of path into a string using PATH_SEP More...
 
template<typename T , typename U >
ELEMENTS_API std::vector
< boost::filesystem::path > 
multiPathAppend (const std::vector< T > &initial_locations, const std::vector< U > &suffixes)
 
template ELEMENTS_API
std::vector
< boost::filesystem::path > 
multiPathAppend (const std::vector< boost::filesystem::path > &initial_locations, const std::vector< boost::filesystem::path > &suffixes)
 
template ELEMENTS_API
std::vector
< boost::filesystem::path > 
multiPathAppend (const std::vector< boost::filesystem::path > &initial_locations, const std::vector< std::string > &suffixes)
 
template ELEMENTS_API
std::vector
< boost::filesystem::path > 
multiPathAppend (const std::vector< std::string > &initial_locations, const std::vector< boost::filesystem::path > &suffixes)
 
template ELEMENTS_API
std::vector
< boost::filesystem::path > 
multiPathAppend (const std::vector< std::string > &initial_locations, const std::vector< std::string > &suffixes)
 
template path getPathFromLocations (const path &file_name, const vector< path > &locations)
 
template path getPathFromLocations (const path &file_name, const vector< string > &locations)
 
template path getPathFromLocations (const string &file_name, const vector< path > &locations)
 
template vector< path > getAllPathFromLocations (const path &file_name, const vector< path > &locations)
 
template vector< path > getAllPathFromLocations (const path &file_name, const vector< string > &locations)
 
template vector< path > getAllPathFromLocations (const string &file_name, const vector< path > &locations)
 
template path getPathFromEnvVariable< path > (const path &file_name, const string &path_variable)
 
template path getPathFromEnvVariable< string > (const string &file_name, const string &path_variable)
 
template vector< path > multiPathAppend (const vector< path > &initial_locations, const vector< path > &suffixes)
 
template vector< path > multiPathAppend (const vector< path > &initial_locations, const vector< string > &suffixes)
 
template vector< path > multiPathAppend (const vector< string > &initial_locations, const vector< path > &suffixes)
 

Variables

ELEMENTS_API const std::string PATH_SEP {":"}
 Separator of path entries. Usually ":" on Unix. More...
 
ELEMENTS_API const std::map
< Type, const std::string
VARIABLE
 map containing the name of the path variable for each type More...
 
ELEMENTS_API const std::map
< Type, const std::vector
< std::string > > 
SUFFIXES
 map containing the default project installation suffixes for each variable More...
 
ELEMENTS_API const std::map
< Type, const std::vector
< std::string > > 
DEFAULT_LOCATIONS
 map containing the default external locations for each variable More...
 
ELEMENTS_API const std::map
< Type, const bool > 
HAS_SUBLEVELS
 map containing the sub-level property of the path components More...
 

Enumeration Type Documentation

enum Elements::Path::Type
strong
Enumerator
executable 
library 
python 
configuration 
auxiliary 

Definition at line 48 of file Path.h.

Function Documentation

template<typename T , typename U >
std::vector<boost::filesystem::path> Elements::Path::getAllPathFromLocations ( const T &  file_name,
const std::vector< U > &  locations 
)

retrieve all the paths from a file name and a set of location to look into

Parameters
file_namefile name to look for. Can be of the form "Some.txt" or "Place/Some.txt"
locationsvector of locations to look into
Template Parameters
Ttype of the file name. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Utype of the location. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Returns
all the found paths

Definition at line 58 of file Path.icpp.

References std::vector< T >::cbegin(), std::vector< T >::cend(), std::remove_if(), std::vector< T >::size(), and std::transform().

Here is the call graph for this function:

template vector<path> Elements::Path::getAllPathFromLocations ( const path &  file_name,
const vector< path > &  locations 
)
template vector<path> Elements::Path::getAllPathFromLocations ( const path &  file_name,
const vector< string > &  locations 
)
template vector<path> Elements::Path::getAllPathFromLocations ( const string file_name,
const vector< path > &  locations 
)
template<typename T , typename U >
ELEMENTS_API std::vector<boost::filesystem::path> Elements::Path::getAllPathFromLocations ( const T &  file_name,
const std::vector< U > &  locations 
)

retrieve all the paths from a file name and a set of location to look into

Parameters
file_namefile name to look for. Can be of the form "Some.txt" or "Place/Some.txt"
locationsvector of locations to look into
Template Parameters
Ttype of the file name. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Utype of the location. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Returns
all the found paths

Definition at line 58 of file Path.icpp.

References std::vector< T >::cbegin(), std::vector< T >::cend(), std::remove_if(), std::vector< T >::size(), and std::transform().

Here is the call graph for this function:

template ELEMENTS_API std::vector<boost::filesystem::path> Elements::Path::getAllPathFromLocations ( const boost::filesystem::path &  file_name,
const std::vector< boost::filesystem::path > &  locations 
)
template ELEMENTS_API std::vector<boost::filesystem::path> Elements::Path::getAllPathFromLocations ( const boost::filesystem::path &  file_name,
const std::vector< std::string > &  locations 
)
template ELEMENTS_API std::vector<boost::filesystem::path> Elements::Path::getAllPathFromLocations ( const std::string file_name,
const std::vector< boost::filesystem::path > &  locations 
)
template vector< path > Elements::Path::getAllPathFromLocations ( const std::string file_name,
const std::vector< std::string > &  locations 
)
vector< path > Elements::Path::getLocationsFromEnv ( const std::string path_variable,
bool  exist_only = false 
)

function to get the locations from an environment variable

This function return the raw locations pointed by the environment variable. It doesn't add the internal locations which are not in the variable (like /usr/lib for the LD_LIBRARY_PATH environment variable)

Parameters
path_variablename of the environment variable
exist_onlyif true returns only existing locations. by default it is set to false.
Returns
return a list of boost filesystem paths

Definition at line 79 of file Path.cpp.

References std::string::begin(), std::vector< T >::cbegin(), std::vector< T >::cend(), Elements::System::getEnv(), PATH_SEP, std::remove_if(), Elements::Units::s, std::vector< T >::size(), and std::transform().

Referenced by Elements::getAuxiliaryLocations(), Elements::getConfigurationLocations(), and getPathFromEnvVariable().

Here is the call graph for this function:

template<typename T >
boost::filesystem::path Elements::Path::getPathFromEnvVariable ( const T &  file_name,
const std::string path_variable 
)

retrieve path from a file name and an environment variable to look into

Parameters
file_namefile name to look for. Can be of the form "Some.txt" or "Place/Some.txt"
path_variablename of the environment variable
Template Parameters
Ttype of the file name. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Returns
first match of the file stem

Definition at line 85 of file Path.icpp.

References getLocationsFromEnv(), and getPathFromLocations().

Here is the call graph for this function:

template<typename T >
ELEMENTS_API boost::filesystem::path Elements::Path::getPathFromEnvVariable ( const T &  file_name,
const std::string path_variable 
)

retrieve path from a file name and an environment variable to look into

Parameters
file_namefile name to look for. Can be of the form "Some.txt" or "Place/Some.txt"
path_variablename of the environment variable
Template Parameters
Ttype of the file name. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Returns
first match of the file stem

Definition at line 85 of file Path.icpp.

References getLocationsFromEnv(), and getPathFromLocations().

Here is the call graph for this function:

template ELEMENTS_API boost::filesystem::path Elements::Path::getPathFromEnvVariable< boost::filesystem::path > ( const boost::filesystem::path &  file_name,
const std::string path_variable 
)
template path Elements::Path::getPathFromEnvVariable< path > ( const path &  file_name,
const string path_variable 
)
template ELEMENTS_API boost::filesystem::path Elements::Path::getPathFromEnvVariable< std::string > ( const std::string file_name,
const std::string path_variable 
)
template path Elements::Path::getPathFromEnvVariable< string > ( const string file_name,
const string path_variable 
)
template<typename T , typename U >
boost::filesystem::path Elements::Path::getPathFromLocations ( const T &  file_name,
const std::vector< U > &  locations 
)

retrieve path from a file name and a set of location to look into

Parameters
file_namefile name to look for. Can be of the form "Some.txt" or "Place/Some.txt"
locationsvector of locations to look into
Template Parameters
Ttype of the file name. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Utype of the location. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Returns
first match of the file stem

Definition at line 37 of file Path.icpp.

References std::vector< T >::cbegin(), std::vector< T >::cend(), and std::find_if().

Referenced by Elements::getAuxiliaryPath(), Elements::getConfigurationPath(), and getPathFromEnvVariable().

Here is the call graph for this function:

template path Elements::Path::getPathFromLocations ( const path &  file_name,
const vector< path > &  locations 
)
template path Elements::Path::getPathFromLocations ( const path &  file_name,
const vector< string > &  locations 
)
template path Elements::Path::getPathFromLocations ( const string file_name,
const vector< path > &  locations 
)
template<typename T , typename U >
ELEMENTS_API boost::filesystem::path Elements::Path::getPathFromLocations ( const T &  file_name,
const std::vector< U > &  locations 
)

retrieve path from a file name and a set of location to look into

Parameters
file_namefile name to look for. Can be of the form "Some.txt" or "Place/Some.txt"
locationsvector of locations to look into
Template Parameters
Ttype of the file name. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Utype of the location. Can be anything that can be converted to a boost filesystem path. In principle either std::string or path.
Returns
first match of the file stem

Definition at line 37 of file Path.icpp.

References std::vector< T >::cbegin(), std::vector< T >::cend(), and std::find_if().

Referenced by Elements::getAuxiliaryPath(), Elements::getConfigurationPath(), and getPathFromEnvVariable().

Here is the call graph for this function:

template ELEMENTS_API boost::filesystem::path Elements::Path::getPathFromLocations ( const boost::filesystem::path &  file_name,
const std::vector< boost::filesystem::path > &  locations 
)
template ELEMENTS_API boost::filesystem::path Elements::Path::getPathFromLocations ( const boost::filesystem::path &  file_name,
const std::vector< std::string > &  locations 
)
template ELEMENTS_API boost::filesystem::path Elements::Path::getPathFromLocations ( const std::string file_name,
const std::vector< boost::filesystem::path > &  locations 
)
template path Elements::Path::getPathFromLocations ( const std::string file_name,
const std::vector< std::string > &  locations 
)
template<typename T >
std::string Elements::Path::joinPath ( const std::vector< T >  path_list)

collate a vector of path into a string using PATH_SEP

Parameters
path_listlist of path to be joined.
Returns
collated string

Definition at line 97 of file Path.icpp.

References std::vector< T >::cbegin(), std::vector< T >::cend(), PATH_SEP, Elements::Units::s, std::vector< T >::size(), and std::transform().

Referenced by Elements::ProgramManager::bootstrapEnvironment().

Here is the call graph for this function:

template<typename T >
ELEMENTS_API std::string Elements::Path::joinPath ( const std::vector< T >  path_list)

collate a vector of path into a string using PATH_SEP

Parameters
path_listlist of path to be joined.
Returns
collated string

Definition at line 97 of file Path.icpp.

References std::vector< T >::cbegin(), std::vector< T >::cend(), PATH_SEP, Elements::Units::s, std::vector< T >::size(), and std::transform().

Referenced by Elements::ProgramManager::bootstrapEnvironment().

Here is the call graph for this function:

template<typename T , typename U >
std::vector<boost::filesystem::path> Elements::Path::multiPathAppend ( const std::vector< T > &  initial_locations,
const std::vector< U > &  suffixes 
)

Definition at line 116 of file Path.icpp.

References std::vector< T >::cbegin(), std::vector< T >::cend(), std::for_each(), Elements::Units::s, std::vector< T >::size(), and std::transform().

Referenced by Elements::ProgramManager::bootstrapEnvironment().

Here is the call graph for this function:

template vector<path> Elements::Path::multiPathAppend ( const vector< path > &  initial_locations,
const vector< path > &  suffixes 
)
template vector<path> Elements::Path::multiPathAppend ( const vector< path > &  initial_locations,
const vector< string > &  suffixes 
)
template vector<path> Elements::Path::multiPathAppend ( const vector< string > &  initial_locations,
const vector< path > &  suffixes 
)
template<typename T , typename U >
ELEMENTS_API std::vector<boost::filesystem::path> Elements::Path::multiPathAppend ( const std::vector< T > &  initial_locations,
const std::vector< U > &  suffixes 
)

Definition at line 116 of file Path.icpp.

References std::vector< T >::cbegin(), std::vector< T >::cend(), std::for_each(), Elements::Units::s, std::vector< T >::size(), and std::transform().

Referenced by Elements::ProgramManager::bootstrapEnvironment().

Here is the call graph for this function:

template ELEMENTS_API std::vector<boost::filesystem::path> Elements::Path::multiPathAppend ( const std::vector< boost::filesystem::path > &  initial_locations,
const std::vector< boost::filesystem::path > &  suffixes 
)
template ELEMENTS_API std::vector<boost::filesystem::path> Elements::Path::multiPathAppend ( const std::vector< boost::filesystem::path > &  initial_locations,
const std::vector< std::string > &  suffixes 
)
template ELEMENTS_API std::vector<boost::filesystem::path> Elements::Path::multiPathAppend ( const std::vector< std::string > &  initial_locations,
const std::vector< boost::filesystem::path > &  suffixes 
)
template vector< path > Elements::Path::multiPathAppend ( const std::vector< std::string > &  initial_locations,
const std::vector< std::string > &  suffixes 
)

Variable Documentation

const map< Type, const vector< string > > Elements::Path::DEFAULT_LOCATIONS
Initial value:
{
{Type::executable, {}},
{Type::library, {"/usr/lib64", "/usr/lib"}},
{Type::python, {}},
{Type::configuration, {"/usr/share/conf"}},
{Type::auxiliary, {"/usr/share/auxiliary"}}
}

map containing the default external locations for each variable

Definition at line 62 of file Path.cpp.

const std::map< Type, const bool > Elements::Path::HAS_SUBLEVELS
Initial value:
{
{Type::executable, false},
{Type::library, false},
{Type::python, true},
{Type::configuration, true},
{Type::auxiliary, true}
}

map containing the sub-level property of the path components

Definition at line 70 of file Path.cpp.

const string Elements::Path::PATH_SEP {":"}

Separator of path entries. Usually ":" on Unix.

Definition at line 44 of file Path.cpp.

Referenced by Elements::ProgramManager::bootstrapEnvironment(), getLocationsFromEnv(), and joinPath().

const map< Type, const vector< string > > Elements::Path::SUFFIXES
Initial value:
{
{Type::executable, {"scripts", "bin"}},
{Type::library, {"lib"}},
{Type::python, {"python"}},
{Type::configuration, {"conf"}},
{Type::auxiliary, {"auxdir", "aux"}}
}

map containing the default project installation suffixes for each variable

Definition at line 54 of file Path.cpp.

Referenced by Elements::ProgramManager::bootstrapEnvironment().

const map< Type, const string > Elements::Path::VARIABLE
Initial value:
{
{Type::executable, "PATH"},
{Type::library, System::SHLIB_VAR_NAME},
{Type::python, "PYTHONPATH"},
{Type::configuration, "ELEMENTS_CONF_PATH"},
{Type::auxiliary, "ELEMENTS_AUX_PATH"}
}
const std::string SHLIB_VAR_NAME
name of the shared dynamic library path
Definition: System.h:58

map containing the name of the path variable for each type

Definition at line 46 of file Path.cpp.

Referenced by Elements::ProgramManager::bootstrapEnvironment(), Elements::getAuxiliaryLocations(), Elements::getAuxiliaryVariableName(), Elements::getConfigurationLocations(), Elements::getConfigurationVariableName(), and Elements::ProgramManager::logTheEnvironment().