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

Model of variant dependencies associated to a variant repository. More...

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

Inheritance diagram for datatools::configuration::variant_dependency_model:
datatools::i_tree_dumpable

Classes

struct  dependee_record
 Description of a dependee slot: More...
 
struct  dependency_record
 Description of a dependency: More...
 

Public Types

enum  rst_flags { PRINT_RST_NO_TITLE = datatools::bit_mask::bit00, PRINT_RST_NO_SCOPE = datatools::bit_mask::bit01 }
 Restructured text formatting. More...
 
typedef std::map< unsigned int, dependee_recorddependee_record_dict_type
 
typedef std::map< std::string, dependency_recorddependency_record_dict_type
 
typedef std::shared_ptr< variant_dependencydependency_ptr_type
 
typedef std::map< std::string, dependency_ptr_typedependency_dict_type
 
typedef std::map< std::string, std::set< std::string > > dependers_table_type
 
- 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

 variant_dependency_model (const variant_repository &repository_)
 Constructor. More...
 
 variant_dependency_model (const variant_registry &registry_)
 Constructor. More...
 
bool has_repository () const
 Check repository. More...
 
const variant_repositoryget_repository () const
 Return the repository. More...
 
bool has_registry () const
 Check registry. More...
 
const variant_registryget_registry () const
 Return the registry. More...
 
datatools::logger::priority get_logging () const
 Return the logging priority threshold. More...
 
void set_logging (const datatools::logger::priority)
 Set the logging priority threshold. More...
 
bool is_local () const
 Check if the dependency model is local to a registry. More...
 
bool has_dependee_record_by_path (const std::string &dependee_path_) const
 Check if a variant is used as a dependee. More...
 
bool has_dependee_record (unsigned int slot_) const
 Check if a dependee is set at given slot. More...
 
unsigned int add_dependee_record (unsigned int slot_, const std::string &dependee_path_)
 Add a dependee at given slot. More...
 
const std::string & get_dependee_record_path (unsigned int slot_) const
 Return the dependee path at given slot. More...
 
const dependee_record_dict_typeget_dependee_records () const
 Return the dictionary of dependee records. More...
 
void build_list_of_dependee_slots (std::set< unsigned int > &dep_slots_) const
 Build the list of dependee slots. More...
 
bool has_dependency_record (const std::string &name_) const
 Check if a dependency record is set. More...
 
bool has_dependency_record_by_depender_path (const std::string &name_) const
 Check if a dependency is set given its depender path. More...
 
void build_list_of_dependency_records (std::set< std::string > &dep_names_) const
 Build the list of dependency records by name. More...
 
void add_dependency_record (const std::string &name_, const std::string &depender_path_, const std::set< unsigned int > &input_slots_, const std::string &logic_expression_="", const datatools::logger::priority logging_=datatools::logger::PRIO_FATAL)
 Add a dependency. More...
 
const dependency_record_dict_typeget_dependency_records () const
 Return the dictionary of dependency records. More...
 
bool is_valid () const
 Check validity. More...
 
bool is_initialized () const
 Check initialization flag. More...
 
void initialize (const datatools::properties &config_)
 Initialization. More...
 
void reset ()
 Reset. 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...
 
bool has_dependency (const std::string &path_) const
 Check if a dependency is associated to a variant object given its path. More...
 
const variant_dependencyget_dependency (const std::string &path_) const
 Return the dependency associated to a variant object given its path. More...
 
const dependency_ptr_typeget_dependency_ptr (const std::string &path_) const
 Return the handle on the dependency associated to a variant object given its path. More...
 
const dependency_dict_typeget_dependencies () const
 Return the collection of dependencies. More...
 
const dependers_table_typeget_dependers_per_dependee () const
 Return the table of dependers' paths addressed by their respective dependees' paths. More...
 
void print_rst (std::ostream &out_, const uint32_t flags_=0, const std::string &indent_="") const
 Print documentation. More...
 
- Public Member Functions inherited from datatools::i_tree_dumpable
 i_tree_dumpable ()
 Constructor. More...
 
virtual ~i_tree_dumpable ()
 Destructor. More...
 
virtual void print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const
 Main new interface method for printing. 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
 

Protected Member Functions

void _at_init ()
 
void _at_init_build_table_of_dependers_ ()
 
void _at_reset ()
 

Additional Inherited Members

- 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_)
 

Detailed Description

Model of variant dependencies associated to a variant repository.

Dictionary of dependee slots: each dependee of interest publishes its activation state to a specific slot with unique slot ID:

+----------------+ Slot IDs
| Dependee "E0" o-->[0]
+----------------+
+----------------+
| Dependee "E1" o-->[1]
+----------------+
+----------------+
| Dependee "E2" o-->[2]
+----------------+
+----------------+
| Dependee "E3" o-->[5]
+----------------+
+----------------+
| Dependee "E4" o-->[12]
+----------------+

Dictionary of dependencies: each dependency computes its state from a logic which is connected to a set of input slots:

Enabling logic
+-----------------+ +-------+ Input slots
| Dependency "A" |--<--o AND |--<--o ([0]; [12])
+-----------------+ +-------+
+-----------------+ +-------+
| Dependency "B" |--<--o OR |--<--o ([0]; [2]; [5])
+-----------------+ +-------+
+-----------------+ +-------+
| Dependency "C" |--<--o NOT |--<--o ([1])
+-----------------+ +-------+

Member Typedef Documentation

◆ dependee_record_dict_type

◆ dependency_dict_type

◆ dependency_ptr_type

◆ dependency_record_dict_type

◆ dependers_table_type

