Elements 6.3.3
A C++ base framework for the Euclid Software.
Loading...
Searching...
No Matches
Configuration.tpp
Go to the documentation of this file.
1
20
21// IWYU pragma: private, include "ElementsKernel/Configuration.h"
22
23#ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_CONFIGURATION_IMPL_
24#error "This file should not be included directly! Use ElementsKernel/Configuration.h instead"
25#else
26
27#include "ElementsKernel/Exception.h" // for Exception
28#include "ElementsKernel/Path.h" // for Path::VARIABLE, Path::Type, Path::Item
29 // getPathFromLocations
30
31namespace Elements {
32inline namespace Kernel {
33
34template <typename T>
35Path::Item getConfigurationPath(const T& file_name, bool raise_exception) {
36
37 auto location_list = getConfigurationLocations();
38
39 auto result = Path::getPathFromLocations(file_name, location_list);
40
41 if (result.empty() and raise_exception) {
42 throw Exception() << "The configuration path \"" << file_name << "\" cannot be found!";
43 }
44
45 return result;
46}
47
48namespace Configuration {
49
50template <typename T>
51Path::Item getPath(const T& file_name, bool raise_exception) {
52 return getConfigurationPath(file_name, raise_exception);
53}
54
55} // namespace Configuration
56
57} // namespace Kernel
58} // namespace Elements
59
60#endif // ELEMENTSKERNEL_ELEMENTSKERNEL_CONFIGURATION_IMPL_
defines the base Elements exception class
provide functions to retrieve resources pointed by environment variables
ELEMENTS_API Item 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_API Path::Item getPath(const T &file_name, bool raise_exception=true)
alias for the getAuxiliaryPath function
boost::filesystem::path Item
Definition Path.h:57
ELEMENTS_API Path::Item getConfigurationPath(const T &file_name, bool raise_exception=true)
ELEMENTS_API std::vector< Path::Item > getConfigurationLocations(bool exist_only=false)