DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::conffwk Namespace Reference

Namespaces

namespace  python

Classes

struct  attribute_t
struct  class_t
class  ConfigAction
class  ConfigObject
 Represents database objects. More...
class  ConfigObjectDefault
class  ConfigObjectImpl
 Implements database objects. More...
class  Configuration
 Defines base class for cache of template objects. More...
class  ConfigurationChange
 Describes changes inside a class returned by the notification mechanism. More...
class  ConfigurationImpl
 Provides pure virtual interface used by the Configuration class. More...
class  ConfigurationSubscriptionCriteria
 Describes a subscription criteria. More...
struct  DalFactoryFunctions
class  DalObject
 The base class for any generated DAL object. More...
class  DalRegistry
 DalRegistry: A registry of DalObjects It provides a single interface to create, cache and manage DalObjecs. More...
class  fmap
class  map
class  multimap
class  pmap
struct  relationship_t
struct  string_ptr_compare
struct  string_ptr_hash
class  Version
 Represents configuration version. More...

Typedefs

typedef DalObject *(*) dal_object_creator(Configuration &db, ConfigObject &obj, const std::string &uid)
 The factory function creates DAL object of given template class.
typedef void(*) notify2(Configuration &conf, const ConfigurationChange *changed_class)
 The notification callback function which is invoked by database implementation in case of changes.
typedef void(*) unread_object(CacheBase *x)
 The function to update states of objects in cache.
typedef void(*) rename_object_f(CacheBase *x, const std::string &old_id, const std::string &new_id)
 The function to rename object in cache.
typedef std::unordered_set< std::string > set
typedef std::unordered_set< const std::string *, string_ptr_hash > fset

Enumerations

enum  ObjectState { Valid , Deleted , Unknown }
enum  PrintNumBase { dec , hex , oct }
enum  type_t {
  bool_type , s8_type , u8_type , s16_type ,
  u16_type , s32_type , u32_type , s64_type ,
  u64_type , float_type , double_type , date_type ,
  time_type , string_type , enum_type , class_type
}
enum  int_format_t { oct_int_format , dec_int_format , hex_int_format , na_int_format }
enum  cardinality_t { zero_or_one , zero_or_many , only_one , one_or_many }

Functions

std::ostream & operator<< (std::ostream &, const ConfigurationChange &)
std::ostream & operator<< (std::ostream &, const std::vector< ConfigurationChange * > &)
std::ostream & operator<< (std::ostream &, const ConfigObject *)
std::ostream & operator<< (std::ostream &, const ConfigObject &)
std::ostream & operator<< (std::ostream &s, const Configuration &c)
std::ostream & operator<< (std::ostream &, const Version &)
std::ostream & operator<< (std::ostream &s, const DalObject *obj)
template<class T>
void p_val (std::ostream &s, const T &data)
template<>
void p_val< uint8_t > (std::ostream &s, const uint8_t &data)
template<>
void p_val< int8_t > (std::ostream &s, const int8_t &data)
template<PrintNumBase NUM_BASE = dec>
void p_base_start (std::ostream &s) noexcept
template<PrintNumBase NUM_BASE>
void p_base_end (std::ostream &s) noexcept
template<PrintNumBase NUM_BASE = dec, class T>
void p_sv_attr (std::ostream &s, const std::string &str, const std::string &name, const T &val) noexcept
 print single-value attribute
template<PrintNumBase NUM_BASE = dec, class T>
void p_mv_attr (std::ostream &s, const std::string &str, const std::string &name, const T &val) noexcept
 print multi-value attribute
void p_sv_rel (std::ostream &s, const std::string &str, const std::string &name, const DalObject *obj)
 print weak single-value relationship
template<class T>
void p_sv_rel (std::ostream &s, const std::string &str, unsigned int indent, const std::string &name, const T *obj) noexcept
 print composite single-value relationship
