Alexandria  2.19
Please provide a description of the project.
ConfigManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2021 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
5  * Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option)
6  * any later version.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
9  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
10  * details.
11  *
12  * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
13  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14  */
15 
22 #ifndef _CONFIGURATION_CONFIGMANAGER_H
23 #define _CONFIGURATION_CONFIGMANAGER_H
24 
25 #include <boost/program_options.hpp>
26 #include <map>
27 #include <memory>
28 #include <string>
29 #include <typeindex>
30 
31 namespace Euclid {
32 namespace Configuration {
33 
34 // Forward definition of the Configuration class. It is included in the .icpp
35 // file. This is done to break the include circle.
36 class Configuration;
37 
82 
83 public:
85  static ConfigManager& getInstance(long id);
86 
90  virtual ~ConfigManager() = default;
91 
106  template <typename T>
108 
129  template <typename T1, typename T2>
131 
147  boost::program_options::options_description closeRegistration();
148 
169 
183  template <typename T>
185 
186 private:
187  explicit ConfigManager(long id);
188 
190 
191  long m_id;
196 
197 }; /* End of ConfigManager class */
198 
199 } /* namespace Configuration */
200 } /* namespace Euclid */
201 
203 
204 #endif
Euclid::Configuration::ConfigManager::registerConfiguration
void registerConfiguration()
Registers a Configuration to the manager.
Euclid::Configuration::ConfigManager
Manages a set of configuration classes.
Definition: ConfigManager.h:81
Euclid::Configuration::ConfigManager::State::REGISTRATION
@ REGISTRATION
Euclid::Configuration::ConfigManager::initialize
void initialize(const std::map< std::string, boost::program_options::variable_value > &user_values)
Initialize the manager.
Definition: ConfigManager.cpp:154
Euclid::Configuration::ConfigManager::closeRegistration
boost::program_options::options_description closeRegistration()
Terminates the manager registration phase.
Definition: ConfigManager.cpp:93
Euclid::Configuration::ConfigManager::State
State
Definition: ConfigManager.h:189
Euclid::Configuration::ConfigManager::getConfiguration
T & getConfiguration()
Returns a reference to the requested configuration.
Euclid::Configuration::ConfigManager::m_config_dictionary
std::map< std::type_index, std::unique_ptr< Configuration > > m_config_dictionary
Definition: ConfigManager.h:194
ConfigManager.icpp
Euclid::Configuration::ConfigManager::m_dependency_map
std::map< std::type_index, std::set< std::type_index > > m_dependency_map
Definition: ConfigManager.h:195
Euclid::Configuration::ConfigManager::m_id
long m_id
Definition: ConfigManager.h:191
Euclid::Configuration::ConfigManager::ConfigManager
ConfigManager(long id)
Definition: ConfigManager.cpp:43
std::map
STL class.
Euclid::Configuration::ConfigManager::State::WAITING_INITIALIZATION
@ WAITING_INITIALIZATION
Euclid::Configuration::ConfigManager::m_state
State m_state
Definition: ConfigManager.h:192
Euclid::Configuration::ConfigManager::State::INITIALIZED
@ INITIALIZED
Euclid::Configuration::ConfigManager::~ConfigManager
virtual ~ConfigManager()=default
Destructor.
Euclid::Configuration::ConfigManager::m_root_config
std::unique_ptr< std::type_index > m_root_config
Definition: ConfigManager.h:193
std::unique_ptr< std::type_index >
Euclid
Definition: InstOrRefHolder.h:29
Euclid::Configuration::ConfigManager::getInstance
static ConfigManager & getInstance(long id)
Returns a reference to the ConfigManager with the given ID.
Definition: ConfigManager.cpp:34
Euclid::Configuration::ConfigManager::registerDependency
void registerDependency()
Registers a dependency between two configurations.