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
2044c637
Commit
2044c637
authored
Dec 18, 2018
by
Simon Spannagel
Browse files
Module: make ConfigManager available
parent
2c9d2b15
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/core/module/Module.cpp
View file @
2044c637
...
...
@@ -82,3 +82,17 @@ bool Module::has_detector(std::string name) {
Configuration
&
Module
::
get_configuration
()
{
return
m_config
;
}
/**
* @throws InvalidModuleActionException If this method is called from the constructor or destructor
* @warning This function technically allows to write to the configurations of other modules, but this should never be done
*/
ConfigManager
*
Module
::
getConfigManager
()
{
if
(
conf_manager_
==
nullptr
)
{
throw
InvalidModuleActionException
(
"Cannot access the config manager in constructor or destructor."
);
};
return
conf_manager_
;
}
void
Module
::
set_config_manager
(
ConfigManager
*
conf_manager
)
{
conf_manager_
=
conf_manager
;
}
src/core/module/Module.hpp
View file @
2044c637
...
...
@@ -13,7 +13,7 @@
#include
"ModuleIdentifier.hpp"
#include
"core/clipboard/Clipboard.hpp"
#include
"core/config/Config
uration
.hpp"
#include
"core/config/Config
Manager
.hpp"
#include
"core/detector/Detector.hpp"
#include
"exceptions.h"
...
...
@@ -116,6 +116,12 @@ namespace corryvreckan {
*/
virtual
void
finalise
(){};
/**
* @brief Get the config manager object to allow to read the global and other module configurations
* @return Pointer to the config manager
*/
ConfigManager
*
getConfigManager
();
/**
* @brief Get ROOT directory which should be used to output histograms et cetera
* @return ROOT directory for storage
...
...
@@ -176,6 +182,13 @@ namespace corryvreckan {
ModuleIdentifier
get_identifier
()
const
;
ModuleIdentifier
identifier_
;
/**
* @brief Set the link to the config manager
* @param conf_manager ConfigManager holding all relevant configurations
*/
void
set_config_manager
(
ConfigManager
*
config
);
ConfigManager
*
conf_manager_
{
nullptr
};
/**
* @brief Set the output ROOT directory for this module
* @param directory ROOT directory for storage
...
...
src/core/module/ModuleManager.cpp
View file @
2044c637
...
...
@@ -589,6 +589,9 @@ void ModuleManager::initialiseAll() {
// Loop over all modules and initialise them
LOG
(
STATUS
)
<<
"=================| Initialising modules |=================="
;
for
(
auto
&
module
:
m_modules
)
{
// Pass the config manager to this instance
module
->
set_config_manager
(
conf_manager_
);
// Create main ROOT directory for this module class if it does not exists yet
LOG
(
TRACE
)
<<
"Creating and accessing ROOT directory"
;
std
::
string
module_name
=
module
->
getConfig
().
getName
();
...
...
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