template<class T>
void p_mv_rel (std::ostream &s, const std::string &str, const std::string &name, const T &objs) noexcept
 print weak multi-value relationship
template<class T>
void p_mv_rel (std::ostream &s, const std::string &str, unsigned int indent, const std::string &name, const T &objs) noexcept
 print composite multi-value relationship
const char * bool2str (bool value)
std::ostream & operator<< (std::ostream &out, const attribute_t &)
std::ostream & operator<< (std::ostream &out, const relationship_t &)
std::ostream & operator<< (std::ostream &out, const class_t &)
std::ostream & operator<< (std::ostream &, const ConfigurationSubscriptionCriteria &)
static void print_sep (const char sep, std::ostream &s)
template<class T>
void print_val (const T &val, std::ostream &s)
template<>
void print_val< uint8_t > (const uint8_t &val, std::ostream &s)
template<>
void print_val< int8_t > (const int8_t &val, std::ostream &s)
template<class T>
void print_value (const ConfigObject &const_obj, const std::string &name, const bool ismv, const char sep, std::ostream &s)
bool is_null_obj (const ConfigObject *o)

Typedef Documentation

◆ dal_object_creator

typedef DalObject *(*) dunedaq::conffwk::dal_object_creator(Configuration &db, ConfigObject &obj, const std::string &uid)

The factory function creates DAL object of given template class.

It is used by the referenced_by() method returning DAL object.

Parameters
dbreference on configuration
objconffwk object
uiduid for generated objects
Returns
the DAL object

Definition at line 36 of file DalFactoryFunctions.hpp.

◆ fset

typedef std::unordered_set<const std::string*, string_ptr_hash> dunedaq::conffwk::fset

Definition at line 19 of file set.hpp.

◆ notify2

typedef void(*) dunedaq::conffwk::notify2(Configuration &conf, const ConfigurationChange *changed_class)

The notification callback function which is invoked by database implementation in case of changes.

Warning
To be used by automatically generated libraries and should not be directly used by developers.
Parameters
confreference on configuration
changed_classpointer to changed class

Definition at line 48 of file DalFactoryFunctions.hpp.

◆ rename_object_f

typedef void(*) dunedaq::conffwk::rename_object_f(CacheBase *x, const std::string &old_id, const std::string &new_id)

The function to rename object in cache.

Warning
To be used by automatically generated libraries and should not be directly used by developers.
Parameters
xreference on configuration cache for class of object
old_idold object id
new_idnew object id

Definition at line 71 of file DalFactoryFunctions.hpp.

◆ set

typedef std::unordered_set<std::string> dunedaq::conffwk::set

Definition at line 16 of file set.hpp.

◆ unread_object

typedef void(*) dunedaq::conffwk::unread_object(CacheBase *x)

The function to update states of objects in cache.

Warning
To be used by automatically generated libraries and should not be directly used by developers.
Parameters
confreference on configuration
re_initialise_objreinitialize object (after abort operation)

Definition at line 59 of file DalFactoryFunctions.hpp.

Enumeration Type Documentation

◆ cardinality_t

The relationship cardinality.

Enumerator
zero_or_one 

relationship references zero or one object

zero_or_many 

relationship references zero or many objects

only_one 

relationship always references one object

one_or_many 

relationship references one or many objects

Definition at line 106 of file Schema.hpp.

◆ int_format_t

The numeration format to be used for integer value representation.

Enumerator
oct_int_format 

use octal numeration for attribute value

dec_int_format 

use decimal numeration for attribute value

hex_int_format 

use hexadecimal numeration for attribute value

na_int_format 

not applicable, the attribute type is not integer

Definition at line 49 of file Schema.hpp.

◆ ObjectState

Possible states of configuration objects.

Enumerator
Valid 

the object is valid

Deleted 

the object was deleted and may not be accessed

Unknown 

the state of object i unknown (e.g. after abort)

Definition at line 36 of file ConfigObjectImpl.hpp.

◆ PrintNumBase

