Bayeux  3.4.1
Core Foundation library for SuperNEMO
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
datatools::configuration::variant_repository Class Reference

Variant repository. More...

#include <bayeux/datatools/configuration/variant_repository.h>

Inheritance diagram for datatools::configuration::variant_repository:
datatools::enriched_base datatools::i_serializable datatools::i_tree_dumpable

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_entryregistry_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 &registry_name_) const
 Check if a registry exists. More...
 
const variant_registryget_registry (const std::string &registry_name_) const
 Return a reference to a non mutable registry. More...
 
variant_registrygrab_registry (const std::string &registry_name_)
 Return a reference to a mutable registry. More...
 
const registry_dict_typeget_registries () const
 Return a reference to the non-mutable dictionary of registries. More...
 
registry_dict_typegrab_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 &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. More...
 
void registration_external (variant_registry &external_registry_, const std::string &registry_name_="", int rank_=-1)
 Registration of an external registry. More...
 
void unregistration (const std::string &registry_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 &registry_name_) const
 Check if a registry is ranked. More...
 
int get_rank (const std::string &registry_name_) const
 Return the rank of a registry. More...
 
bool is_active_registry (const std::string &registry_key_) const
 Check if a variant registry is active. More...
 
bool is_active_variant (const std::string &registry_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 &registry_key_, const std::string &variant_path_) const
 Check if a variant is known. More...
 
bool has_variant_parameter (const std::string &registry_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_modelget_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_reportinggrab_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_baseset_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_baseset_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_baseset_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::propertiesget_auxiliaries () const
 Return a reference to the non mutable container of auxiliary properties. More...
 
datatools::propertiesgrab_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_baseset_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 &registry_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 &registry_name_, int rank_=-1)
 
void _legacy_load_registries (const datatools::properties &config_)
 
void _at_init_ ()
 
void _at_reset_ ()
 
void _compute_ranked_unranked_ ()
 

Detailed Description

Variant repository.

Member Typedef Documentation

◆ ranked_dict_type

◆ registry_dict_type

Type of dictionary of configuration variant registries.

Member Enumeration Documentation

◆ rst_flags

Restructured text formatting.

Enumerator
PRINT_RST_NO_TITLE 

Constructor & Destructor Documentation

◆ variant_repository()

datatools::configuration::variant_repository::variant_repository ( )

Default constructor.

◆ ~variant_repository()

datatools::configuration::variant_repository::~variant_repository ( )

Destructor.

Member Function Documentation

◆ _add_entry()

registry_entry& datatools::configuration::variant_repository::_add_entry ( const std::string &  registry_name_,
int  rank_ = -1 
)
protected

◆ _at_init_()

void datatools::configuration::variant_repository::_at_init_ ( )
protected

◆ _at_reset_()

void datatools::configuration::variant_repository::_at_reset_ ( )
protected

◆ _compute_ranked_unranked_()

void datatools::configuration::variant_repository::_compute_ranked_unranked_ ( )
protected

◆ _legacy_load_registries()

void datatools::configuration::variant_repository::_legacy_load_registries ( const datatools::properties config_)
protected
Deprecated:
Deprecated configuration mode for embedded variant registries

◆ build_ordered_registry_keys()

void datatools::configuration::variant_repository::build_ordered_registry_keys ( std::vector< std::string > &  keys_) const

Built the ordered list of registry keys.

◆ clear_registries()

void datatools::configuration::variant_repository::clear_registries ( )

Clear all registries.

◆ external_registries_unregistration()

void datatools::configuration::variant_repository::external_registries_unregistration ( )

Unregistration of external registries only.

◆ get_application()

const std::string& datatools::configuration::variant_repository::get_application ( ) const

Return the name of the application.

◆ get_dependency_model()

const variant_dependency_model& datatools::configuration::variant_repository::get_dependency_model ( ) const

Return the global dependency model.

◆ get_number_of_registries()

unsigned int datatools::configuration::variant_repository::get_number_of_registries ( ) const

Return the number of registries.

◆ get_organization()

const std::string& datatools::configuration::variant_repository::get_organization ( ) const

Return the name of the organization.

◆ get_rank()

int datatools::configuration::variant_repository::get_rank ( const std::string &  registry_name_) const

Return the rank of a registry.

◆ get_registries()

const registry_dict_type& datatools::configuration::variant_repository::get_registries ( ) const

Return a reference to the non-mutable dictionary of registries.

◆ get_registry()

const variant_registry& datatools::configuration::variant_repository::get_registry ( const std::string &  registry_name_) const

Return a reference to a non mutable registry.

◆ grab_registries()

registry_dict_type& datatools::configuration::variant_repository::grab_registries ( )

Return a reference to the mutable dictionary of registries.

◆ grab_registry()

variant_registry& datatools::configuration::variant_repository::grab_registry ( const std::string &  registry_name_)

Return a reference to a mutable registry.

◆ grab_reporting()

variant_reporting& datatools::configuration::variant_repository::grab_reporting ( )

Access to the variant usage reporting (if any)

◆ has_application()

bool datatools::configuration::variant_repository::has_application ( ) const

Check the name of the application.

◆ has_dependency_model()

