Alexandria 2.31.0
SDC-CH common library for the Euclid project
|
Superclass of all configuration classes. More...
#include <Configuration.h>
Public Types | |
enum class | State { CONSTRUCTED , PRE_INITIALIZED , INITIALIZED , FINAL } |
Defines the different states the configuration object can be in. More... | |
using | OptionDescriptionList = std::vector< boost::program_options::option_description > |
using | UserValues = std::map< std::string, boost::program_options::variable_value > |
Public Member Functions | |
Configuration (long manager_id) | |
Constructs a new Configuration instance. | |
virtual | ~Configuration ()=default |
Destructor. | |
virtual std::map< std::string, OptionDescriptionList > | getProgramOptions () |
Returns the program options defined by a specific configuration. | |
virtual void | preInitialize (const UserValues &args) |
Method which is called before the initialization phase. | |
virtual void | initialize (const UserValues &args) |
Method which is called during the initialization phase. | |
virtual void | postInitialize (const UserValues &args) |
Method which is called after the initialization phase. | |
const std::set< std::type_index > & | getDependencies () |
Returns the dependencies of the configuration. | |
State & | getCurrentState () |
Returns the current state of the configuration. | |
State | getCurrentState () const |
Returns the current state of the configuration. | |
Protected Member Functions | |
template<typename T > | |
void | declareDependency () |
Declares a Configuration as dependency. | |
template<typename T > | |
T & | getDependency () |
Returns a dependency. | |
template<typename T > | |
const T & | getDependency () const |
Private Attributes | |
long | m_manager_id |
std::set< std::type_index > | m_dependencies |
State | m_state = State::CONSTRUCTED |
Superclass of all configuration classes.
For details of how to implement specific configuration implementations see the documentation of the virtual methods.
Definition at line 48 of file Configuration.h.
using Euclid::Configuration::Configuration::OptionDescriptionList = std::vector<boost::program_options::option_description> |
Definition at line 63 of file Configuration.h.
using Euclid::Configuration::Configuration::UserValues = std::map<std::string, boost::program_options::variable_value> |
Definition at line 64 of file Configuration.h.
|
strong |
Defines the different states the configuration object can be in.
Enumerator | |
---|---|
CONSTRUCTED | The object has just been constructed. |
PRE_INITIALIZED | The preInitialize() method has been called and waits for initialization. |
INITIALIZED | The initialize() method has been called. |
FINAL | The postInitialize() method has been called. |
Definition at line 52 of file Configuration.h.
|
explicit |
Constructs a new Configuration instance.
Definition at line 27 of file Configuration.cpp.
|
virtualdefault |
Destructor.
|
protected |
Declares a Configuration as dependency.
Configuration implementations can use this method in their constructor to declare their dependencies.
Configuration::State & Euclid::Configuration::Configuration::getCurrentState | ( | ) |
Returns the current state of the configuration.
Definition at line 43 of file Configuration.cpp.
References m_state.
Referenced by Euclid::Configuration::CatalogConfig::addAttributeHandler(), Euclid::Configuration::PdfCatalogConfig< T >::addPdfColumn(), Euclid::Configuration::CatalogConfig::getColumnInfo(), Euclid::Configuration::PhotometricBandMappingConfig::getConvertFromMagMapping(), Euclid::Configuration::CatalogConfig::getFilename(), Euclid::Configuration::PhotometricBandMappingConfig::getMappingFile(), Euclid::Configuration::PhotometricBandMappingConfig::getPhotometricBandMapping(), Euclid::Configuration::CatalogConfig::getTableReader(), Euclid::Configuration::CatalogConfig::getTableToCatalogConverter(), Euclid::Configuration::PhotometricBandMappingConfig::getUpperLimitThresholdMapping(), Euclid::Configuration::PhotometryCatalogConfig::isMissingPhotometryEnabled(), Euclid::Configuration::PhotometryCatalogConfig::isUpperLimitEnabled(), Euclid::Configuration::CatalogConfig::readAsCatalog(), Euclid::Configuration::CatalogConfig::readAsTable(), Euclid::Configuration::CatalogConfig::setBaseDir(), and Euclid::Configuration::PhotometricBandMappingConfig::setBaseDir().
Configuration::State Euclid::Configuration::Configuration::getCurrentState | ( | ) | const |
Returns the current state of the configuration.
Definition at line 47 of file Configuration.cpp.
References m_state.
const std::set< std::type_index > & Euclid::Configuration::Configuration::getDependencies | ( | ) |
Returns the dependencies of the configuration.
Definition at line 39 of file Configuration.cpp.
References m_dependencies.
|
protected |
Returns a dependency.
Configuration implementations can use this method to get their dependencies during the initialization phase.
|
protected |
|
virtual |
Returns the program options defined by a specific configuration.
Configuration implementations should implement this method to return the boost program option descriptions they require. The keys of the map will be used as the group message in the final options grouping, so they can be used for grouping options from different Configuration implementations.
The default implementation returns an empty map.
Reimplemented in Euclid::Configuration::CatalogConfig, Euclid::Configuration::PhotometricBandMappingConfig, Euclid::Configuration::PhotometryCatalogConfig, and Euclid::Configuration::SpecZCatalogConfig.
Definition at line 29 of file Configuration.cpp.
|
virtual |
Method which is called during the initialization phase.
The Configuration implementations should override this method to implement their logic. When this method is called, all the configurations which are defined as dependencies by using the declareDependency() method are guaranteed to already be initialized.
args | The user parameters |
Reimplemented in Euclid::Configuration::PdfCatalogConfig< T >, Euclid::Configuration::CatalogConfig, Euclid::Configuration::PhotometricBandMappingConfig, Euclid::Configuration::PhotometryCatalogConfig, and Euclid::Configuration::SpecZCatalogConfig.
Definition at line 35 of file Configuration.cpp.
|
virtual |
Method which is called after the initialization phase.
This method is called after all configurations have been initialized. It can be overridden by Configurations which want to perform an action with the guarantee that all other Configurations are initialized. There is no guarantee on the order this method is called between the dependent configurations.
args | The user parameters |
Definition at line 37 of file Configuration.cpp.
|
virtual |
Method which is called before the initialization phase.
The Configuration implementations can override this method to implement actions which are fast and do not require their dependencies (like textual validation of the inputs). There is no guarantee on the order this method is called between the dependent configurations.
args | The user parameters |
Reimplemented in Euclid::Configuration::CatalogConfig, and Euclid::Configuration::SpecZCatalogConfig.
Definition at line 33 of file Configuration.cpp.
|
private |
Definition at line 174 of file Configuration.h.
Referenced by getDependencies().
|
private |
Definition at line 173 of file Configuration.h.
|
private |
Definition at line 175 of file Configuration.h.
Referenced by getCurrentState(), and getCurrentState().