Enumerator
dec 
hex 
oct 

Definition at line 21 of file DalObjectPrint.hpp.

◆ type_t

The supported attribute types.

Enumerator
bool_type 

the boolean type

s8_type 

the 8-bits signed integer type

u8_type 

the 8-bits unsigned integer type

s16_type 

the 16-bits signed integer type

u16_type 

the 16-bits unsigned integer type

s32_type 

the 32-bits signed integer type

u32_type 

the 32-bits unsigned integer type

s64_type 

the 64-bits signed integer type

u64_type 

the 64-bits unsigned integer type

float_type 

the float type

double_type 

the double type

date_type 

the date type

time_type 

the time type

string_type 

the string type

enum_type 

the enumeration type

class_type 

the class reference type

Definition at line 27 of file Schema.hpp.

Function Documentation

◆ bool2str()

const char * dunedaq::conffwk::bool2str ( bool value)

Definition at line 18 of file ConfigurationImpl.cpp.

19{
20 return (value ? "yes" : "no");
21}

◆ is_null_obj()

bool dunedaq::conffwk::is_null_obj ( const ConfigObject * o)
inline

Definition at line 182 of file ConfigObject.cpp.

183{
184 return (o == nullptr || o->is_null());
185}
bool is_null() const noexcept
Check if object's implementation points to null.

◆ operator<<() [1/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & s,
const ConfigObject & obj )

Operator to print reference on conffwk object in 'obj-id@class-name' format

Definition at line 107 of file ConfigObject.cpp.

109{
110 obj.print_ptr(s);
111 return s;
112}
msgpack::object obj

◆ operator<<() [2/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & s,
const ConfigObject * obj )

Operator to print pointer on conffwk object in 'obj-id@class-name' format

Definition at line 100 of file ConfigObject.cpp.

102{
103 obj->print_ptr(s);
104 return s;
105}

◆ operator<<() [3/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & ,
const ConfigurationChange &  )

Operator prints out to stream details of configuration change.

◆ operator<<() [4/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & s,
const ConfigurationSubscriptionCriteria & criteria )

Operator to print details of subscription criteria object

Definition at line 56 of file SubscriptionCriteria.cpp.

58{
59 s << "Subscription criteria:\n";
60
61 // print out classes subscription
62 s << " classes subscription: ";
63
64 if (criteria.get_classes_subscription().empty()) {
65 s << "(null)\n";
66 } else {
67 s << std::endl;
68 for (const auto& i : criteria.get_classes_subscription()) {
69 s << " \"" << i << "\"\n";
70 }
71 }
72
73 // print out objects subscription
74 s << " objects subscription: ";
75
76 if (criteria.get_objects_subscription().empty()) {
77 s << "(null)\n";
78 } else {
79 s << std::endl;
80 for (const auto& i : criteria.get_objects_subscription()) {
81 s << " objects of class \"" << i.first << "\":\n";
82 for (const auto& j : i.second) {
83 s << " \"" << j << "\":\n";
84 }
85 }
86 }
87
88 return s;
89}
const std::set< std::string > & get_classes_subscription() const

◆ operator<<() [5/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & ,
const std::vector< ConfigurationChange * > &  )

Operator prints out to stream details of all configuration changes.

◆ operator<<() [6/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & ,
const Version &  )

◆ operator<<() [7/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & out,
const attribute_t & a )

Definition at line 157 of file ConfigurationImpl.cpp.

159{
160 a.print(out);
161 return out;
162}
FELIX Initialization std::string initerror FELIX queue timed out
void print(std::ostream &out, const std::string &prefix="") const

◆ operator<<() [8/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & out,
const class_t & c )

Definition at line 278 of file ConfigurationImpl.cpp.

280{
281 c.print(out);
282 return out;
283}

◆ operator<<() [9/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & out,
const relationship_t & r )

Definition at line 209 of file ConfigurationImpl.cpp.

211{
212 r.print(out);
213 return out;
214}