typedef std::map<std::string, std::set<std::string> > datatools::configuration::variant_dependency_model::dependers_table_type

Member Enumeration Documentation

◆ rst_flags

Restructured text formatting.

Enumerator
PRINT_RST_NO_TITLE 
PRINT_RST_NO_SCOPE 

Constructor & Destructor Documentation

◆ variant_dependency_model() [1/2]

datatools::configuration::variant_dependency_model::variant_dependency_model ( const variant_repository repository_)

Constructor.

◆ variant_dependency_model() [2/2]

datatools::configuration::variant_dependency_model::variant_dependency_model ( const variant_registry registry_)

Constructor.

Member Function Documentation

◆ _at_init()

void datatools::configuration::variant_dependency_model::_at_init ( )
protected

◆ _at_init_build_table_of_dependers_()

void datatools::configuration::variant_dependency_model::_at_init_build_table_of_dependers_ ( )
protected

◆ _at_reset()

void datatools::configuration::variant_dependency_model::_at_reset ( )
protected

◆ add_dependee_record()

unsigned int datatools::configuration::variant_dependency_model::add_dependee_record ( unsigned int  slot_,
const std::string &  dependee_path_ 
)

Add a dependee at given slot.

◆ add_dependency_record()

void datatools::configuration::variant_dependency_model::add_dependency_record ( const std::string &  name_,
const std::string &  depender_path_,
const std::set< unsigned int > &  input_slots_,
const std::string &  logic_expression_ = "",
const datatools::logger::priority  logging_ = datatools::logger::PRIO_FATAL 
)

Add a dependency.

◆ build_list_of_dependee_slots()

void datatools::configuration::variant_dependency_model::build_list_of_dependee_slots ( std::set< unsigned int > &  dep_slots_) const

Build the list of dependee slots.

◆ build_list_of_dependency_records()

void datatools::configuration::variant_dependency_model::build_list_of_dependency_records ( std::set< std::string > &  dep_names_) const

Build the list of dependency records by name.

◆ get_dependee_record_path()

const std::string& datatools::configuration::variant_dependency_model::get_dependee_record_path ( unsigned int  slot_) const

Return the dependee path at given slot.

◆ get_dependee_records()

const dependee_record_dict_type& datatools::configuration::variant_dependency_model::get_dependee_records ( ) const

Return the dictionary of dependee records.

◆ get_dependencies()

const dependency_dict_type& datatools::configuration::variant_dependency_model::get_dependencies ( ) const

Return the collection of dependencies.

◆ get_dependency()

const variant_dependency& datatools::configuration::variant_dependency_model::get_dependency ( const std::string &  path_) const

Return the dependency associated to a variant object given its path.

◆ get_dependency_ptr()

const dependency_ptr_type& datatools::configuration::variant_dependency_model::get_dependency_ptr ( const std::string &  path_) const

Return the handle on the dependency associated to a variant object given its path.

◆ get_dependency_records()

const dependency_record_dict_type& datatools::configuration::variant_dependency_model::get_dependency_records ( ) const

Return the dictionary of dependency records.

◆ get_dependers_per_dependee()

const dependers_table_type& datatools::configuration::variant_dependency_model::get_dependers_per_dependee ( ) const

Return the table of dependers' paths addressed by their respective dependees' paths.

◆ get_logging()

datatools::logger::priority datatools::configuration::variant_dependency_model::get_logging ( ) const

Return the logging priority threshold.

◆ get_registry()

const variant_registry& datatools::configuration::variant_dependency_model::get_registry ( ) const

Return the registry.

◆ get_repository()

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

Return the repository.

◆ has_dependee_record()

bool datatools::configuration::variant_dependency_model::has_dependee_record ( unsigned int  slot_) const

Check if a dependee is set at given slot.

◆ has_dependee_record_by_path()

bool datatools::configuration::variant_dependency_model::has_dependee_record_by_path ( const std::string &  dependee_path_) const

Check if a variant is used as a dependee.

◆ has_dependency()

bool datatools::configuration::variant_dependency_model::has_dependency ( const std::string &  path_) const

Check if a dependency is associated to a variant object given its path.

◆ has_dependency_record()

bool datatools::configuration::variant_dependency_model::has_dependency_record ( const std::string &  name_) const

Check if a dependency record is set.

◆ has_dependency_record_by_depender_path()

bool datatools::configuration::variant_dependency_model::has_dependency_record_by_depender_path ( const std::string &  name_) const

Check if a dependency is set given its depender path.

◆ has_registry()

bool datatools::configuration::variant_dependency_model::has_registry ( ) const

Check registry.

◆ has_repository()

bool datatools::configuration::variant_dependency_model::has_repository ( ) const

Check repository.

◆ initialize()

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

Initialization.

◆ is_initialized()

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

Check initialization flag.

◆ is_local()

bool datatools::configuration::variant_dependency_model::is_local ( ) const

Check if the dependency model is local to a registry.

◆ is_valid()

bool datatools::configuration::variant_dependency_model::is_valid ( ) const

Check validity.

◆ print_rst()

void datatools::configuration::variant_dependency_model::print_rst ( std::ostream &  out_,
const uint32_t  flags_ = 0,
const std::string &  indent_ = "" 
) const

Print documentation.

◆ reset()

void datatools::configuration::variant_dependency_model::reset ( )

Reset.

◆ set_logging()

void datatools::configuration::variant_dependency_model::set_logging ( const datatools::logger::priority  )

Set the logging priority threshold.

◆ tree_dump()

virtual void datatools::configuration::variant_dependency_model::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.


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