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

A variant dependency associated a depender variant object o a set of dependee variants. The object may be one of the following types: More...

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

Inheritance diagram for datatools::configuration::variant_dependency:
datatools::i_tree_dumpable

Public Types

typedef std::map< unsigned int, variant_object_infodependee_dict_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 (const variant_repository &repository_)
 Constructor. More...
 
 variant_dependency (const variant_registry &registry_)
 Constructor. More...
 
 ~variant_dependency ()
 Destructor. More...
 
bool has_repository () const
 Check repository. More...
 
const variant_repositoryget_repository () const
 Return the repository handle. More...
 
bool has_registry () const
 Check registry. More...
 
const variant_registryget_registry () const
 Return the repository handle. More...
 
bool has_global_scope () const
 Check registry. More...
 
bool has_local_scope () const
 Check registry. More...
 
bool is_local () const
 Check if the dependency model is local to a registry. More...
 
bool is_valid () const
 Check validity. More...
 
void set_depender_by_path (const std::string &depender_name_, bool registry_scope_=false)
 Set the depender from its identifier. More...
 
void set_depender (const variant_object_info &depender_)
 Set the depender. More...
 
const variant_object_infoget_depender () const
 Return the depender. More...
 
std::size_t get_number_of_dependees () const
 Return the number of dependee slots. More...
 
unsigned int add_dependee_by_path (const std::string &dependee_path_, const unsigned int slot_=std::numeric_limits< unsigned int >::max())
 Associate a dependee from its identifier to a slot. More...
 
unsigned int add_dependee (const variant_object_info &dependee_, const unsigned int slot_=std::numeric_limits< unsigned int >::max())
 Associate a dependee to a slot. More...
 
void build_list_of_dependee_slots (std::set< unsigned int > &slots_) const
 Build set of dependee slots. More...
 
bool has_dependee (const unsigned int slot_) const
 Check if a dependee is set at given slot. More...
 
bool has_dependee_by_path (const std::string &dependee_path_) const
 Check if a dependee is set with given path. More...
 
const variant_object_infoget_dependee (const unsigned int slot_) const
 Return the dependee associated to a given slot. 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...
 
base_dependency_logiccreate_logic (const std::string &guid_)
 Instantiate the embedded predicate: More...
 
const base_dependency_logicget_logic () const
 Return the embedded predicate. More...
 
base_dependency_logicgrab_logic ()
 Return the embedded predicate. More...
 
void build_logic_from_formula (const std::string &logic_expression_)
 Buil the logic from formula. More...
 
bool is_locked () const
 Check if dependency is locked. More...
 
void lock ()
 Lock the dependency. More...
 
bool operator() () const
 Check if the dependency is fulfilled. 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...
 
- 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 _lock ()
 
void _check ()
 
void _install_default_logic ()
 

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

A variant dependency associated a depender variant object o a set of dependee variants. The object may be one of the following types:

General dependency scheme:

The logic object The collection of dependees
compute the final dependee addressed by slot numbers
"enable" bit slots
:
unique some : +------------+
output input v | |
port ports ,--[0]s Dependee#0 |
: : / | (variant) |
v v v +------------+
+------------+ +--------+ / +------------+
| | | i[0]--' | |
| Depender e-<--o Logic i[1]----<----[3]s Dependee#1 |
| | | i[2]--, | (variant) |
+------------+ +--------+ \ +------------+
^ ^ +------------+
: \ | |
: `--[9]s Dependee#2 |
enable bit | (variant) |
associated to the depender +------------+
See also
For the definition of depender/dependee terms: https://en.wiktionary.org/wiki/dependee

Member Typedef Documentation

◆ dependee_dict_type

Constructor & Destructor Documentation

◆ variant_dependency() [1/2]

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

Constructor.

◆ variant_dependency() [2/2]

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

Constructor.

◆ ~variant_dependency()

datatools::configuration::variant_dependency::~variant_dependency ( )

Destructor.

Member Function Documentation

◆ _check()

void datatools::configuration::variant_dependency::_check ( )
protected

◆ _install_default_logic()

void datatools::configuration::variant_dependency::_install_default_logic ( )
protected

Build and install a default logic object is no formula/expresion has been explicitely given.

If there are several dependees, we force an AND operator: all dependees must be fulfilled to enable the dependency:

+-------+ +----------+
,--o SLOT |<==[0]s Dependee |
+-------+ / | logic | +----------+
| AND i[0]--<--' +-------+
o |
| logic i[1]--<--,
+-------+ \ +-------+ +----------+
`--o SLOT |<==[7]s Dependee |
| logic | +----------+
+-------+

