Alexandria
2.19
Please provide a description of the project.
|
Superclass of all configuration classes. More...
#include <Configuration.h>
Public Types | |
enum | State { State::CONSTRUCTED, State::PRE_INITIALIZED, State::INITIALIZED, State::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. More... | |
virtual | ~Configuration ()=default |
Destructor. More... | |
virtual std::map< std::string, OptionDescriptionList > | getProgramOptions () |
Returns the program options defined by a specific configuration. More... | |
virtual void | preInitialize (const UserValues &args) |
Method which is called before the initialization phase. More... | |
virtual void | initialize (const UserValues &args) |
Method which is called during the initialization phase. More... | |
virtual void | postInitialize (const UserValues &args) |
Method which is called after the initialization phase. More... | |
const std::set< std::type_index > & | getDependencies () |
Returns the dependencies of the configuration. More... | |
State & | getCurrentState () |
Returns the current state of the configuration. More... | |
State | getCurrentState () const |
Returns the current state of the configuration. More... | |
Protected Member Functions | |
template<typename T > | |
void | declareDependency () |
Declares a Configuration as dependency. More... | |
template<typename T > | |
T & | getDependency () |
Returns a dependency. More... | |
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 45 of file Configuration.h.
using Euclid::Configuration::Configuration::OptionDescriptionList = std::vector<boost::program_options::option_description> |
Definition at line 60 of file Configuration.h.
using Euclid::Configuration::Configuration::UserValues = std::map<std::string, boost::program_options::variable_value> |
Definition at line 61 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 49 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.
Definition at line 28 of file Configuration.icpp.
References std::set< K >::emplace(), Euclid::Configuration::ConfigManager::getInstance(), m_dependencies, and m_manager_id.
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::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::PhotometricBandMappingConfig::setBaseDir(), and Euclid::Configuration::CatalogConfig::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.
Definition at line 35 of file Configuration.icpp.
References Euclid::Configuration::ConfigManager::getInstance(), and m_manager_id.
|
protected |
Definition at line 41 of file Configuration.icpp.
References Euclid::Configuration::ConfigManager::getInstance(), and m_manager_id.
|
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::CatalogConfig, Euclid::Configuration::SpecZCatalogConfig, Euclid::Configuration::PhotometricBandMappingConfig, Euclid::Configuration::PhotometryCatalogConfig, and Euclid::Configuration::PdfCatalogConfig< T >.
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 171 of file Configuration.h.
Referenced by declareDependency(), and getDependencies().
|
private |
Definition at line 170 of file Configuration.h.
Referenced by declareDependency(), and getDependency().
|
private |
Definition at line 172 of file Configuration.h.
Referenced by getCurrentState().