Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
Registry of configuration variant parameters and associated variants. More...
#include <bayeux/datatools/configuration/variant_registry.h>
Public Types | |
enum | list_flags { LIST_ACTIVE_ONLY = datatools::bit_mask::bit00, LIST_NO_SET = datatools::bit_mask::bit01, LIST_NO_UNSET = datatools::bit_mask::bit02, LIST_CLEAR = datatools::bit_mask::bit03, LIST_NO_PARAMETERS = datatools::bit_mask::bit04, LIST_NO_VARIANTS = datatools::bit_mask::bit05, LIST_RANKED = datatools::bit_mask::bit06 } |
Flags for building the list of parameters. More... | |
typedef std::map< std::string, variant_record > | record_dict_type |
Type of dictionary of configuration variant records. More... | |
Public Types inherited from datatools::enriched_base | |
enum | export_config_flags { EXPORT_CONFIG_CLEAR = bit_mask::bit00, EXPORT_CONFIG_NAME = bit_mask::bit01, EXPORT_CONFIG_DISPLAY_NAME = bit_mask::bit02, EXPORT_CONFIG_TERSE_DESCRIPTION = bit_mask::bit03, EXPORT_CONFIG_LOGGING_PRIORITY = bit_mask::bit04, EXPORT_CONFIG_AUXILIARIES = bit_mask::bit05, EXPORT_CONFIG_DEFAULT, EXPORT_CONFIG_LAST = EXPORT_CONFIG_AUXILIARIES } |
Flags for export to a container of properties. More... | |
Public Types inherited from datatools::i_tree_dumpable | |
enum | ostream_type { OSTREAM_COUT = 1, OSTREAM_CERR = 2, OSTREAM_CLOG = 3 } |
Enumeration for standard output streams. More... | |
Public Member Functions | |
virtual bool | is_name_valid (const std::string &name_) const |
Check if a name is valid. More... | |
variant_registry () | |
Default constructor. More... | |
virtual | ~variant_registry () |
Destructor. More... | |
bool | has_top_variant_name () const |
Check if the top variant name is set. More... | |
const std::string & | get_top_variant_name () const |
Return the name of the top variant used to initialize the registry. More... | |
record_dict_type & | grab_records () |
Return a reference to the mutable dictionary of records. More... | |
const record_dict_type & | get_records () const |
Return a reference to the non-mutable dictionary of records. More... | |
bool | is_mounted () const |
Check if the registry is mounted in some parent repository. More... | |
const std::string & | get_mounting_name () const |
Return the mounting name. More... | |
bool | has_parent_repository () const |
Check the parent repository. More... | |
void | set_parent_repository (const variant_repository &, const std::string &mounting_name_) |
Set the parent repository. More... | |
void | reset_parent_repository () |
Reset the parent repository. More... | |
const variant_repository & | get_parent_repository () const |
Return the handle to the parent repository. More... | |
bool | is_initialized () const |
Check initialization. More... | |
void | initialize_from (const variant_registry_manager &mgr_, const std::string &top_variant_="", const std::string &name_="", const std::string &display_name_="", const std::string &terse_description_="") |
Initialize. More... | |
void | reset () |
Reset. More... | |
variant_record & | add_record (const std::string &record_path_) |
Add a new record. More... | |
bool | has_variant_record (const std::string &record_path_) const |
Check if a variant record exists. More... | |
variant_record & | grab_variant_record (const std::string &record_path_) |
Return a reference to a mutable variant record. More... | |
bool | parameter_exists (const std::string &variant_path_) const |
Check if a variant parameter exists (active or not) More... | |
bool | variant_exists (const std::string &variant_path_) const |
Check if a variant exists (active or not) More... | |
bool | is_active_variant (const std::string &variant_path_) const |
Check if a variant is active. More... | |
const variant_record & | get_variant_record (const std::string &record_path_) const |
Return a reference to a non mutable variant record. More... | |
bool | has_parameter_record (const std::string &record_path_) const |
Check if a parameter record exists. More... | |
bool | has_parameter_record_value_group (const std::string ¶m_group_path_) const |
Check if a parameter record group exists. More... | |
variant_record & | grab_parameter_record (const std::string &record_path_) |
Return a reference to a mutable parameter record. More... | |
const variant_record & | get_parameter_record (const std::string &record_path_) const |
Return a reference to a non mutable parameter record. More... | |
const variant_record & | get_top_variant_record () const |
Return a reference to the non mutable top variant record. More... | |
bool | has_dependency_model () const |
Check if a local dependency model is set. More... | |
const variant_dependency_model & | get_dependency_model () const |
Return the local dependency model. More... | |
void | load_local_dependency_model (const datatools::properties &ldm_config_) |
Load local dependency model. More... | |
virtual void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &inden_="", bool inherit_=false) const |
Smart print. More... | |
void | list_of_ranked_parameters (std::vector< std::string > &paths_) const |
Compute the ranked list of parameters. More... | |
void | list_of_ranked_records (std::vector< std::string > &paths_, uint32_t flags_=0) const |
Compute the ranked list of records. More... | |
void | list_of_parameters (std::vector< std::string > &_paths_, uint32_t flags_=0) const |
Compute the list of parameters. More... | |
void | list_of_unset_parameters (std::vector< std::string > &unset_paths_) const |
Compute the list of unset parameters. More... | |
void | build_recursive_list_of_ranked_records (const variant_record &record_, std::vector< std::string > &ranked_) const |
bool | is_accomplished () const |
Check if all parameters are set. More... | |
void | update () |
Update record status. More... | |
Public Member Functions inherited from datatools::enriched_base | |
enriched_base () | |
Default constructor. More... | |
enriched_base (const std::string &name_, const std::string &display_name_="", const std::string &terse_description_="", logger::priority lp_=logger::PRIO_FATAL) | |
Constructor. More... | |
virtual | ~enriched_base () |
Destructor. More... | |
bool | has_name () const |
Check if the name is not empty. More... | |
void | set_name (const std::string &name_) |
Set the name. More... | |
enriched_base & | set_name_c (const std::string &name_) |
Set the name. More... | |
const std::string & | get_name () const |
Return the name. More... | |
void | reset_name () |
Reset the name. More... | |
bool | has_display_name () const |
Check if the display name is empty. More... | |
void | set_display_name (const std::string &display_name_) |
Set the display name. More... | |
enriched_base & | set_display_name_c (const std::string &display_name_) |
Set the display name. More... | |
const std::string & | get_display_name () const |
Return the display name. More... | |
bool | has_terse_description () const |
Check if the description is empty. More... | |
void | set_terse_description (const std::string &terse_description_) |
Set the description. More... | |
enriched_base & | set_terse_description_c (const std::string &terse_description_) |
Set the description. More... | |
const std::string & | get_terse_description () const |
Return the description. More... | |
bool | has_auxiliaries () const |
Check if the container of auxiliary properties is empty. More... | |
const datatools::properties & | get_auxiliaries () const |
Return a reference to the non mutable container of auxiliary properties. More... | |
datatools::properties & | grab_auxiliaries () |
Return a reference to the mutable container of auxiliary properties. More... | |
void | reset_auxiliaries () |
Remove all auxiliary properties. More... | |
bool | is_debug () const |
Check the debug status. More... | |
void | set_logging_priority (logger::priority lp_) |
Set the logging priority threshold. More... | |
enriched_base & | set_logging_priority_c (logger::priority lp_) |
Set the logging priority threshold. More... | |
void | set_logging (const std::string &label_) |
Set the logging priority threshold from a string. More... | |
logger::priority | get_logging_priority () const |
Return the logging priority threshold. More... | |
void | clear () |
Clear. More... | |
void | reset () |
Clear. More... | |
void | print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const override |
Smart print. More... | |
void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const override |
Smart print. More... | |
void | initialize (const datatools::properties &config_, bool clear_=false) |
Initialization from a container of properties. More... | |
void | export_to_config (datatools::properties &config_, uint32_t flags_=EXPORT_CONFIG_DEFAULT, const std::string &prefix_="") const |
Export to a container of properties. More... | |
Public Member Functions inherited from datatools::i_serializable | |
i_serializable () | |
Default constructor. More... | |
virtual | ~i_serializable () |
Destructor. More... | |
virtual const std::string & | get_serial_tag () const =0 |
Return the serialization string identifier of the class. More... | |
Public Member Functions inherited from datatools::i_tree_dumpable | |
i_tree_dumpable () | |
Constructor. More... | |
virtual | ~i_tree_dumpable () |
Destructor. More... | |
void | print_tree_json (std::ostream &out_=std::clog, const std::string &json_options_="") const |
Printing with jsonized options. More... | |
void | print_tree_json (std::ostream &out_=std::clog, const char *json_options_=nullptr) const |
Printing with jsonized options. More... | |
void | tree_dump_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="", const bool inherit_=false) const |
void | tree_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="") const |
void | smart_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="") const |
Static Public Member Functions | |
static const std::string & | default_top_variant_name () |
Return the default root variant name. More... | |
Static Public Member Functions inherited from datatools::enriched_base | |
static bool | validate_name (const std::string &candidate_name_) |
Validate a name. More... | |
static logger::priority | default_logging_priority () |
Return the default logging priority threshold. More... | |
static void | init_ocd (datatools::object_configuration_description &) |
OCD support. More... | |
Static Public Member Functions inherited from datatools::i_tree_dumpable | |
static const boost::property_tree::ptree & | empty_options () |
static boost::property_tree::ptree | make_base_print_options (const std::string &title_, const std::string &indent_="", const bool inherit_=false) |
static std::ostream & | last_skip_tag (std::ostream &out_) |
static std::ostream & | skip_tag (std::ostream &out_) |
static std::ostream & | last_tag (std::ostream &out_) |
static std::ostream & | tag (std::ostream &out_) |
Registry of configuration variant parameters and associated variants.
typedef std::map<std::string, variant_record> datatools::configuration::variant_registry::record_dict_type |
Type of dictionary of configuration variant records.
datatools::configuration::variant_registry::variant_registry | ( | ) |
Default constructor.
|
virtual |
Destructor.
variant_record& datatools::configuration::variant_registry::add_record | ( | const std::string & | record_path_ | ) |
Add a new record.
void datatools::configuration::variant_registry::build_recursive_list_of_ranked_records | ( | const variant_record & | record_, |
std::vector< std::string > & | ranked_ | ||
) | const |
Compute the recursive list of ranked records For variant records, the explicitely ranked daughter params are listed first, then come unranked params in arbitrary (alphabetical) order. For parameter records, daughter variant records are listed in native order.
|
static |
Return the default root variant name.
const variant_dependency_model& datatools::configuration::variant_registry::get_dependency_model | ( | ) | const |
Return the local dependency model.
const std::string& datatools::configuration::variant_registry::get_mounting_name | ( | ) | const |
Return the mounting name.
const variant_record& datatools::configuration::variant_registry::get_parameter_record | ( | const std::string & | record_path_ | ) | const |
Return a reference to a non mutable parameter record.
const variant_repository& datatools::configuration::variant_registry::get_parent_repository | ( | ) | const |
Return the handle to the parent repository.
const record_dict_type& datatools::configuration::variant_registry::get_records | ( | ) | const |
Return a reference to the non-mutable dictionary of records.
const std::string& datatools::configuration::variant_registry::get_top_variant_name | ( | ) | const |
Return the name of the top variant used to initialize the registry.
const variant_record& datatools::configuration::variant_registry::get_top_variant_record | ( | ) | const |
Return a reference to the non mutable top variant record.
const variant_record& datatools::configuration::variant_registry::get_variant_record | ( | const std::string & | record_path_ | ) | const |
Return a reference to a non mutable variant record.
variant_record& datatools::configuration::variant_registry::grab_parameter_record | ( | const std::string & | record_path_ | ) |
Return a reference to a mutable parameter record.
record_dict_type& datatools::configuration::variant_registry::grab_records | ( | ) |
Return a reference to the mutable dictionary of records.
variant_record& datatools::configuration::variant_registry::grab_variant_record | ( | const std::string & | record_path_ | ) |
Return a reference to a mutable variant record.
bool datatools::configuration::variant_registry::has_dependency_model | ( | ) | const |
Check if a local dependency model is set.
bool datatools::configuration::variant_registry::has_parameter_record | ( | const std::string & | record_path_ | ) | const |
Check if a parameter record exists.
bool datatools::configuration::variant_registry::has_parameter_record_value_group | ( | const std::string & | param_group_path_ | ) | const |
Check if a parameter record group exists.
bool datatools::configuration::variant_registry::has_parent_repository | ( | ) | const |
Check the parent repository.
bool datatools::configuration::variant_registry::has_top_variant_name | ( | ) | const |
Check if the top variant name is set.
bool datatools::configuration::variant_registry::has_variant_record | ( | const std::string & | record_path_ | ) | const |
Check if a variant record exists.
void datatools::configuration::variant_registry::initialize_from | ( | const variant_registry_manager & | mgr_, |
const std::string & | top_variant_ = "" , |
||
const std::string & | name_ = "" , |
||
const std::string & | display_name_ = "" , |
||
const std::string & | terse_description_ = "" |
||
) |
Initialize.
bool datatools::configuration::variant_registry::is_accomplished | ( | ) | const |
Check if all parameters are set.
bool datatools::configuration::variant_registry::is_active_variant | ( | const std::string & | variant_path_ | ) | const |
Check if a variant is active.
bool datatools::configuration::variant_registry::is_initialized | ( | ) | const |
Check initialization.
bool datatools::configuration::variant_registry::is_mounted | ( | ) | const |
Check if the registry is mounted in some parent repository.
|
virtual |
Check if a name is valid.
Reimplemented from datatools::enriched_base.
void datatools::configuration::variant_registry::list_of_parameters | ( | std::vector< std::string > & | _paths_, |
uint32_t | flags_ = 0 |
||
) | const |
Compute the list of parameters.
void datatools::configuration::variant_registry::list_of_ranked_parameters | ( | std::vector< std::string > & | paths_ | ) | const |
Compute the ranked list of parameters.
void datatools::configuration::variant_registry::list_of_ranked_records | ( | std::vector< std::string > & | paths_, |
uint32_t | flags_ = 0 |
||
) | const |
Compute the ranked list of records.
void datatools::configuration::variant_registry::list_of_unset_parameters | ( | std::vector< std::string > & | unset_paths_ | ) | const |
Compute the list of unset parameters.
void datatools::configuration::variant_registry::load_local_dependency_model | ( | const datatools::properties & | ldm_config_ | ) |
Load local dependency model.
bool datatools::configuration::variant_registry::parameter_exists | ( | const std::string & | variant_path_ | ) | const |
Check if a variant parameter exists (active or not)
void datatools::configuration::variant_registry::reset | ( | ) |
Reset.
void datatools::configuration::variant_registry::reset_parent_repository | ( | ) |
Reset the parent repository.
void datatools::configuration::variant_registry::set_parent_repository | ( | const variant_repository & | , |
const std::string & | mounting_name_ | ||
) |
Set the parent repository.
|
virtual |
Smart print.
Reimplemented from datatools::i_tree_dumpable.
void datatools::configuration::variant_registry::update | ( | ) |
Update record status.
bool datatools::configuration::variant_registry::variant_exists | ( | const std::string & | variant_path_ | ) | const |
Check if a variant exists (active or not)