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

#include <ActionPlan.hpp>

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

Classes

struct  Execution_policy
 

Public Member Functions

virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the ActionPlan 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::string & get_execution_policy () const
 Get "execution_policy" attribute value. How the application should execute steps of the action plan.
 
void set_execution_policy (const std::string &value)
 Set "execution_policy" attribute value. How the application should execute steps of the action plan.
 
const dunedaq::confmodel::FSMCommandget_command () const
 Get "command" relationship value.
 
void set_command (const dunedaq::confmodel::FSMCommand *value)
 Set "command" relationship value.
 
const std::vector< const dunedaq::confmodel::DaqModulesGroup * > & get_steps () const
 Get "steps" relationship value.
 
void set_steps (const std::vector< const dunedaq::confmodel::DaqModulesGroup * > &value)
 Set "steps" relationship value.
 
virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the ActionPlan 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::string & get_execution_policy () const
 Get "execution_policy" attribute value. How the application should execute steps of the action plan.
 
void set_execution_policy (const std::string &value)
 Set "execution_policy" attribute value. How the application should execute steps of the action plan.
 
const dunedaq::confmodel::FSMCommandget_command () const
 Get "command" relationship value.
 
void set_command (const dunedaq::confmodel::FSMCommand *value)
 Set "command" relationship value.
 
const std::vector< const dunedaq::confmodel::DaqModulesGroup * > & get_steps () const
 Get "steps" relationship value.
 
void set_steps (const std::vector< const dunedaq::confmodel::DaqModulesGroup * > &value)
 Set "steps" relationship value.
 
- 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 ConfigObjectconfig_object () const
 
DalRegistryregistry () const noexcept
 
Configurationconfiguration () 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_execution_policy_str () noexcept
 
static const std::string & __get_command_str () noexcept
 
static const std::string & __get_steps_str () noexcept
 
static const std::string & __get_execution_policy_str () noexcept
 
static const std::string & __get_command_str () noexcept
 
static const std::string & __get_steps_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_execution_policy = "execution_policy"
 
static const std::string s_command = "command"
 
static const std::string s_steps = "steps"
 