bool datatools::configuration::variant_repository::has_dependency_model ( ) const

Check if a global dependency model is set.

◆ has_organization()

bool datatools::configuration::variant_repository::has_organization ( ) const

Check the name of the organization.

◆ has_registry()

bool datatools::configuration::variant_repository::has_registry ( const std::string &  registry_name_) const

Check if a registry exists.

◆ has_reporting()

bool datatools::configuration::variant_repository::has_reporting ( ) const

Check if a variant usage reporting is attached.

◆ has_variant()

bool datatools::configuration::variant_repository::has_variant ( const std::string &  registry_key_,
const std::string &  variant_path_ 
) const

Check if a variant is known.

◆ has_variant_parameter()

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.

◆ initialize()

void datatools::configuration::variant_repository::initialize ( const datatools::properties config_)

Initialize from a properties container.

◆ initialize_simple()

void datatools::configuration::variant_repository::initialize_simple ( )

Basic initialize.

◆ is_accomplished()

bool datatools::configuration::variant_repository::is_accomplished ( ) const

Check if all embedded registries are accomplished.

◆ is_active_registry()

bool datatools::configuration::variant_repository::is_active_registry ( const std::string &  registry_key_) const

Check if a variant registry is active.

◆ is_active_variant()

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.

◆ is_initialized()

bool datatools::configuration::variant_repository::is_initialized ( ) const

Check the initialization flag.

◆ is_locked()

bool datatools::configuration::variant_repository::is_locked ( ) const

Check if the repository is locked.

◆ is_name_valid()

virtual bool datatools::configuration::variant_repository::is_name_valid ( const std::string &  name_) const
virtual

Check if a name is valid.

Reimplemented from datatools::enriched_base.

◆ is_ranked()

bool datatools::configuration::variant_repository::is_ranked ( const std::string &  registry_name_) const

Check if a registry is ranked.

◆ is_requested_lock()

bool datatools::configuration::variant_repository::is_requested_lock ( ) const

Check if lock is requested after initialization.

◆ list_of_registry_keys()

void datatools::configuration::variant_repository::list_of_registry_keys ( std::set< std::string > &  keys_) const

Build the list of registry keys.

◆ load_global_dependency_model()

void datatools::configuration::variant_repository::load_global_dependency_model ( const datatools::properties gdm_config_)

Load global dependency model.

◆ load_registries()

void datatools::configuration::variant_repository::load_registries ( const datatools::properties config_)

Load embedded registries from a properties container.

◆ lock()

void datatools::configuration::variant_repository::lock ( )

Lock the repository.

◆ parse_variant_path()

static bool datatools::configuration::variant_repository::parse_variant_path ( const std::string &  variant_full_path_,
std::string &  registry_name_,
std::string &  variant_path_,
bool &  reversed_ 
)
static

Extract the registry name and variant path from an activated variant directive.

Parameters
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:

  • "myregistry:the/path/to/a/variant"
  • "!myregistry:the/path/to/a/variant" A leading '!' means that the variant should not be active

◆ print_rst()

void datatools::configuration::variant_repository::print_rst ( std::ostream &  out_,
uint32_t  flags_ = 0 
) const

Print documentation.

◆ rank_is_used()

bool datatools::configuration::variant_repository::rank_is_used ( int  rank_) const

Check if a given rank is used.

◆ registration_embedded()

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.

◆ registration_external()

void datatools::configuration::variant_repository::registration_external ( variant_registry external_registry_,
const std::string &  registry_name_ = "",
int  rank_ = -1 
)

Registration of an external registry.

◆ reset()

void datatools::configuration::variant_repository::reset ( )

Reset.

◆ reset_reporting()

void datatools::configuration::variant_repository::reset_reporting ( )

Detach a variant usage reporting (if any)

◆ set_application()

void datatools::configuration::variant_repository::set_application ( const std::string &  )

Set the name of the application.

◆ set_organization()

void datatools::configuration::variant_repository::set_organization ( const std::string &  )

Set the name of the organization.

◆ set_reporting()

void datatools::configuration::variant_repository::set_reporting ( variant_reporting )

Attach a variant usage reporting.

◆ set_requested_lock()

void datatools::configuration::variant_repository::set_requested_lock ( bool  rl_)

Set flag for requested lock after initialization.

◆ system_discard()

void datatools::configuration::variant_repository::system_discard ( ) const

Discard from the system variant repository.

◆ system_export()

void datatools::configuration::variant_repository::system_export ( uint32_t  flags_ = 0)

Export to the system variant repository.

◆ tree_dump()

virtual void datatools::configuration::variant_repository::tree_dump ( std::ostream &  out_ = std::clog,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  inherit_ = false 
) const
virtual

Smart print.

Reimplemented from datatools::i_tree_dumpable.

◆ unlock()

void datatools::configuration::variant_repository::unlock ( )

Unlock the repository.

◆ unregistration()

void datatools::configuration::variant_repository::unregistration ( const std::string &  registry_name_)

Unregistration of some specific registry.

◆ update()

void datatools::configuration::variant_repository::update ( )

Update all registries and variant record status.


The documentation for this class was generated from the following file: