/
configurationmanager.h
192 lines (181 loc) · 10.9 KB
/
configurationmanager.h
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___CONFIGURATIONMANAGER___H__
#define __OPENSPACE_CORE___CONFIGURATIONMANAGER___H__
#include <ghoul/misc/dictionary.h>
namespace openspace {
namespace documentation { struct Documentation; }
/**
* The ConfigurationManager takes care of loading the major configuration file
* <code>openspace.cfg</code> and making it available to the rest of the application. The
* exposed keys in the ghoul::Dictionary are declared in this class as static constants.
* The findConfiguration method walks the filesystem from a provided starting point until
* it found the requested file or throws a ghoul::RuntimeError if it could not find the
* file. The loadFromFile method then loads the file into a ghoul::Dictionary format.
*/
class ConfigurationManager : public ghoul::Dictionary {
public:
/// The key that stores the subdirectory containing all predefined path tokens
static const std::string KeyPaths;
/// The key that stores the location to the cache directory used to store all the
/// permanent and non-permanent cached files
static const std::string KeyCache;
/// The key that stores the main directory for fonts
static const std::string KeyFonts;
/// The key that stores the location of the SGCT configuration file that is used on
/// application launch
static const std::string KeyConfigSgct;
/// The part of the key that defines the type
static const std::string PartType;
/// The part of the key that defines the file
static const std::string PartFile;
/// The key that stores the Lua documentation
static const std::string KeyLuaDocumentation;
/// The key that stores the scripting log
static const std::string KeyScriptLog;
/// The key that stores the Property documentation
static const std::string KeyPropertyDocumentation;
/// The key that stores the keyboard bindings that should be stored
static const std::string KeyKeyboardShortcuts;
/// The key that stores the main documentation
static const std::string KeyDocumentation;
/// The key that stores the factory documentation values
static const std::string KeyFactoryDocumentation;
/// The key that stores the scene license documentation values
static const std::string KeySceneLicenseDocumentation;
/// The key that stores the location of the scene file that is initially loaded
static const std::string KeyConfigScene;
/// The key that stores the location of the tasks files
static const std::string KeyConfigTasksRoot;
/// The key that stores the subdirectory containing a list of all startup scripts to
/// be executed on application start before the scene file is loaded
static const std::string KeyStartupScript;
/// The key that stores the subdirectory containing a list of all settings scripts to
/// be executed on application start and after the scene file is loaded
static const std::string KeySettingsScript;
/// The key that stores the settings for determining log-related settings
static const std::string KeyLogging;
/// The key that stores the directory for Logging
static const std::string PartLogDir;
/// The key that stores the desired LogLevel for the whole application
/// \sa ghoul::logging::LogManager
static const std::string PartLogLevel;
/// The key that stores whether the log should be immediately flushed after a n
/// \sa ghoul::logging::LogManager
static const std::string PartImmediateFlush;
/// The key for prefixing PerformanceMeasurement logfiles
static const std::string PartLogPerformancePrefix;
/// The key that stores a subdirectory with a description for additional
/// ghoul::logging::Log%s to be created
/// \sa LogFactory
static const std::string PartLogs;
/// The key that stores whether a log should be appended to or should be overwritten
static const std::string PartAppend;
/// The key that stores the verbosity (None, Minimal, Default, Full) of the system
/// capabilities components
static const std::string PartCapabilitiesVerbosity;
/// The key that stores the settings for determining Launcher-related settings
static const std::string KeyLauncher;
/// The full key that stores the verbosity of the system capabilities component
static const std::string KeyCapabilitiesVerbosity;
/// The key that stores the time (in seconds) that the application will wait before
/// shutting down after the shutdown call is made
static const std::string KeyShutdownCountdown;
/// The key that stores whether the onscreen text should be scaled to the window size
/// or the window resolution
static const std::string KeyOnScreenTextScaling;
/// The key that stores whether the master node should perform rendering just function
/// as a pure manager
static const std::string KeyDisableMasterRendering;
/// The key that stores whether the master node should apply the scene transformation
static const std::string KeyDisableSceneOnMaster;
/// The key that sets the request URL that is used to request additional data to be
/// downloaded
static const std::string KeyDownloadRequestURL;
/// The key that stores the switch for enabling/disabling the rendering on a master
/// computer
static const std::string KeyRenderingMethod;
/// The key that determines whether a new cache folder is used for each scene file
static const std::string KeyPerSceneCache;
/// The key that stores the http proxy settings for the downloadmanager
static const std::string KeyHttpProxy;
/// The key that stores the address of the http proxy
static const std::string PartHttpProxyAddress;
/// The key that stores the port of the http proxy
static const std::string PartHttpProxyPort;
/// The key that stores the authentication method of the http proxy
static const std::string PartHttpProxyAuthentication;
/// The key that stores the username to use for authentication to access the http proxy
static const std::string PartHttpProxyUser;
/// The key that stores the password to use for authentication to access the http proxy
static const std::string PartHttpProxyPassword;
/// The key that stores the dictionary containing information about debug contexts
static const std::string KeyOpenGLDebugContext;
/// The part of the key storing whether an OpenGL Debug context should be created
static const std::string PartActivate;
/// The part of the key storing whether the debug callbacks are performed synchronous
static const std::string PartSynchronous;
/// The part of the key storing a list of identifiers that should be filtered out
static const std::string PartFilterIdentifier;
/// The part of the key that stores the source of the ignored identifier
static const std::string PartFilterIdentifierSource;
/// The part of the key that stores the type of the ignored identifier
static const std::string PartFilterIdentifierType;
/// The part of the key that stores the identifier of the ignored identifier
static const std::string PartFilterIdentifierIdentifier;
/// The part of the key storing a list of severities that should be filtered out
static const std::string PartFilterSeverity;
/// The part of the key storing whether the OpenGL state should be checked each call
static const std::string KeyCheckOpenGLState;
/// The part of the key storing whether each OpenGL call should be logged
static const std::string KeyLogEachOpenGLCall;
/**
* Iteratively walks the directory structure starting with \p filename to find the
* base name compoenent of \p filename. The directory structure is searched by first
* searching the current directory and then moving iteratively to the the parent
* directory.
* \param filename The fully qualified filename to be searched for
* \return The path to the file that was found with the same base name as \p filename
* but higher up in the file structure.
* \throw ghoul::RuntimeError If the configuration could not be found
*/
static std::string findConfiguration(const std::string& filename);
/**
* Load the provided configuration file (\p filename) into this Dictionary. All paths
* that are specified in the configuration file will automatically be registered in
* the ghoul::filesystem::FileSystem.
* \param filename The filename to be loaded
* \throw SpecificationError If the configuration file was not complete (i.e., did
* not specify the necessary keys KeyPaths, KeyPaths.KeyCache, KeyFonts, and
* KeyConfigSgct)
* \throw ghoul::lua::LuaRuntimeException If there was Lua-based error loading the
* configuration file
* \pre \p filename must not be empty
* \pre \p filename must exist
*/
void loadFromFile(const std::string& filename);
static documentation::Documentation Documentation();
};
} // namespace openspace
#endif // __OPENSPACE_CORE___CONFIGURATIONMANAGER___H__