Protected Member Functions

 ActionPlan (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~ActionPlan () 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
 
 ActionPlan (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~ActionPlan () 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::string m_execution_policy
 
const dunedaq::confmodel::FSMCommandm_command
 
std::vector< const dunedaq::confmodel::DaqModulesGroup * > m_steps
 

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
 
DalRegistryp_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

A set of parallel steps for an application to carry out a command

Definition at line 34 of file ActionPlan.hpp.

Constructor & Destructor Documentation

◆ ActionPlan() [1/2]

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

Definition at line 32 of file ActionPlan.cpp.

32 :
34 m_command (nullptr)
35
36 {
37 ;
38 }
The base class for any generated DAL object.
Definition DalObject.hpp:45
const dunedaq::confmodel::FSMCommand * m_command

◆ ~ActionPlan() [1/2]

dunedaq::confmodel::ActionPlan::~ActionPlan ( )
protectedvirtualnoexcept

Definition at line 84 of file ActionPlan.cpp.

85 {
86 }

◆ ActionPlan() [2/2]

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

◆ ~ActionPlan() [2/2]

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

Member Function Documentation

◆ __get_command_str() [1/2]

static const std::string & dunedaq::confmodel::ActionPlan::__get_command_str ( )
inlinestaticnoexcept

Definition at line 146 of file ActionPlan.hpp.

146{ return s_command; }
static const std::string s_command

◆ __get_command_str() [2/2]

static const std::string & dunedaq::confmodel::ActionPlan::__get_command_str ( )
inlinestaticnoexcept

Definition at line 146 of file ActionPlan.hpp.

146{ return s_command; }

◆ __get_execution_policy_str() [1/2]

static const std::string & dunedaq::confmodel::ActionPlan::__get_execution_policy_str ( )
inlinestaticnoexcept

Definition at line 96 of file ActionPlan.hpp.

96{ return s_execution_policy; }
static const std::string s_execution_policy

◆ __get_execution_policy_str() [2/2]

static const std::string & dunedaq::confmodel::ActionPlan::__get_execution_policy_str ( )
inlinestaticnoexcept

Definition at line 96 of file ActionPlan.hpp.

96{ return s_execution_policy; }

◆ __get_steps_str() [1/2]

static const std::string & dunedaq::confmodel::ActionPlan::__get_steps_str ( )
inlinestaticnoexcept

Definition at line 147 of file ActionPlan.hpp.

147{ return s_steps; }
static const std::string s_steps

◆ __get_steps_str() [2/2]

static const std::string & dunedaq::confmodel::ActionPlan::__get_steps_str ( )
inlinestaticnoexcept

Definition at line 147 of file ActionPlan.hpp.

147{ return s_steps; }

◆ get() [1/4]

std::vector< const dunedaq::conffwk::DalObject * > dunedaq::confmodel::ActionPlan::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.

Definition at line 88 of file ActionPlan.cpp.

89 {
90 std::vector<const dunedaq::conffwk::DalObject *> vec;
91
92 if (!get(name, vec, upcast_unregistered, true))
93 throw_get_ex(name, s_class_name, this);
94
95 return vec;
96 }
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:82
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...
static const std::string & s_class_name

◆ get() [2/4]

virtual std::vector< const dunedaq::conffwk::DalObject * > dunedaq::confmodel::ActionPlan::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.

◆ get() [3/4]

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

Definition at line 98 of file ActionPlan.cpp.

99 {
100 if (first_call)
101 {
102 std::lock_guard scoped_lock(m_mutex);
103
104 check();
105 check_init();
106
107 if (get_rel_objects(name, upcast_unregistered, vec))
108 return true;
109 }
110
111 if (first_call)
112 return get_algo_objects(name, vec);
113
114 return false;
115 }
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:8
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:25
void check_init() const
Check and initialize object if necessary.

◆ get() [4/4]

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

◆ get_command() [1/2]

const dunedaq::confmodel::FSMCommand * dunedaq::confmodel::ActionPlan::get_command ( ) const
inline

Get "command" relationship value.

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

Definition at line 157 of file ActionPlan.hpp.

158 {
159 std::lock_guard scoped_lock(m_mutex);
160 check();
161 check_init();
162 if (!m_command)
163 {
164 std::ostringstream text;
165 text << "relationship \"" << s_command << "\" of object " << this << " is not set";
166 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
167 }
168 return m_command;
169 }
#define ERS_HERE
Generic configuration exception.

◆ get_command() [2/2]

const dunedaq::confmodel::FSMCommand * dunedaq::confmodel::ActionPlan::get_command ( ) const
inline

Get "command" relationship value.

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

Definition at line 157 of file ActionPlan.hpp.

158 {
159 std::lock_guard scoped_lock(m_mutex);
160 check();
161 check_init();
162 if (!m_command)
163 {
164 std::ostringstream text;
165 text << "relationship \"" << s_command << "\" of object " << this << " is not set";
166 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
167 }
168 return m_command;
169 }

◆ get_execution_policy() [1/2]

const std::string & dunedaq::confmodel::ActionPlan::get_execution_policy ( ) const
inline

Get "execution_policy" attribute value. How the application should execute steps of the action plan.

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

Definition at line 116 of file ActionPlan.hpp.

117 {
118 std::lock_guard scoped_lock(m_mutex);
119 check();
120 check_init();
121 return m_execution_policy;
122 }

◆ get_execution_policy() [2/2]

const std::string & dunedaq::confmodel::ActionPlan::get_execution_policy ( ) const
inline

Get "execution_policy" attribute value. How the application should execute steps of the action plan.

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

Definition at line 116 of file ActionPlan.hpp.

117 {
118 std::lock_guard scoped_lock(m_mutex);
119 check();
120 check_init();
121 return m_execution_policy;
122 }

◆ get_steps() [1/2]

const std::vector< const dunedaq::confmodel::DaqModulesGroup * > & dunedaq::confmodel::ActionPlan::get_steps ( ) const
inline

Get "steps" relationship value.

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

Definition at line 188 of file ActionPlan.hpp.

189 {
190 std::lock_guard scoped_lock(m_mutex);
191 check();
192 check_init();
193 return m_steps;
194 }
std::vector< const dunedaq::confmodel::DaqModulesGroup * > m_steps

◆ get_steps() [2/2]

const std::vector< const dunedaq::confmodel::DaqModulesGroup * > & dunedaq::confmodel::ActionPlan::get_steps ( ) const
inline

Get "steps" relationship value.

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

Definition at line 188 of file ActionPlan.hpp.

189 {
190 std::lock_guard scoped_lock(m_mutex);
191 check();
192 check_init();
193 return m_steps;
194 }

◆ init() [1/2]

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

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Implements dunedaq::conffwk::DalObject.

Definition at line 68 of file ActionPlan.cpp.

69 {
70 p_was_read = true;
72 TLOG_DEBUG(5) << "read object " << this << " (class " << s_class_name << ')';
73
74 try {
78 }
79 catch (dunedaq::conffwk::Exception & ex) {
80 throw_init_ex(ex);
81 }
82 }
void get(const std::string &name, T &value)
Get value of object's attribute or relationship.
void throw_init_ex(dunedaq::conffwk::Exception &ex)
throw object initialisation exception (i.e.
Definition DalObject.cpp:74
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:112

◆ init() [2/2]

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

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Implements dunedaq::conffwk::DalObject.

◆ print() [1/2]

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

Print details of the ActionPlan 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.

Definition at line 41 of file ActionPlan.cpp.

42 {
43 check_init();
44
45 try {
46 const std::string str(indent+2, ' ');
47
48 if (print_header)
49 p_hdr(s, indent, s_class_name, "dunedaq::confmodel");
50
51
52 // print direct attributes
53
55
56
57 // print direct relationships
58
61 }
62 catch (dunedaq::conffwk::Exception & ex) {
64 }
65 }
void p_hdr(std::ostream &s, unsigned int indent, const std::string &cl, const char *nm=nullptr) const
print object headers
Definition DalObject.cpp:65
static void p_error(std::ostream &s, dunedaq::conffwk::Exception &ex)
print error text
Definition DalObject.cpp:59
void p_sv_rel(std::ostream &s, const std::string &str, const std::string &name, const DalObject *obj)
print weak single-value relationship
void p_mv_rel(std::ostream &s, const std::string &str, const std::string &name, const T &objs) noexcept
print weak multi-value relationship
void p_sv_attr(std::ostream &s, const std::string &str, const std::string &name, const T &val) noexcept
print single-value attribute

◆ print() [2/2]

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

Print details of the ActionPlan 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.

◆ set_command() [1/2]

void dunedaq::confmodel::ActionPlan::set_command ( const dunedaq::confmodel::FSMCommand * value)

Set "command" relationship value.

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

Definition at line 117 of file ActionPlan.cpp.

118 {
119 _set_object(s_command, value);
120 }
void _set_object(const std::string &name, const T *value)
Helper method for generated set single-value relationship methods.

◆ set_command() [2/2]

void dunedaq::confmodel::ActionPlan::set_command ( const dunedaq::confmodel::FSMCommand * value)

Set "command" relationship value.

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

◆ set_execution_policy() [1/2]

void dunedaq::confmodel::ActionPlan::set_execution_policy ( const std::string & value)
inline

Set "execution_policy" attribute value. How the application should execute steps of the action plan.

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

Definition at line 132 of file ActionPlan.hpp.

133 {
134 std::lock_guard scoped_lock(m_mutex);
135 check();
136 clear();
138 }
void set_enum(const std::string &name, const std::string &value)
Set attribute enumeration value.

◆ set_execution_policy() [2/2]

void dunedaq::confmodel::ActionPlan::set_execution_policy ( const std::string & value)
inline

Set "execution_policy" attribute value. How the application should execute steps of the action plan.

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

Definition at line 132 of file ActionPlan.hpp.

133 {
134 std::lock_guard scoped_lock(m_mutex);
135 check();
136 clear();
138 }

◆ set_steps() [1/2]

void dunedaq::confmodel::ActionPlan::set_steps ( const std::vector< const dunedaq::confmodel::DaqModulesGroup * > & value)

Set "steps" relationship value.

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

Definition at line 122 of file ActionPlan.cpp.

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

◆ set_steps() [2/2]

void dunedaq::confmodel::ActionPlan::set_steps ( const std::vector< const dunedaq::confmodel::DaqModulesGroup * > & value)

Set "steps" relationship value.

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

Friends And Related Symbol Documentation

◆ conffwk::Configuration

Definition at line 36 of file ActionPlan.hpp.

◆ conffwk::DalFactory

conffwk::DalFactory
friend

Definition at line 38 of file ActionPlan.hpp.

◆ conffwk::DalObject

Definition at line 37 of file ActionPlan.hpp.

◆ conffwk::DalRegistry

Definition at line 39 of file ActionPlan.hpp.

Member Data Documentation

◆ m_command

const dunedaq::confmodel::FSMCommand * dunedaq::confmodel::ActionPlan::m_command
private

Definition at line 86 of file ActionPlan.hpp.

◆ m_execution_policy

std::string dunedaq::confmodel::ActionPlan::m_execution_policy
private

Definition at line 85 of file ActionPlan.hpp.

◆ m_steps

std::vector< const dunedaq::confmodel::DaqModulesGroup * > dunedaq::confmodel::ActionPlan::m_steps
private

Definition at line 87 of file ActionPlan.hpp.

◆ s_class_name

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

The name of the configuration class.

Definition at line 51 of file ActionPlan.hpp.

◆ s_command

static const std::string dunedaq::confmodel::ActionPlan::s_command = "command"
inlinestatic

Definition at line 143 of file ActionPlan.hpp.

◆ s_execution_policy

static const std::string dunedaq::confmodel::ActionPlan::s_execution_policy = "execution_policy"
inlinestatic

Definition at line 94 of file ActionPlan.hpp.

◆ s_steps

static const std::string dunedaq::confmodel::ActionPlan::s_steps = "steps"
inlinestatic

Definition at line 144 of file ActionPlan.hpp.


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