Elements  5.8
A C++ base framework for the Euclid Software.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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_API const std::map< Type, const std::vector< std::string > > SUFFIXES
map containing the default project installation suffixes for each variable
Definition: Path.cpp:54
implementation of the templates declared in ElementsKernel/Path.h
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
Definition: Path.icpp:85
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_API const std::map< Type, const std::vector< std::string > > DEFAULT_LOCATIONS
map containing the default external locations for each variable
Definition: Path.cpp:62
ELEMENTS_API const std::map< Type, const bool > HAS_SUBLEVELS
map containing the sub-level property of the path components
Definition: Path.cpp:70
STL class.
STL class.
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
Definition: Path.icpp:58
defines the macros to be used for explicit export of the symbols
boost::filesystem::path path
Definition: DataSyncUtils.h:33
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition: Export.h:74
ELEMENTS_API const std::map< Type, const std::string > VARIABLE
map containing the name of the path variable for each type
Definition: Path.cpp:46
std::vector< boost::filesystem::path > multiPathAppend(const std::vector< T > &initial_locations, const std::vector< U > &suffixes)
Definition: Path.icpp:116
STL class.
std::string joinPath(const std::vector< T > path_list)
collate a vector of path into a string using PATH_SEP
Definition: Path.icpp:97
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
Definition: Path.icpp:37
ELEMENTS_API const std::string PATH_SEP
Separator of path entries. Usually &quot;:&quot; on Unix.
Definition: Path.cpp:44