Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
12e2ae29
Commit
12e2ae29
authored
Dec 18, 2018
by
Simon Spannagel
Browse files
ConfigManager: delay parsing of detectors_file until needed. Fixes
#45
parent
0eb03d97
Pipeline
#637257
passed with stages
in 14 minutes and 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/core/config/ConfigManager.cpp
View file @
12e2ae29
...
...
@@ -69,7 +69,9 @@ ConfigManager::ConfigManager(std::string file_name,
module_configs_
.
push_back
(
config
);
}
}
void
ConfigManager
::
parse_detectors
()
{
// Reading detector file
auto
detector_file_names
=
global_config_
.
getPathArray
(
"detectors_file"
,
true
);
LOG
(
TRACE
)
<<
"Reading detector configurations"
;
...
...
@@ -129,6 +131,10 @@ bool ConfigManager::loadDetectorOptions(const std::vector<std::string>& options)
detector_option_parser
.
parseOption
(
option
);
}
if
(
detector_configs_
.
empty
())
{
parse_detectors
();
}
// Apply detector options
for
(
auto
&
config
:
detector_configs_
)
{
optionsApplied
=
detector_option_parser
.
applyOptions
(
config
.
getName
(),
config
)
||
optionsApplied
;
...
...
@@ -147,6 +153,10 @@ std::list<Configuration>& ConfigManager::getModuleConfigurations() {
* The list of detector configurations is read from the configuration defined in 'detector_file'
*/
std
::
list
<
Configuration
>&
ConfigManager
::
getDetectorConfigurations
()
{
if
(
detector_configs_
.
empty
())
{
parse_detectors
();
}
return
detector_configs_
;
}
...
...
src/core/config/ConfigManager.hpp
View file @
12e2ae29
...
...
@@ -113,6 +113,9 @@ namespace corryvreckan {
std
::
set
<
std
::
string
>
global_names_
{};
std
::
set
<
std
::
string
>
ignore_names_
{};
// Helper function to parse detectors file
void
parse_detectors
();
OptionParser
module_option_parser_
;
std
::
list
<
Configuration
>
module_configs_
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment