Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
Variant repository. More...
#include <bayeux/datatools/configuration/variant_repository.h>
Classes | |
class | exporter |
Export a variant repository to a properties container. More... | |
class | importer |
Import a variant repository from a properties container. More... | |
struct | registry_entry |
Entry that hosts a variant registry. More... | |
Public Types | |
enum | rst_flags { PRINT_RST_NO_TITLE = datatools::bit_mask::bit00 } |
Restructured text formatting. More... | |
typedef std::map< std::string, registry_entry > | registry_dict_type |
Type of dictionary of configuration variant registries. More... | |
typedef std::map< int, std::string > | ranked_dict_type |
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_repository () | |
Default constructor. More... | |
~variant_repository () | |
Destructor. More... | |
bool | has_organization () const |
Check the name of the organization. More... | |
const std::string & | get_organization () const |
Return the name of the organization. More... | |
void | set_organization (const std::string &) |
Set the name of the organization. More... | |
bool | has_application () const |
Check the name of the application. More... | |
const std::string & | get_application () const |
Return the name of the application. More... | |
void | set_application (const std::string &) |
Set the name of the application. More... | |
void | initialize (const datatools::properties &config_) |
Initialize from a properties container. More... | |
void | load_registries (const datatools::properties &config_) |
Load embedded registries from a properties container. More... | |
void | load_global_dependency_model (const datatools::properties &gdm_config_) |
Load global dependency model. More... | |
void | initialize_simple () |
Basic initialize. More... | |
void | reset () |
Reset. More... | |
bool | is_initialized () const |
Check the initialization flag. More... | |
virtual void | tree_dump (std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const |
Smart print. More... | |
unsigned int | get_number_of_registries () const |
Return the number of registries. More... | |
void | list_of_registry_keys (std::set< std::string > &keys_) const |
Build the list of registry keys. More... | |
bool | has_registry (const std::string ®istry_name_) const |
Check if a registry exists. More... | |
const variant_registry & | get_registry (const std::string ®istry_name_) const |
Return a reference to a non mutable registry. More... | |
variant_registry & | grab_registry (const std::string ®istry_name_) |
Return a reference to a mutable registry. More... | |
const registry_dict_type & | get_registries () const |
Return a reference to the non-mutable dictionary of registries. More... | |
registry_dict_type & | grab_registries () |
Return a reference to the mutable dictionary of registries. More... | |
bool | rank_is_used (int rank_) const |
Check if a given rank is used. More... | |
void | registration_embedded (const std::string ®istry_manager_config_, const std::string &top_variant_name_="", const std::string ®istry_name_="", const std::string ®istry_display_name_="", const std::string ®istry_terse_description_="", int registry_rank_=-1, const datatools::logger::priority registry_logging_=datatools::logger::PRIO_UNDEFINED) |
Registration of an embedded registry. More... | |
void | registration_external (variant_registry &external_registry_, const std::string ®istry_name_="", int rank_=-1) |
Registration of an external registry. More... | |
void | unregistration (const std::string ®istry_name_) |
Unregistration of some specific registry. More... | |
void | build_ordered_registry_keys (std::vector< std::string > &keys_) const |
Built the ordered list of registry keys. More... | |
bool | is_ranked (const std::string ®istry_name_) const |
Check if a registry is ranked. More... | |
int | get_rank (const std::string ®istry_name_) const |
Return the rank of a registry. More... | |
bool | is_active_registry (const std::string ®istry_key_) const |
Check if a variant registry is active. More... | |
bool | is_active_variant (const std::string ®istry_key_, const std::string &variant_path_) const |
Check if a variant is active. More... | |
void | clear_registries () |
Clear all registries. More... | |
void | external_registries_unregistration () |
Unregistration of external registries only. More... | |
bool | is_accomplished () const |
Check if all embedded registries are accomplished. More... | |
void | set_requested_lock (bool rl_) |
Set flag for requested lock after initialization. More... | |
bool | is_requested_lock () const |
Check if lock is requested after initialization. More... | |
bool | is_locked () const |
Check if the repository is locked. More... | |
void | lock () |
Lock the repository. More... | |
void | unlock () |
Unlock the repository. More... | |
bool | has_variant (const std::string ®istry_key_, const std::string &variant_path_) const |
Check if a variant is known. More... | |
bool | has_variant_parameter (const std::string ®istry_key_, const std::string &variant_parameter_path_) const |
Check if a variant parameter is known. More... | |
bool | has_dependency_model () const |
Check if a global dependency model is set. More... | |
const variant_dependency_model & | get_dependency_model () const |
Return the global dependency model. More... | |
void | print_rst (std::ostream &out_, uint32_t flags_=0) const |
Print documentation. More... | |
void | system_export (uint32_t flags_=0) |
Export to the system variant repository. More... | |
void | system_discard () const |
Discard from the system variant repository. More... | |
bool | has_reporting () const |
Check if a variant usage reporting is attached. More... | |
void | set_reporting (variant_reporting &) |
Attach a variant usage reporting. More... | |
void | reset_reporting () |
Detach a variant usage reporting (if any) More... | |
variant_reporting & | grab_reporting () |
Access to the variant usage reporting (if any) More... | |
void | update () |
Update all registries and variant 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 bool | parse_variant_path (const std::string &variant_full_path_, std::string ®istry_name_, std::string &variant_path_, bool &reversed_) |
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_) |
Protected Member Functions | |
registry_entry & | _add_entry (const std::string ®istry_name_, int rank_=-1) |
void | _legacy_load_registries (const datatools::properties &config_) |
void | _at_init_ () |
void | _at_reset_ () |
void | _compute_ranked_unranked_ () |
Variant repository.
typedef std::map<int, std::string> datatools::configuration::variant_repository::ranked_dict_type |
typedef std::map<std::string, registry_entry> datatools::configuration::variant_repository::registry_dict_type |
Type of dictionary of configuration variant registries.
datatools::configuration::variant_repository::variant_repository | ( | ) |
Default constructor.
datatools::configuration::variant_repository::~variant_repository | ( | ) |
Destructor.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void datatools::configuration::variant_repository::build_ordered_registry_keys | ( | std::vector< std::string > & | keys_ | ) | const |
Built the ordered list of registry keys.
void datatools::configuration::variant_repository::clear_registries | ( | ) |
Clear all registries.
void datatools::configuration::variant_repository::external_registries_unregistration | ( | ) |
Unregistration of external registries only.
const std::string& datatools::configuration::variant_repository::get_application | ( | ) | const |
Return the name of the application.
const variant_dependency_model& datatools::configuration::variant_repository::get_dependency_model | ( | ) | const |
Return the global dependency model.
unsigned int datatools::configuration::variant_repository::get_number_of_registries | ( | ) | const |
Return the number of registries.
const std::string& datatools::configuration::variant_repository::get_organization | ( | ) | const |
Return the name of the organization.
int datatools::configuration::variant_repository::get_rank | ( | const std::string & | registry_name_ | ) | const |
Return the rank of a registry.
const registry_dict_type& datatools::configuration::variant_repository::get_registries | ( | ) | const |
Return a reference to the non-mutable dictionary of registries.
const variant_registry& datatools::configuration::variant_repository::get_registry | ( | const std::string & | registry_name_ | ) | const |
Return a reference to a non mutable registry.
registry_dict_type& datatools::configuration::variant_repository::grab_registries | ( | ) |
Return a reference to the mutable dictionary of registries.
variant_registry& datatools::configuration::variant_repository::grab_registry | ( | const std::string & | registry_name_ | ) |
Return a reference to a mutable registry.
variant_reporting& datatools::configuration::variant_repository::grab_reporting | ( | ) |
Access to the variant usage reporting (if any)
bool datatools::configuration::variant_repository::has_application | ( | ) | const |
Check the name of the application.
bool datatools::configuration::variant_repository::has_dependency_model | ( | ) | const |
Check if a global dependency model is set.
bool datatools::configuration::variant_repository::has_organization | ( | ) | const |
Check the name of the organization.
bool datatools::configuration::variant_repository::has_registry | ( | const std::string & | registry_name_ | ) | const |
Check if a registry exists.
bool datatools::configuration::variant_repository::has_reporting | ( | ) | const |
Check if a variant usage reporting is attached.
bool datatools::configuration::variant_repository::has_variant | ( | const std::string & | registry_key_, |
const std::string & | variant_path_ | ||
) | const |
Check if a variant is known.
bool datatools::configuration::variant_repository::has_variant_parameter | ( | const std::string & | registry_key_, |
const std::string & | variant_parameter_path_ | ||
) | const |
Check if a variant parameter is known.
void datatools::configuration::variant_repository::initialize | ( | const datatools::properties & | config_ | ) |
Initialize from a properties container.
void datatools::configuration::variant_repository::initialize_simple | ( | ) |
Basic initialize.
bool datatools::configuration::variant_repository::is_accomplished | ( | ) | const |
Check if all embedded registries are accomplished.
bool datatools::configuration::variant_repository::is_active_registry | ( | const std::string & | registry_key_ | ) | const |
Check if a variant registry is active.
bool datatools::configuration::variant_repository::is_active_variant | ( | const std::string & | registry_key_, |
const std::string & | variant_path_ | ||
) | const |
Check if a variant is active.
bool datatools::configuration::variant_repository::is_initialized | ( | ) | const |
Check the initialization flag.
bool datatools::configuration::variant_repository::is_locked | ( | ) | const |
Check if the repository is locked.
|
virtual |
Check if a name is valid.
Reimplemented from datatools::enriched_base.
bool datatools::configuration::variant_repository::is_ranked | ( | const std::string & | registry_name_ | ) | const |
Check if a registry is ranked.
bool datatools::configuration::variant_repository::is_requested_lock | ( | ) | const |
Check if lock is requested after initialization.
void datatools::configuration::variant_repository::list_of_registry_keys | ( | std::set< std::string > & | keys_ | ) | const |
Build the list of registry keys.
void datatools::configuration::variant_repository::load_global_dependency_model | ( | const datatools::properties & | gdm_config_ | ) |
Load global dependency model.
void datatools::configuration::variant_repository::load_registries | ( | const datatools::properties & | config_ | ) |
Load embedded registries from a properties container.
void datatools::configuration::variant_repository::lock | ( | ) |
Lock the repository.
|
static |
Extract the registry name and variant path from an activated variant directive.
variant_full_path_ | The input variant full path |
registry_name_ | The output resolved registry name |
variant_path_ | The output resolved variant path |
reversed_ | Reversed activation flag |
Supported syntax:
void datatools::configuration::variant_repository::print_rst | ( | std::ostream & | out_, |
uint32_t | flags_ = 0 |
||
) | const |
Print documentation.
bool datatools::configuration::variant_repository::rank_is_used | ( | int | rank_ | ) | const |
Check if a given rank is used.
void datatools::configuration::variant_repository::registration_embedded | ( | const std::string & | registry_manager_config_, |
const std::string & | top_variant_name_ = "" , |
||
const std::string & | registry_name_ = "" , |
||
const std::string & | registry_display_name_ = "" , |
||
const std::string & | registry_terse_description_ = "" , |
||
int | registry_rank_ = -1 , |
||
const datatools::logger::priority | registry_logging_ = datatools::logger::PRIO_UNDEFINED |
||
) |
Registration of an embedded registry.
void datatools::configuration::variant_repository::registration_external | ( | variant_registry & | external_registry_, |
const std::string & | registry_name_ = "" , |
||
int | rank_ = -1 |
||
) |
Registration of an external registry.
void datatools::configuration::variant_repository::reset | ( | ) |
Reset.
void datatools::configuration::variant_repository::reset_reporting | ( | ) |
Detach a variant usage reporting (if any)
void datatools::configuration::variant_repository::set_application | ( | const std::string & | ) |
Set the name of the application.
void datatools::configuration::variant_repository::set_organization | ( | const std::string & | ) |
Set the name of the organization.
void datatools::configuration::variant_repository::set_reporting | ( | variant_reporting & | ) |
Attach a variant usage reporting.
void datatools::configuration::variant_repository::set_requested_lock | ( | bool | rl_ | ) |
Set flag for requested lock after initialization.
void datatools::configuration::variant_repository::system_discard | ( | ) | const |
Discard from the system variant repository.
void datatools::configuration::variant_repository::system_export | ( | uint32_t | flags_ = 0 | ) |
Export to the system variant repository.
|
virtual |
Smart print.
Reimplemented from datatools::i_tree_dumpable.
void datatools::configuration::variant_repository::unlock | ( | ) |
Unlock the repository.
void datatools::configuration::variant_repository::unregistration | ( | const std::string & | registry_name_ | ) |
Unregistration of some specific registry.
void datatools::configuration::variant_repository::update | ( | ) |
Update all registries and variant record status.