It there is only one dependee, then the embedded logic is a single SLOT logic connected to the unique dependee slot:

+-------+
| SLOT | +----------+
o |<==[1]s Dependee |
| logic | +----------+
+-------+

◆ _lock()

void datatools::configuration::variant_dependency::_lock ( )
protected

◆ add_dependee()

unsigned int datatools::configuration::variant_dependency::add_dependee ( const variant_object_info dependee_,
const unsigned int  slot_ = std::numeric_limits< unsigned int >::max() 
)

Associate a dependee to a slot.

◆ add_dependee_by_path()

unsigned int datatools::configuration::variant_dependency::add_dependee_by_path ( const std::string &  dependee_path_,
const unsigned int  slot_ = std::numeric_limits< unsigned int >::max() 
)

Associate a dependee from its identifier to a slot.

◆ build_list_of_dependee_slots()

void datatools::configuration::variant_dependency::build_list_of_dependee_slots ( std::set< unsigned int > &  slots_) const

Build set of dependee slots.

◆ build_logic_from_formula()

void datatools::configuration::variant_dependency::build_logic_from_formula ( const std::string &  logic_expression_)

Buil the logic from formula.

◆ create_logic()

base_dependency_logic& datatools::configuration::variant_dependency::create_logic ( const std::string &  guid_)

Instantiate the embedded predicate:

◆ get_dependee()

const variant_object_info& datatools::configuration::variant_dependency::get_dependee ( const unsigned int  slot_) const

Return the dependee associated to a given slot.

◆ get_depender()

const variant_object_info& datatools::configuration::variant_dependency::get_depender ( ) const

Return the depender.

◆ get_logging()

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

Return the logging priority threshold.

◆ get_logic()

const base_dependency_logic& datatools::configuration::variant_dependency::get_logic ( ) const

Return the embedded predicate.

◆ get_number_of_dependees()

std::size_t datatools::configuration::variant_dependency::get_number_of_dependees ( ) const

Return the number of dependee slots.

◆ get_registry()

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

Return the repository handle.

◆ get_repository()

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

Return the repository handle.

◆ grab_logic()

base_dependency_logic& datatools::configuration::variant_dependency::grab_logic ( )

Return the embedded predicate.

◆ has_dependee()

bool datatools::configuration::variant_dependency::has_dependee ( const unsigned int  slot_) const

Check if a dependee is set at given slot.

◆ has_dependee_by_path()

bool datatools::configuration::variant_dependency::has_dependee_by_path ( const std::string &  dependee_path_) const

Check if a dependee is set with given path.

◆ has_global_scope()

bool datatools::configuration::variant_dependency::has_global_scope ( ) const

Check registry.

◆ has_local_scope()

bool datatools::configuration::variant_dependency::has_local_scope ( ) const

Check registry.

◆ has_registry()

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

Check registry.

◆ has_repository()

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

Check repository.

◆ is_local()

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

Check if the dependency model is local to a registry.

◆ is_locked()

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

Check if dependency is locked.

◆ is_valid()

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

Check validity.

◆ lock()

void datatools::configuration::variant_dependency::lock ( )

Lock the dependency.

◆ operator()()

bool datatools::configuration::variant_dependency::operator() ( ) const

Check if the dependency is fulfilled.

◆ set_depender()

void datatools::configuration::variant_dependency::set_depender ( const variant_object_info depender_)

Set the depender.

◆ set_depender_by_path()

void datatools::configuration::variant_dependency::set_depender_by_path ( const std::string &  depender_name_,
bool  registry_scope_ = false 
)

Set the depender from its identifier.

◆ set_logging()

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

Set the logging priority threshold.

◆ tree_dump()

virtual void datatools::configuration::variant_dependency::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 class was generated from the following file: