DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::confmodel::ExcludableEntityTree Class Referenceabstract

#include <ExcludableEntityTree.hpp>

Inheritance diagram for dunedaq::confmodel::ExcludableEntityTree:
[legend]
Collaboration diagram for dunedaq::confmodel::ExcludableEntityTree:
[legend]

Public Member Functions

virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the ExcludableEntityTree object.
virtual std::vector< const dunedaq::conffwk::DalObject * > get (const std::string &name, bool upcast_unregistered=true) const
 Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.
const std::vector< const dunedaq::confmodel::ExcludableEntity * > & get_excluded () const
 Get "excluded" relationship value. ExcludableEntitys that should not participate in the current run.
void set_excluded (const std::vector< const dunedaq::confmodel::ExcludableEntity * > &value)
 Set "excluded" relationship value. ExcludableEntitys that should not participate in the current run.
const dunedaq::confmodel::ExcludedEntities & excluded_entities () const
virtual const ExcludableEntitySet * root_entity () const =0
void exclude (const ExcludableEntity *)
void include (const ExcludableEntity *)
virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the ExcludableEntityTree object.
virtual std::vector< const dunedaq::conffwk::DalObject * > get (const std::string &name, bool upcast_unregistered=true) const
 Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.
const std::vector< const dunedaq::confmodel::ExcludableEntity * > & get_excluded () const
 Get "excluded" relationship value. ExcludableEntitys that should not participate in the current run.
void set_excluded (const std::vector< const dunedaq::confmodel::ExcludableEntity * > &value)
 Set "excluded" relationship value. ExcludableEntitys that should not participate in the current run.
const dunedaq::confmodel::ExcludedEntities & excluded_entities () const
virtual const ExcludableEntitySet * root_entity () const =0
void exclude (const ExcludableEntity *)
void include (const ExcludableEntity *)
Public Member Functions inherited from dunedaq::conffwk::DalObject
const std::string & UID () const noexcept
const std::string & class_name () const noexcept
bool castable (const std::string &target) const noexcept
bool castable (const std::string *target) const noexcept
template<class TARGET>
const TARGET * cast () const noexcept
 Casts object to different class.
std::string full_name () const noexcept
const ConfigObject & config_object () const
DalRegistry & registry () const noexcept
Configuration & configuration () const noexcept
void unread ()
void set (const ConfigObject &o) noexcept
void move (const std::string &at)
void rename (const std::string &new_id)
void p_hdr (std::ostream &s, unsigned int indent, const std::string &cl, const char *nm=nullptr) const
 print object headers
std::ostream & print_object (std::ostream &s) const
 print object details
