Elements 6.1.2
A C++ base framework for the Euclid Software.
Loading...
Searching...
No Matches
Auxiliary.tpp
Go to the documentation of this file.
1/**
2 * @file ElementsKernel/_impl/Auxiliary.tpp
3 * @brief implementation of the templates declared in ElementsKernel/Auxiliary.h
4 * @date Feb 8, 2017
5 * @author Hubert Degaudenzi
6 *
7 * @copyright 2012-2020 Euclid Science Ground Segment
8 *
9 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
10 * Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option)
11 * any later version.
12 *
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_AUXILIARY_IMPL_
22#error "This file should not be included directly! Use ElementsKernel/Auxiliary.h instead"
23#else
24
25#include "ElementsKernel/Exception.h" // for Exception
26#include "ElementsKernel/Path.h" // for Path::VARIABLE, Path::Type, Path::Item
27 // getPathFromLocations
28namespace Elements {
29inline namespace Kernel {
30
31template <typename T>
32Path::Item getAuxiliaryPath(const T& file_name, bool raise_exception) {
33
34 auto location_list = getAuxiliaryLocations();
35
36 auto result = Path::getPathFromLocations(file_name, location_list);
37
38 if (result.empty() and raise_exception) {
39 throw Exception() << "The auxiliary path \"" << file_name << "\" cannot be found!";
40 }
41
42 return result;
43}
44
45namespace Auxiliary {
46
47template <typename T>
48Path::Item getPath(const T& file_name, bool raise_exception) {
49 return getAuxiliaryPath(file_name, raise_exception);
50}
51
52} // namespace Auxiliary
53
54} // namespace Kernel
55} // namespace Elements
56
57#endif // ELEMENTSKERNEL_ELEMENTSKERNEL_AUXILIARY_IMPL_