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

#include <JsonableTest.hpp>

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

Public Member Functions

virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the JsonableTest 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.
 
uint32_t get_this () const
 Get "this" attribute value.
 
void set_this (uint32_t value)
 Set "this" attribute value.
 
uint32_t get_that () const
 Get "that" attribute value.
 
void set_that (uint32_t value)
 Set "that" attribute value.
 
const dunedaq::confmodel::JsonableTestget_other () const
 Get "other" relationship value.
 
void set_other (const dunedaq::confmodel::JsonableTest *value)
 Set "other" relationship value.
 
virtual void print (unsigned int offset, bool print_header, std::ostream &s) const
 Print details of the JsonableTest 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.
 
uint32_t get_this () const
 Get "this" attribute value.
 
void set_this (uint32_t value)
 Set "this" attribute value.
 
uint32_t get_that () const
 Get "that" attribute value.
 
void set_that (uint32_t value)
 Set "that" attribute value.
 
const dunedaq::confmodel::JsonableTestget_other () const
 Get "other" relationship value.
 
void set_other (const dunedaq::confmodel::JsonableTest *value)
 Set "other" relationship value.
 
- Public Member Functions inherited from dunedaq::confmodel::Jsonable
nlohmann::json to_json (bool direct=false, bool skip_name=false) const
 
nlohmann::json to_json (bool direct=false, bool skip_name=false) const
 
- 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_this_str () noexcept
 
static const std::string & __get_that_str () noexcept
 
static const std::string & __get_other_str () noexcept
 
static const std::string & __get_this_str () noexcept
 
static const std::string & __get_that_str () noexcept
 
static const std::string & __get_other_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_this = "this"
 
static const std::string s_that = "that"
 
static const std::string s_other = "other"
 
- Static Public Attributes inherited from dunedaq::confmodel::Jsonable
static const std::string & s_class_name
 