void throw_init_ex (dunedaq::conffwk::Exception &ex)
 throw object initialisation exception (i.e.

Static Public Member Functions

static const std::string & __get_excluded_str () noexcept
static const std::string & __get_excluded_str () noexcept
Static Public Member Functions inherited from dunedaq::conffwk::DalObject
static void p_null (std::ostream &s)
 print "(null)"
static void p_rm (std::ostream &s)
 print "(deleted object)"
static void p_error (std::ostream &s, dunedaq::conffwk::Exception &ex)
 print error text
static void throw_get_ex (const std::string &what, const std::string &class_name, const DalObject *obj)
 throw exception in generated get method (i.e.
static bool is_null (const DalObject *ref) noexcept
 check a pointer on DAL object is null

Static Public Attributes

static const std::string & s_class_name
static const std::string s_excluded = "excluded"

Protected Member Functions

 ExcludableEntityTree (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
virtual ~ExcludableEntityTree () noexcept
virtual void init (bool init_children)
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 ExcludableEntityTree (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
virtual ~ExcludableEntityTree () noexcept
virtual void init (bool init_children)
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
Protected Member Functions inherited from dunedaq::conffwk::DalObject
 DalObject (DalRegistry &db, const ConfigObject &o) noexcept
virtual ~DalObject ()
void clear () noexcept
void check () const
bool is_deleted () const
void increment_created () noexcept
void increment_read () noexcept
void check_init () const
 Check and initialize object if necessary.
template<typename T>
void _set_object (const std::string &name, const T *value)
 Helper method for generated set single-value relationship methods.
template<typename T>
void _set_objects (const std::string &name, const std::vector< const T * > &value)
 Helper method for generated set multi-value relationship methods.
bool get_rel_objects (const std::string &name, bool upcast_unregistered, std::vector< const DalObject * > &objs) const
 Read relationship values as DAL objects using DAL factory.
bool get_algo_objects (const std::string &name, std::vector< const DalObject * > &objs) const
 Run algorithm and return result as DAL objects using DAL factory.

Private Attributes

std::vector< const dunedaq::confmodel::ExcludableEntity * > m_excluded
ExcludedEntities m_excluded_entities

Friends

class conffwk::Configuration
class conffwk::DalObject
class conffwk::DalFactory
class conffwk::DalRegistry

Additional Inherited Members

Protected Attributes inherited from dunedaq::conffwk::DalObject
std::mutex m_mutex
 Used to protect changes of DAL object.
bool p_was_read
 is true, if the object was read
DalRegistry & p_registry
 Configuration object.
ConfigObject p_obj
 Config object used by given template object.
std::string p_UID
 Is used for template objects (see dqm_conffwk).

Detailed Description

Definition at line 35 of file ExcludableEntityTree.hpp.

Constructor & Destructor Documentation

◆ ExcludableEntityTree() [1/2]

dunedaq::confmodel::ExcludableEntityTree::ExcludableEntityTree ( conffwk::DalRegistry & db,
const conffwk::ConfigObject & obj )
protectednoexcept

Definition at line 20 of file ExcludableEntityTree.cpp.

20 :
21 dunedaq::conffwk::DalObject(db, o)
22 {
23 ;
24 }

◆ ~ExcludableEntityTree() [1/2]

dunedaq::confmodel::ExcludableEntityTree::~ExcludableEntityTree ( )
protectedvirtualnoexcept

Definition at line 62 of file ExcludableEntityTree.cpp.

63 {
64 }

◆ ExcludableEntityTree() [2/2]

dunedaq::confmodel::ExcludableEntityTree::ExcludableEntityTree ( conffwk::DalRegistry & db,
const conffwk::ConfigObject & obj )
protectednoexcept

◆ ~ExcludableEntityTree() [2/2]

virtual dunedaq::confmodel::ExcludableEntityTree::~ExcludableEntityTree ( )
protectedvirtualnoexcept

Member Function Documentation

◆ __get_excluded_str() [1/2]

const std::string & dunedaq::confmodel::ExcludableEntityTree::__get_excluded_str ( )
inlinestaticnoexcept

Definition at line 98 of file ExcludableEntityTree.hpp.

98{ return s_excluded; }

◆ __get_excluded_str() [2/2]

const std::string & dunedaq::confmodel::ExcludableEntityTree::__get_excluded_str ( )
inlinestaticnoexcept

Definition at line 98 of file ExcludableEntityTree.hpp.

98{ return s_excluded; }

◆ exclude() [1/2]

void dunedaq::confmodel::ExcludableEntityTree::exclude ( const ExcludableEntity * res)

Add a component to the excluded relationship and recalculate the exclusion tree

Definition at line 368 of file dalMethods.cpp.

369{
370 auto excluded_vec = get_excluded();
371 for (auto excluded_resource : excluded_vec) {
372 if (excluded_resource == res) {
373 return;
374 }
375 }
376 excluded_vec.push_back(res);
377
378 set_excluded(excluded_vec);
380
381 m_excluded_entities.update(root_entity(), excluded_vec);
382}
void update(const std::vector< std::string > &modified, const std::vector< std::string > &removed, const std::vector< std::string > &created) noexcept
Update cache of objects in case of modification.
Configuration & configuration() const noexcept
const std::string & UID() const noexcept
virtual const ExcludableEntitySet * root_entity() const =0
const std::vector< const dunedaq::confmodel::ExcludableEntity * > & get_excluded() const
Get "excluded" relationship value. ExcludableEntitys that should not participate in the current run.
void set_excluded(const std::vector< const dunedaq::confmodel::ExcludableEntity * > &value)
Set "excluded" relationship value. ExcludableEntitys that should not participate in the current run.
ExcludableEntityTree(conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
void update(const ExcludableEntitySet *root, std::vector< const ExcludableEntity * > initial_list)

◆ exclude() [2/2]

void dunedaq::confmodel::ExcludableEntityTree::exclude ( const ExcludableEntity * )

Add a component to the excluded relationship and recalculate the exclusion tree

◆ excluded_entities() [1/2]

const dunedaq::confmodel::ExcludedEntities & dunedaq::confmodel::ExcludableEntityTree::excluded_entities ( ) const

Get a reference to the ExcludedEntities object of this ExcludableEntityTree, initialising it if it has not already been initialised.

Definition at line 106 of file ExcludableEntityTree.cpp.

◆ excluded_entities() [2/2]

const dunedaq::confmodel::ExcludedEntities & dunedaq::confmodel::ExcludableEntityTree::excluded_entities ( ) const

Get a reference to the ExcludedEntities object of this ExcludableEntityTree, initialising it if it has not already been initialised.

◆ get() [1/4]

std::vector< const dunedaq::conffwk::DalObject * > dunedaq::confmodel::ExcludableEntityTree::get ( const std::string & name,
bool upcast_unregistered = true ) const
virtual

Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.

Parameters are:

Parameters
namename of the relationship or algorithm
Returns
value of relationship or result of algorithm
Exceptions
std::exceptionif there is no relationship or algorithm with such name in this and base classes

Implements dunedaq::conffwk::DalObject.

Reimplemented in dunedaq::confmodel::Session, and dunedaq::confmodel::Session.

Definition at line 66 of file ExcludableEntityTree.cpp.

67 {
68 std::vector<const dunedaq::conffwk::DalObject *> vec;
69
70 if (!get(name, vec, upcast_unregistered, true))
71 throw_get_ex(name, s_class_name, this);
72
73 return vec;
74 }
static void throw_get_ex(const std::string &what, const std::string &class_name, const DalObject *obj)
throw exception in generated get method (i.e.
Definition DalObject.cpp:81
virtual std::vector< const dunedaq::conffwk::DalObject * > get(const std::string &name, bool upcast_unregistered=true) const
Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject...

◆ get() [2/4]

virtual std::vector< const dunedaq::conffwk::DalObject * > dunedaq::confmodel::ExcludableEntityTree::get ( const std::string & name,
bool upcast_unregistered = true ) const
virtual

Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject pointers.

Parameters are:

Parameters
namename of the relationship or algorithm
Returns
value of relationship or result of algorithm
Exceptions
std::exceptionif there is no relationship or algorithm with such name in this and base classes

Implements dunedaq::conffwk::DalObject.

Reimplemented in dunedaq::confmodel::Session, and dunedaq::confmodel::Session.

◆ get() [3/4]

bool dunedaq::confmodel::ExcludableEntityTree::get ( const std::string & name,
std::vector< const dunedaq::conffwk::DalObject * > & vec,
bool upcast_unregistered,
bool first_call ) const
protected

Definition at line 76 of file ExcludableEntityTree.cpp.

77 {
78 if (first_call)
79 {
80 std::lock_guard scoped_lock(m_mutex);
81
82 check();
83 check_init();
84
85 if (get_rel_objects(name, upcast_unregistered, vec))
86 return true;
87 }
88
89 if (first_call)
90 return get_algo_objects(name, vec);
91
92 return false;
93 }
bool get_rel_objects(const std::string &name, bool upcast_unregistered, std::vector< const DalObject * > &objs) const
Read relationship values as DAL objects using DAL factory.
Definition DalObject.cpp:7
std::mutex m_mutex
Used to protect changes of DAL object.
bool get_algo_objects(const std::string &name, std::vector< const DalObject * > &objs) const
Run algorithm and return result as DAL objects using DAL factory.
Definition DalObject.cpp:22
void check_init() const
Check and initialize object if necessary.

◆ get() [4/4]

bool dunedaq::confmodel::ExcludableEntityTree::get ( const std::string & name,
std::vector< const dunedaq::conffwk::DalObject * > & vec,
bool upcast_unregistered,
bool first_call ) const
protected

◆ get_excluded() [1/2]

const std::vector< const dunedaq::confmodel::ExcludableEntity * > & dunedaq::confmodel::ExcludableEntityTree::get_excluded ( ) const
inline

Get "excluded" relationship value. ExcludableEntitys that should not participate in the current run.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 109 of file ExcludableEntityTree.hpp.

110 {
111 std::lock_guard scoped_lock(m_mutex);
112 check();
113 check_init();
114 return m_excluded;
115 }
std::vector< const dunedaq::confmodel::ExcludableEntity * > m_excluded

◆ get_excluded() [2/2]

const std::vector< const dunedaq::confmodel::ExcludableEntity * > & dunedaq::confmodel::ExcludableEntityTree::get_excluded ( ) const
inline

Get "excluded" relationship value. ExcludableEntitys that should not participate in the current run.

Returns
the relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 109 of file ExcludableEntityTree.hpp.

110 {
111 std::lock_guard scoped_lock(m_mutex);
112 check();
113 check_init();
114 return m_excluded;
115 }

◆ include() [1/2]

void dunedaq::confmodel::ExcludableEntityTree::include ( const ExcludableEntity * res)

Definition at line 384 of file dalMethods.cpp.

385{
386 auto excluded_vec = get_excluded();
387 auto count = std::erase(excluded_vec, res);
388 if (count == 0) {
389 return;
390 }
391 set_excluded(excluded_vec);
393
394 m_excluded_entities.update(root_entity(), excluded_vec);
395}

◆ include() [2/2]

void dunedaq::confmodel::ExcludableEntityTree::include ( const ExcludableEntity * )

◆ init() [1/2]

void dunedaq::confmodel::ExcludableEntityTree::init ( bool init_children)
protectedvirtual

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Implements dunedaq::conffwk::DalObject.

Reimplemented in dunedaq::confmodel::Session, and dunedaq::confmodel::Session.

Definition at line 48 of file ExcludableEntityTree.cpp.

49 {
50 p_was_read = true;
52 TLOG_DEBUG(5) << "read object " << this << " (class " << s_class_name << ')';
53
54 try {
55 p_registry._ref<dunedaq::confmodel::ExcludableEntity>(p_obj, s_excluded, m_excluded, init_children);
56 }
57 catch (dunedaq::conffwk::Exception & ex) {
58 throw_init_ex(ex);
59 }
60 }
void throw_init_ex(dunedaq::conffwk::Exception &ex)
throw object initialisation exception (i.e.
Definition DalObject.cpp:72
void increment_read() noexcept
DalRegistry & p_registry
Configuration object.
bool p_was_read
is true, if the object was read
ConfigObject p_obj
Config object used by given template object.
const T * _ref(ConfigObject &obj, const std::string &name, bool read_children)
Get signle value of object's relation and instantiate result with it (multi-thread safe).
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:116

◆ init() [2/2]

virtual void dunedaq::confmodel::ExcludableEntityTree::init ( bool init_children)
protectedvirtual

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Implements dunedaq::conffwk::DalObject.

Reimplemented in dunedaq::confmodel::Session, and dunedaq::confmodel::Session.

◆ print() [1/2]

void dunedaq::confmodel::ExcludableEntityTree::print ( unsigned int offset,
bool print_header,
std::ostream & s ) const
virtual

Print details of the ExcludableEntityTree object.

Parameters are:

Parameters
offsetnumber of spaces to shift object right (useful to print nested objects)
print_headerif false, do not print object header (to print attributes of base classes)
soutput stream

Implements dunedaq::conffwk::DalObject.

Reimplemented in dunedaq::confmodel::Session, and dunedaq::confmodel::Session.

Definition at line 27 of file ExcludableEntityTree.cpp.

28 {
29 check_init();
30
31 try {
32 const std::string str(indent+2, ' ');
33
34 if (print_header)
35 p_hdr(s, indent, s_class_name, "dunedaq::confmodel");
36
37
38 // print direct relationships
39
41 }
42 catch (dunedaq::conffwk::Exception & ex) {
44 }
45 }
void p_hdr(std::ostream &s, unsigned int indent, const std::string &cl, const char *nm=nullptr) const
print object headers
Definition DalObject.cpp:62
static void p_error(std::ostream &s, dunedaq::conffwk::Exception &ex)
print error text
Definition DalObject.cpp:56
void p_mv_rel(std::ostream &s, const std::string &str, const std::string &name, const T &objs) noexcept
print weak multi-value relationship

◆ print() [2/2]

virtual void dunedaq::confmodel::ExcludableEntityTree::print ( unsigned int offset,
bool print_header,
std::ostream & s ) const
virtual

Print details of the ExcludableEntityTree object.

Parameters are:

Parameters
offsetnumber of spaces to shift object right (useful to print nested objects)
print_headerif false, do not print object header (to print attributes of base classes)
soutput stream

Implements dunedaq::conffwk::DalObject.

Reimplemented in dunedaq::confmodel::Session, and dunedaq::confmodel::Session.

◆ root_entity() [1/2]

virtual const ExcludableEntitySet * dunedaq::confmodel::ExcludableEntityTree::root_entity ( ) const
pure virtual

Pure virtual method to get the ExcludableEntitySet at the root of the ExcludableEntityTree.

Implemented in dunedaq::confmodel::Session, and dunedaq::confmodel::Session.

◆ root_entity() [2/2]

virtual const ExcludableEntitySet * dunedaq::confmodel::ExcludableEntityTree::root_entity ( ) const
pure virtual

Pure virtual method to get the ExcludableEntitySet at the root of the ExcludableEntityTree.

Implemented in dunedaq::confmodel::Session, and dunedaq::confmodel::Session.

◆ set_excluded() [1/2]

void dunedaq::confmodel::ExcludableEntityTree::set_excluded ( const std::vector< const dunedaq::confmodel::ExcludableEntity * > & value)

Set "excluded" relationship value. ExcludableEntitys that should not participate in the current run.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

Definition at line 95 of file ExcludableEntityTree.cpp.

96 {
98 }
void _set_objects(const std::string &name, const std::vector< const T * > &value)
Helper method for generated set multi-value relationship methods.

◆ set_excluded() [2/2]

void dunedaq::confmodel::ExcludableEntityTree::set_excluded ( const std::vector< const dunedaq::confmodel::ExcludableEntity * > & value)

Set "excluded" relationship value. ExcludableEntitys that should not participate in the current run.

Parameters
valuenew relationship value
Exceptions
dunedaq::conffwk::Generic,dunedaq::conffwk::DeletedObject

◆ conffwk::Configuration

Definition at line 37 of file ExcludableEntityTree.hpp.

◆ conffwk::DalFactory

conffwk::DalFactory
friend

Definition at line 39 of file ExcludableEntityTree.hpp.

◆ conffwk::DalObject

Definition at line 38 of file ExcludableEntityTree.hpp.

◆ conffwk::DalRegistry

Definition at line 40 of file ExcludableEntityTree.hpp.

Member Data Documentation

◆ m_excluded

std::vector< const dunedaq::confmodel::ExcludableEntity * > dunedaq::confmodel::ExcludableEntityTree::m_excluded
private

Definition at line 86 of file ExcludableEntityTree.hpp.

◆ m_excluded_entities

ExcludedEntities dunedaq::confmodel::ExcludableEntityTree::m_excluded_entities
mutableprivate

Definition at line 89 of file ExcludableEntityTree.hpp.

◆ s_class_name

const std::string & dunedaq::confmodel::ExcludableEntityTree::s_class_name
static

The name of the configuration class.

Definition at line 52 of file ExcludableEntityTree.hpp.

◆ s_excluded

const std::string dunedaq::confmodel::ExcludableEntityTree::s_excluded = "excluded"
inlinestatic

Definition at line 96 of file ExcludableEntityTree.hpp.


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