2 * @file ElementsKernel/_impl/Configuration.tpp
3 * @brief implementation of the templates declared in ElementsKernel/Configuration.h
5 * @author Hubert Degaudenzi
7 * @copyright 2012-2020 Euclid Science Ground Segment
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)
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
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
21 #ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_CONFIGURATION_IMPL_
22 #error "This file should not be included directly! Use ElementsKernel/Configuration.h instead"
25 #include "ElementsKernel/Exception.h" // for Exception
26 #include "ElementsKernel/Path.h" // for Path::VARIABLE, Path::Type, Path::Item
27 // getPathFromLocations
30 inline namespace Kernel {
33 Path::Item getConfigurationPath(const T& file_name, bool raise_exception) {
35 auto location_list = getConfigurationLocations();
37 auto result = Path::getPathFromLocations(file_name, location_list);
39 if (result.empty() and raise_exception) {
40 throw Exception() << "The configuration path \"" << file_name << "\" cannot be found!";
46 namespace Configuration {
49 Path::Item getPath(const T& file_name, bool raise_exception) {
50 return getConfigurationPath(file_name, raise_exception);
53 } // namespace Configuration
56 } // namespace Elements
58 #endif // ELEMENTSKERNEL_ELEMENTSKERNEL_CONFIGURATION_IMPL_