Protected Member Functions

 JsonableTest (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~JsonableTest () 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
 
 JsonableTest (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~JsonableTest () 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::confmodel::Jsonable
 Jsonable (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~Jsonable () noexcept
 
bool get (const std::string &name, std::vector< const dunedaq::conffwk::DalObject * > &vec, bool upcast_unregistered, bool first_call) const
 
 Jsonable (conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
 
virtual ~Jsonable () noexcept
 
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

uint32_t m_this
 
uint32_t m_that
 
const dunedaq::confmodel::JsonableTestm_other
 

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

Definition at line 23 of file JsonableTest.hpp.

Constructor & Destructor Documentation

◆ JsonableTest() [1/2]

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

Definition at line 26 of file JsonableTest.cpp.

26 :
28 Jsonable(db, o),
29 m_other (nullptr)
30
31 {
32 ;
33 }
The base class for any generated DAL object.
Definition DalObject.hpp:45
const dunedaq::confmodel::JsonableTest * m_other
Jsonable(conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
Definition Jsonable.cpp:15

◆ ~JsonableTest() [1/2]

dunedaq::confmodel::JsonableTest::~JsonableTest ( )
protectedvirtualnoexcept

Definition at line 84 of file JsonableTest.cpp.

85 {
86 }

◆ JsonableTest() [2/2]

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

◆ ~JsonableTest() [2/2]

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

Member Function Documentation

◆ __get_other_str() [1/2]

static const std::string & dunedaq::confmodel::JsonableTest::__get_other_str ( )
inlinestaticnoexcept

Definition at line 156 of file JsonableTest.hpp.

156{ return s_other; }
static const std::string s_other

◆ __get_other_str() [2/2]

static const std::string & dunedaq::confmodel::JsonableTest::__get_other_str ( )
inlinestaticnoexcept

Definition at line 156 of file JsonableTest.hpp.

156{ return s_other; }

◆ __get_that_str() [1/2]

static const std::string & dunedaq::confmodel::JsonableTest::__get_that_str ( )
inlinestaticnoexcept

Definition at line 87 of file JsonableTest.hpp.

87{ return s_that; }
static const std::string s_that

◆ __get_that_str() [2/2]

static const std::string & dunedaq::confmodel::JsonableTest::__get_that_str ( )
inlinestaticnoexcept

Definition at line 87 of file JsonableTest.hpp.

87{ return s_that; }

◆ __get_this_str() [1/2]

static const std::string & dunedaq::confmodel::JsonableTest::__get_this_str ( )
inlinestaticnoexcept

Definition at line 86 of file JsonableTest.hpp.

86{ return s_this; }
static const std::string s_this

◆ __get_this_str() [2/2]

static const std::string & dunedaq::confmodel::JsonableTest::__get_this_str ( )
inlinestaticnoexcept

Definition at line 86 of file JsonableTest.hpp.

86{ return s_this; }

◆ get() [1/4]

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

Reimplemented from dunedaq::confmodel::Jsonable.

Definition at line 88 of file JsonableTest.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::JsonableTest::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

Reimplemented from dunedaq::confmodel::Jsonable.

◆ get() [3/4]

bool dunedaq::confmodel::JsonableTest::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 JsonableTest.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 (Jsonable::get(name, vec, upcast_unregistered, false)) return true;
112
113 if (first_call)
114 return get_algo_objects(name, vec);
115
116 return false;
117 }
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.
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...
Definition Jsonable.cpp:48

◆ get() [4/4]

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

◆ get_other() [1/2]

const dunedaq::confmodel::JsonableTest * dunedaq::confmodel::JsonableTest::get_other ( ) const
inline

Get "other" relationship value.

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

Definition at line 166 of file JsonableTest.hpp.

167 {
168 std::lock_guard scoped_lock(m_mutex);
169 check();
170 check_init();
171 return m_other;
172 }

◆ get_other() [2/2]

const dunedaq::confmodel::JsonableTest * dunedaq::confmodel::JsonableTest::get_other ( ) const
inline

Get "other" relationship value.

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

Definition at line 166 of file JsonableTest.hpp.

167 {
168 std::lock_guard scoped_lock(m_mutex);
169 check();
170 check_init();
171 return m_other;
172 }

◆ get_that() [1/2]

uint32_t dunedaq::confmodel::JsonableTest::get_that ( ) const
inline

Get "that" attribute value.

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

Definition at line 128 of file JsonableTest.hpp.

129 {
130 std::lock_guard scoped_lock(m_mutex);
131 check();
132 check_init();
133 return m_that;
134 }

◆ get_that() [2/2]

uint32_t dunedaq::confmodel::JsonableTest::get_that ( ) const
inline

Get "that" attribute value.

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

Definition at line 128 of file JsonableTest.hpp.

129 {
130 std::lock_guard scoped_lock(m_mutex);
131 check();
132 check_init();
133 return m_that;
134 }

◆ get_this() [1/2]

uint32_t dunedaq::confmodel::JsonableTest::get_this ( ) const
inline

Get "this" attribute value.

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

Definition at line 97 of file JsonableTest.hpp.

98 {
99 std::lock_guard scoped_lock(m_mutex);
100 check();
101 check_init();
102 return m_this;
103 }

◆ get_this() [2/2]

uint32_t dunedaq::confmodel::JsonableTest::get_this ( ) const
inline

Get "this" attribute value.

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

Definition at line 97 of file JsonableTest.hpp.

98 {
99 std::lock_guard scoped_lock(m_mutex);
100 check();
101 check_init();
102 return m_this;
103 }

◆ init() [1/2]

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

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Reimplemented from dunedaq::confmodel::Jsonable.

Definition at line 68 of file JsonableTest.cpp.

69 {
70 Jsonable::init(init_children);
71
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
DalRegistry & p_registry
Configuration object.
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).
virtual void init(bool init_children)
Definition Jsonable.cpp:37
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112

◆ init() [2/2]

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

Initialize object (method generated by genconffwk)

Parameters
init_childrenif true, initialize referenced objects

Reimplemented from dunedaq::confmodel::Jsonable.

◆ print() [1/2]

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

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

Reimplemented from dunedaq::confmodel::Jsonable.

Definition at line 36 of file JsonableTest.cpp.

37 {
38 check_init();
39
40 try {
41 const std::string str(indent+2, ' ');
42
43 if (print_header)
44 p_hdr(s, indent, s_class_name, "dunedaq::confmodel");
45
46
47 // print direct super-classes
48
50
51
52 // print direct attributes
53
56
57
58 // print direct relationships
59
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
virtual void print(unsigned int offset, bool print_header, std::ostream &s) const
Print details of the Jsonable object.
Definition Jsonable.cpp:22
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_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::JsonableTest::print ( unsigned int offset,
bool print_header,
std::ostream & s ) const
virtual

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

Reimplemented from dunedaq::confmodel::Jsonable.

◆ set_other() [1/2]

void dunedaq::confmodel::JsonableTest::set_other ( const dunedaq::confmodel::JsonableTest * value)

Set "other" relationship value.

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

Definition at line 119 of file JsonableTest.cpp.

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

◆ set_other() [2/2]

void dunedaq::confmodel::JsonableTest::set_other ( const dunedaq::confmodel::JsonableTest * value)

Set "other" relationship value.

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

◆ set_that() [1/2]

void dunedaq::confmodel::JsonableTest::set_that ( uint32_t value)
inline

Set "that" attribute value.

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

Definition at line 143 of file JsonableTest.hpp.

144 {
145 std::lock_guard scoped_lock(m_mutex);
146 check();
147 clear();
148 p_obj.set_by_val(s_that, value);
149 }
void set_by_val(const std::string &name, T value)
Set attribute value.

◆ set_that() [2/2]

void dunedaq::confmodel::JsonableTest::set_that ( uint32_t value)
inline

Set "that" attribute value.

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

Definition at line 143 of file JsonableTest.hpp.

144 {
145 std::lock_guard scoped_lock(m_mutex);
146 check();
147 clear();
148 p_obj.set_by_val(s_that, value);
149 }

◆ set_this() [1/2]

void dunedaq::confmodel::JsonableTest::set_this ( uint32_t value)
inline

Set "this" attribute value.

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

Definition at line 112 of file JsonableTest.hpp.

113 {
114 std::lock_guard scoped_lock(m_mutex);
115 check();
116 clear();
117 p_obj.set_by_val(s_this, value);
118 }

◆ set_this() [2/2]

void dunedaq::confmodel::JsonableTest::set_this ( uint32_t value)
inline

Set "this" attribute value.

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

Definition at line 112 of file JsonableTest.hpp.

113 {
114 std::lock_guard scoped_lock(m_mutex);
115 check();
116 clear();
117 p_obj.set_by_val(s_this, value);
118 }

Friends And Related Symbol Documentation

◆ conffwk::Configuration

Definition at line 25 of file JsonableTest.hpp.

◆ conffwk::DalFactory

conffwk::DalFactory
friend

Definition at line 27 of file JsonableTest.hpp.

◆ conffwk::DalObject

Definition at line 26 of file JsonableTest.hpp.

◆ conffwk::DalRegistry

Definition at line 28 of file JsonableTest.hpp.

Member Data Documentation

◆ m_other

const dunedaq::confmodel::JsonableTest * dunedaq::confmodel::JsonableTest::m_other
private

Definition at line 76 of file JsonableTest.hpp.

◆ m_that

uint32_t dunedaq::confmodel::JsonableTest::m_that
private

Definition at line 75 of file JsonableTest.hpp.

◆ m_this

uint32_t dunedaq::confmodel::JsonableTest::m_this
private

Definition at line 74 of file JsonableTest.hpp.

◆ s_class_name

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

The name of the configuration class.

Definition at line 40 of file JsonableTest.hpp.

◆ s_other

static const std::string dunedaq::confmodel::JsonableTest::s_other = "other"
inlinestatic

Definition at line 154 of file JsonableTest.hpp.

◆ s_that

static const std::string dunedaq::confmodel::JsonableTest::s_that = "that"
inlinestatic

Definition at line 84 of file JsonableTest.hpp.

◆ s_this

static const std::string dunedaq::confmodel::JsonableTest::s_this = "this"
inlinestatic

Definition at line 83 of file JsonableTest.hpp.


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