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