forked from degauden/Elements
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConfiguration.h
More file actions
113 lines (94 loc) · 3.83 KB
/
Copy pathConfiguration.h
File metadata and controls
113 lines (94 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* @file ElementsKernel/Configuration.h
*
* @brief provide functions to retrieve configuration files
* @date Feb 8, 2017
* @author Hubert Degaudenzi
*
* @copyright 2012-2020 Euclid Science Ground Segment
*
* This library is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the
*
* Free Software Foundation, Inc.,
* 51 Franklin Street,
* Fifth Floor,
* Boston, MA 02110-1301 USA
*
*
*/
/**
* \addtogroup ElementsKernel ElementsKernel
* @{
*/
#ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_CONFIGURATION_H_
#define ELEMENTSKERNEL_ELEMENTSKERNEL_CONFIGURATION_H_
#include <string> // for string
#include <vector> // for vector
#include "ElementsKernel/Export.h" // ELEMENTS_API
#include "ElementsKernel/Path.h" // for Path::Item
namespace Elements {
inline namespace Kernel {
/**
* @brief retrieve the variable name used for the configuration file lookup
* @ingroup ElementsKernel
* @return
* the standard variable name: ELEMENTS_CONF_PATH
*/
ELEMENTS_API std::string getConfigurationVariableName();
/// @brief retrieve the path to a configuration file
template <typename T>
ELEMENTS_API Path::Item getConfigurationPath(const T& file_name, bool raise_exception = true);
/// Instantiation of the most expected types
extern template ELEMENTS_API Path::Item getConfigurationPath(const Path::Item& file_name, bool raise_exception);
extern template ELEMENTS_API Path::Item getConfigurationPath(const std::string& file_name, bool raise_exception);
/**
* @brief Retrieves a list of configuration file locations, optionally restricted to those that exist.
* @param exist_only A boolean flag. If true, only paths that exist on the filesystem will be included in the result.
* If false, all potential configuration locations will be returned.
* @return A vector of Path::Item objects representing the identified configuration locations.
*/
ELEMENTS_API std::vector<Path::Item> getConfigurationLocations(bool exist_only = false);
namespace Configuration {
/**
* @brief alias for the getAuxiliaryVariableName function
* @ingroup ElementsKernel
* @return same as getAuxiliaryVariableName
*/
ELEMENTS_API std::string getVariableName();
/**
* @brief alias for the getAuxiliaryPath function
* @ingroup ElementsKernel
* @param file_name
* file name of the configuration file to be found.
* @param raise_exception
* enable the raising of an exception if the file is not found
* @return same as getAuxiliaryPath
*/
template <typename T>
ELEMENTS_API Path::Item getPath(const T& file_name, bool raise_exception = true);
// instantiation of the most expected types
extern template ELEMENTS_API Path::Item getPath(const Path::Item& file_name, bool raise_exception);
extern template ELEMENTS_API Path::Item getPath(const std::string& file_name, bool raise_exception);
/**
* @brief alias for the getConfigurationLocations function
* @ingroup ElementsKernel
* @return same as getConfigurationLocations
*/
ELEMENTS_API std::vector<Path::Item> getLocations(bool exist_only = false);
} // namespace Configuration
} // namespace Kernel
} // namespace Elements
#define ELEMENTSKERNEL_ELEMENTSKERNEL_CONFIGURATION_IMPL_
#include "ElementsKernel/_impl/Configuration.tpp" // IWYU pragma: export
#undef ELEMENTSKERNEL_ELEMENTSKERNEL_CONFIGURATION_IMPL_
#endif // ELEMENTSKERNEL_ELEMENTSKERNEL_CONFIGURATION_H_
/**@}*/