◆ operator<<() [10/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & s,
const Configuration & c )

Operator prints out to stream configuration using method print().

◆ operator<<() [11/11]

std::ostream & dunedaq::conffwk::operator<< ( std::ostream & s,
const DalObject * obj )

Operator to print any template's object pointer in 'obj-id@class-name' format

Definition at line 89 of file DalObject.cpp.

91{
92 if (obj == nullptr)
94 else if (obj->is_deleted())
95 s << "(deleted object " << obj->UID() << '@' << obj->class_name() << ')';
96 else
97 s << '\'' << obj->UID() << '@' << obj->class_name() << '\'';
98
99 return s;
100}
static void p_null(std::ostream &s)
print "(null)"
Definition DalObject.cpp:44

◆ p_base_end()

template<PrintNumBase NUM_BASE>
void dunedaq::conffwk::p_base_end ( std::ostream & s)
noexcept

Definition at line 62 of file DalObjectPrint.hpp.

63{
64 if constexpr (NUM_BASE != dec)
65 s.setf(std::ios::dec, std::ios::basefield);
66}

◆ p_base_start()

template<PrintNumBase NUM_BASE = dec>
void dunedaq::conffwk::p_base_start ( std::ostream & s)
noexcept

Definition at line 49 of file DalObjectPrint.hpp.

50{
51 if constexpr (NUM_BASE == hex)
52 s.setf(std::ios::hex, std::ios::basefield);
53 else if constexpr (NUM_BASE == oct)
54 s.setf(std::ios::oct, std::ios::basefield);
55
56 if constexpr (NUM_BASE != dec)
57 s.setf(std::ios::showbase);
58}

◆ p_mv_attr()

template<PrintNumBase NUM_BASE = dec, class T>
void dunedaq::conffwk::p_mv_attr ( std::ostream & s,
const std::string & str,
const std::string & name,
const T & val )
noexcept

print multi-value attribute

Definition at line 83 of file DalObjectPrint.hpp.

84{
85 if (!val.empty()) {
86 s << str << val.size() << " value(s) in " << name << ": ";
88 for (const auto& x : val) {
89 if (x != *val.begin())
90 s << ", ";
91 p_val(s, x);
92 }
94 s << '\n';
95 } else {
96 s << str << name << " value is empty\n";
97 }
98}
void p_base_start(std::ostream &s) noexcept
void p_val(std::ostream &s, const T &data)
void p_base_end(std::ostream &s) noexcept

◆ p_mv_rel() [1/2]

template<class T>
void dunedaq::conffwk::p_mv_rel ( std::ostream & s,
const std::string & str,
const std::string & name,
const T & objs )
noexcept

print weak multi-value relationship

Definition at line 120 of file DalObjectPrint.hpp.

121{
122 if (auto len = objs.size())
123 s << str << len << " object(s) in " << name << ": ";
124 else
125 s << str << name << " value is empty";
126
127 for (const auto& x : objs) {
128 if (x != *objs.begin())
129 s << ", ";
130 s << x;
131 }
132
133 s << '\n';
134}

◆ p_mv_rel() [2/2]

template<class T>
void dunedaq::conffwk::p_mv_rel ( std::ostream & s,
const std::string & str,
unsigned int indent,
const std::string & name,
const T & objs )
noexcept

print composite multi-value relationship

Definition at line 139 of file DalObjectPrint.hpp.

140{
141 if (auto len = objs.size())
142 s << str << len << " object(s) in " << name << ":\n";
143 else
144 s << str << name << " value is empty\n";
145
146 for (const auto& x : objs)
147 x->print(indent + 4, true, s);
148}

◆ p_sv_attr()

template<PrintNumBase NUM_BASE = dec, class T>
void dunedaq::conffwk::p_sv_attr ( std::ostream & s,
const std::string & str,
const std::string & name,
const T & val )
noexcept

print single-value attribute

Definition at line 71 of file DalObjectPrint.hpp.

