Alexandria  2.19
Please provide a description of the project.
Configuration.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_CONFIGURATION_H
23 #define _CONFIGURATION_CONFIGURATION_H
24 
25 #include <boost/program_options.hpp>
26 #include <map>
27 #include <set>
28 #include <string>
29 #include <typeindex>
30 #include <vector>
31 
32 namespace Euclid {
33 namespace Configuration {
34 
46 
47 public:
49  enum class State {
57  FINAL
58  };
59 
62 
64  explicit Configuration(long manager_id);
65 
69  virtual ~Configuration() = default;
70 
84 
98  virtual void preInitialize(const UserValues& args);
99 
113  virtual void initialize(const UserValues& args);
114 
129  virtual void postInitialize(const UserValues& args);
130 
133 
136 
138  State getCurrentState() const;
139 
140 protected:
149  template <typename T>
151 
163  template <typename T>
165 
166  template <typename T>
167  const T& getDependency() const;
168 
169 private:
173 
174 }; /* End of Configuration class */
175 
176 } /* namespace Configuration */
177 } /* namespace Euclid */
178 
180 
181 #endif
Euclid::Configuration::Configuration::declareDependency
void declareDependency()
Declares a Configuration as dependency.
Euclid::Configuration::Configuration::getDependency
T & getDependency()
Returns a dependency.
Euclid::Configuration::Configuration::getCurrentState
State & getCurrentState()
Returns the current state of the configuration.
Definition: Configuration.cpp:43
std::vector
STL class.
Euclid::Configuration::Configuration::State::CONSTRUCTED
@ CONSTRUCTED
The object has just been constructed.
Euclid::Configuration::Configuration::Configuration
Configuration(long manager_id)
Constructs a new Configuration instance.
Definition: Configuration.cpp:27
Euclid::Configuration::Configuration::initialize
virtual void initialize(const UserValues &args)
Method which is called during the initialization phase.
Definition: Configuration.cpp:35
Euclid::Configuration::Configuration::preInitialize
virtual void preInitialize(const UserValues &args)
Method which is called before the initialization phase.
Definition: Configuration.cpp:33
Euclid::Configuration::Configuration::getProgramOptions
virtual std::map< std::string, OptionDescriptionList > getProgramOptions()
Returns the program options defined by a specific configuration.
Definition: Configuration.cpp:29
Euclid::Configuration::Configuration::m_dependencies
std::set< std::type_index > m_dependencies
Definition: Configuration.h:171
Euclid::Configuration::Configuration::State::FINAL
@ FINAL
The postInitialize() method has been called.
Euclid::Configuration::Configuration::m_state
State m_state
Definition: Configuration.h:172
std::map
STL class.
Euclid::Configuration::Configuration::State::PRE_INITIALIZED
@ PRE_INITIALIZED
The preInitialize() method has been called and waits for initialization.
Euclid::Configuration::Configuration::m_manager_id
long m_manager_id
Definition: Configuration.h:170
Euclid::Configuration::Configuration::getDependencies
const std::set< std::type_index > & getDependencies()
Returns the dependencies of the configuration.
Definition: Configuration.cpp:39
Euclid::Configuration::Configuration::~Configuration
virtual ~Configuration()=default
Destructor.
Euclid::Configuration::Configuration::State
State
Defines the different states the configuration object can be in.
Definition: Configuration.h:49
Euclid::Configuration::Configuration::postInitialize
virtual void postInitialize(const UserValues &args)
Method which is called after the initialization phase.
Definition: Configuration.cpp:37
Euclid::Configuration::Configuration::getDependency
const T & getDependency() const
Euclid::Configuration::Configuration
Superclass of all configuration classes.
Definition: Configuration.h:45
Configuration.icpp
Euclid
Definition: InstOrRefHolder.h:29
Euclid::Configuration::Configuration::State::INITIALIZED
@ INITIALIZED
The initialize() method has been called.
std::set< std::type_index >