Elements  5.8
A C++ base framework for the Euclid Software.
Path.h
Go to the documentation of this file.
1 
35 #ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_PATH_H_
36 #define ELEMENTSKERNEL_ELEMENTSKERNEL_PATH_H_
37 
38 #include <string> // for string
39 #include <vector> // for vector
40 #include <map> // for map
41 #include <boost/filesystem.hpp> // for boost::filesystem
42 
43 #include "ElementsKernel/Export.h" // ELEMENTS_API
44 
45 namespace Elements {
46 namespace Path {
47 
48 enum class Type {
49  executable,
50  library,
51  python,
53  auxiliary
54 };
55 
59 ELEMENTS_API extern const std::string PATH_SEP;
60 
65 
71 
76 
81 
97  bool exist_only = false);
98 
114 template <typename T, typename U>
115 ELEMENTS_API boost::filesystem::path getPathFromLocations(const T& file_name, const std::vector<U>& locations);
116 // Template instantiation for the most common types
117 extern template
119  const std::vector<boost::filesystem::path>& locations);
120 extern template
122  const std::vector<std::string>& locations);
123 extern template
125  const std::vector<boost::filesystem::path>& locations);
126 extern template
128  const std::vector<std::string>& locations);
129 
130 
146 template <typename T, typename U>
148  const std::vector<U>& locations);
149 // Template instantiation for the most common types
150 extern template
152  const std::vector<boost::filesystem::path>& locations);
153 extern template
155  const std::vector<std::string>& locations);
156 extern template
158  const std::vector<boost::filesystem::path>& locations);
159 extern template
161  const std::vector<std::string>& locations);
162 
175 template <typename T>
176 ELEMENTS_API boost::filesystem::path getPathFromEnvVariable(const T& file_name, const std::string& path_variable);
177 // Template instantiation for the most common types
178 extern template
179 ELEMENTS_API boost::filesystem::path getPathFromEnvVariable<boost::filesystem::path>(const boost::filesystem::path& file_name,
180  const std::string& path_variable);
181 extern template
182 ELEMENTS_API boost::filesystem::path getPathFromEnvVariable<std::string>(const std::string& file_name,
183  const std::string& path_variable);
184 
191 template <typename T>
193 
194 template <typename T, typename U>
196  const std::vector<U>& suffixes);
197 // Template instantiation for the most common types
198 extern template
200  const std::vector<boost::filesystem::path>& suffixes);
201 extern template
203  const std::vector<std::string>& suffixes);
204 extern template
206  const std::vector<boost::filesystem::path>& suffixes);
207 extern template
209  const std::vector<std::string>& suffixes);
210 
211 } // namespace Path
212 } // namespace Elements
213 
215 
216 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_PATH_H_
217 
Elements::Path::Type::configuration
@ configuration
Elements::Path::HAS_SUBLEVELS
const ELEMENTS_API std::map< Type, const bool > HAS_SUBLEVELS
map containing the sub-level property of the path components
Definition: Path.cpp:70
Export.h
defines the macros to be used for explicit export of the symbols
Path.icpp
std::string
STL class.
Elements::Path::multiPathAppend
ELEMENTS_API std::vector< boost::filesystem::path > multiPathAppend(const std::vector< T > &initial_locations, const std::vector< U > &suffixes)
std::vector
STL class.
Elements::Path::Type::executable
@ executable
Elements::Path::getAllPathFromLocations
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
ElementsServices::DataSync::path
boost::filesystem::path path
Definition: DataSyncUtils.h:33
Elements::Path::Type::auxiliary
@ auxiliary
Elements::Path::PATH_SEP
const ELEMENTS_API std::string PATH_SEP
Separator of path entries. Usually ":" on Unix.
Definition: Path.cpp:44
Elements::Path::getLocationsFromEnv
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
Definition: Path.cpp:79
Elements::Path::getPathFromEnvVariable
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
ELEMENTS_API
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
Elements::Path::getPathFromLocations
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
Elements::Path::SUFFIXES
const ELEMENTS_API std::map< Type, const std::vector< std::string > > SUFFIXES
map containing the default project installation suffixes for each variable
Definition: Path.cpp:54
Elements::Path::Type::library
@ library
Elements::Path::joinPath
ELEMENTS_API std::string joinPath(const std::vector< T > path_list)
collate a vector of path into a string using PATH_SEP
std::map
STL class.
Elements::Path::VARIABLE
const ELEMENTS_API std::map< Type, const std::string > VARIABLE
map containing the name of the path variable for each type
Definition: Path.cpp:46
Elements::Path::DEFAULT_LOCATIONS
const ELEMENTS_API std::map< Type, const std::vector< std::string > > DEFAULT_LOCATIONS
map containing the default external locations for each variable
Definition: Path.cpp:62
Elements::Path::Type
Type
Definition: Path.h:48
Elements::Path::Type::python
@ python
Elements
Definition: Auxiliary.h:43