72{
73 s << str << name << ": ";
75 p_val(s, val);
77 s << '\n';
78}

◆ p_sv_rel() [1/2]

void dunedaq::conffwk::p_sv_rel ( std::ostream & s,
const std::string & str,
const std::string & name,
const DalObject * obj )

print weak single-value relationship

Definition at line 103 of file DalObject.cpp.

104{
105 s << str << name << ": " << obj << '\n';
106}

◆ p_sv_rel() [2/2]

template<class T>
void dunedaq::conffwk::p_sv_rel ( std::ostream & s,
const std::string & str,
unsigned int indent,
const std::string & name,
const T * obj )
noexcept

print composite single-value relationship

Definition at line 107 of file DalObjectPrint.hpp.

108{
109 s << str << name << ":\n";
110
111 if (obj)
112 obj->print(indent + 4, true, s);
113 else
114 s << str << " (null)\n";
115}

◆ p_val()

template<class T>
void dunedaq::conffwk::p_val ( std::ostream & s,
const T & data )

Definition at line 30 of file DalObjectPrint.hpp.

31{
32 s << data;
33}

◆ p_val< int8_t >()

template<>
void dunedaq::conffwk::p_val< int8_t > ( std::ostream & s,
const int8_t & data )
inline

Definition at line 42 of file DalObjectPrint.hpp.

43{
44 s << static_cast<int16_t>(data);
45}

◆ p_val< uint8_t >()

template<>
void dunedaq::conffwk::p_val< uint8_t > ( std::ostream & s,
const uint8_t & data )
inline

Definition at line 36 of file DalObjectPrint.hpp.

37{
38 s << static_cast<uint16_t>(data);
39}

◆ print_sep()

void dunedaq::conffwk::print_sep ( const char sep,
std::ostream & s )
inlinestatic

Definition at line 115 of file ConfigObject.cpp.

116{
117 if (sep)
118 s << sep;
119}

◆ print_val()

template<class T>
void dunedaq::conffwk::print_val ( const T & val,
std::ostream & s )

Definition at line 123 of file ConfigObject.cpp.

124{
125 s << val;
126}

◆ print_val< int8_t >()

template<>
void dunedaq::conffwk::print_val< int8_t > ( const int8_t & val,
std::ostream & s )

Definition at line 136 of file ConfigObject.cpp.

138{
139 s << static_cast<int16_t>(val);
140}

◆ print_val< uint8_t >()

template<>
void dunedaq::conffwk::print_val< uint8_t > ( const uint8_t & val,
std::ostream & s )

Definition at line 129 of file ConfigObject.cpp.

131{
132 s << static_cast<uint16_t>(val);
133}

◆ print_value()

template<class T>
void dunedaq::conffwk::print_value ( const ConfigObject & const_obj,
const std::string & name,
const bool ismv,
const char sep,
std::ostream & s )

Definition at line 144 of file ConfigObject.cpp.

145{
146 ConfigObject& obj = const_cast<ConfigObject&>(const_obj);
147
148 try {
149 if (ismv) {
150 std::vector<T> value;
151
152 obj.get(name, value);
153
154 print_sep('(', s);
155
156 for (unsigned int i = 0; i < value.size(); ++i) {
157 if (i != 0)
158 s << ", ";
159
160 print_sep(sep, s);
161 print_val<T>(value[i], s);
162 print_sep(sep, s);
163 }
164
165 print_sep(')', s);
166 } else {
167 T value;
168
169 obj.get(name, value);
170
171 print_sep(sep, s);
172 print_val<T>(value, s);
173 print_sep(sep, s);
174 }
175 } catch (ers::Issue& ex) {
176 s << "[bad_object] (could not get value of \'" << name << "\' of object \'" << &obj << "\': " << ex << ')';
177 }
178}
Represents database objects.
void print_val(const T &val, std::ostream &s)
static void print_sep(const char sep, std::ostream &s)