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_hashfset
 

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 31 of file DalFactoryFunctions.hpp.

◆ fset

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

Definition at line 13 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 44 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 69 of file DalFactoryFunctions.hpp.

◆ set

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

Definition at line 10 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 56 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 103 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 42 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 29 of file ConfigObjectImpl.hpp.

◆ PrintNumBase

Enumerator
dec 
hex 
oct 

Definition at line 13 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 20 of file Schema.hpp.

Function Documentation

◆ bool2str()

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

Definition at line 10 of file ConfigurationImpl.cpp.

10{ return (value ? "yes" : "no"); }

◆ is_null_obj()

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

Definition at line 188 of file ConfigObject.cpp.

189{
190 return (o == nullptr || o->is_null());
191}
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 106 of file ConfigObject.cpp.

108{
109 obj.print_ptr(s);
110 return s;
111}

◆ 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 99 of file ConfigObject.cpp.

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

◆ 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 51 of file SubscriptionCriteria.cpp.

53{
54 s << "Subscription criteria:\n";
55
56 // print out classes subscription
57 s << " classes subscription: ";
58
59 if (criteria.get_classes_subscription().empty())
60 {
61 s << "(null)\n";
62 }
63 else
64 {
65 s << std::endl;
66 for (const auto& i : criteria.get_classes_subscription())
67 {
68 s << " \"" << i << "\"\n";
69 }
70 }
71
72 // print out objects subscription
73 s << " objects subscription: ";
74
75 if (criteria.get_objects_subscription().empty())
76 {
77 s << "(null)\n";
78 }
79 else
80 {
81 s << std::endl;
82 for (const auto& i : criteria.get_objects_subscription())
83 {
84 s << " objects of class \"" << i.first << "\":\n";
85 for (const auto& j : i.second)
86 {
87 s << " \"" << j << "\":\n";
88 }
89 }
90 }
91
92 return s;
93}
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 101 of file ConfigurationImpl.cpp.

102 {
103 a.print(out);
104 return out;
105 }
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 217 of file ConfigurationImpl.cpp.

218 {
219 c.print(out);
220 return out;
221 }

◆ operator<<() [9/11]

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

Definition at line 145 of file ConfigurationImpl.cpp.

146 {
147 r.print(out);
148 return out;
149 }

◆ 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 90 of file DalObject.cpp.

92{
93 if (obj == nullptr)
94 DalObject::p_null(s);
95 else if (obj->is_deleted())
96 s << "(deleted object " << obj->UID() << '@' << obj->class_name() << ')';
97 else
98 s << '\'' << obj->UID() << '@' << obj->class_name() << '\'';
99
100 return s;
101}

◆ p_base_end()

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

Definition at line 52 of file DalObjectPrint.hpp.

53 {
54 if constexpr (NUM_BASE != dec)
55 s.setf(std::ios::dec, std::ios::basefield);
56 }

◆ p_base_start()

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

Definition at line 39 of file DalObjectPrint.hpp.

40 {
41 if constexpr (NUM_BASE == hex)
42 s.setf(std::ios::hex, std::ios::basefield);
43 else if constexpr (NUM_BASE == oct)
44 s.setf(std::ios::oct, std::ios::basefield);
45
46 if constexpr (NUM_BASE != dec)
47 s.setf(std::ios::showbase);
48 }

◆ 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 73 of file DalObjectPrint.hpp.

74 {
75 if (!val.empty())
76 {
77 s << str << val.size() << " value(s) in " << name << ": ";
78 p_base_start<NUM_BASE>(s);
79 for (const auto &x : val)
80 {
81 if (x != *val.begin())
82 s << ", ";
83 p_val(s, x);
84 }
85 p_base_end<NUM_BASE>(s);
86 s << '\n';
87 }
88 else
89 {
90 s << str << name << " value is empty\n";
91 }
92 }
void p_val(std::ostream &s, const T &data)

◆ 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 114 of file DalObjectPrint.hpp.

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

◆ 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 134 of file DalObjectPrint.hpp.

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

◆ 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 61 of file DalObjectPrint.hpp.

62 {
63 s << str << name << ": ";
64 p_base_start<NUM_BASE>(s);
65 p_val(s, val);
66 p_base_end<NUM_BASE>(s);
67 s << '\n';
68 }

◆ 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 105 of file DalObject.cpp.

106{
107 s << str << name << ": " << obj << '\n';
108}

◆ 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 101 of file DalObjectPrint.hpp.

102 {
103 s << str << name << ":\n";
104
105 if (obj)
106 obj->print(indent + 4, true, s);
107 else
108 s << str << " (null)\n";
109 }

◆ p_val()

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

Definition at line 17 of file DalObjectPrint.hpp.

18 {
19 s << data;
20 }

◆ p_val< int8_t >()

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

Definition at line 30 of file DalObjectPrint.hpp.

32 {
33 s << static_cast<int16_t>(data);
34 }

◆ p_val< uint8_t >()

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

Definition at line 23 of file DalObjectPrint.hpp.

25 {
26 s << static_cast<uint16_t>(data);
27 }

◆ print_sep()

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

Definition at line 114 of file ConfigObject.cpp.

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

◆ print_val()

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

Definition at line 122 of file ConfigObject.cpp.

123 {
124 s << val;
125 }

◆ print_val< int8_t >()

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

Definition at line 135 of file ConfigObject.cpp.

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

◆ print_val< uint8_t >()

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

Definition at line 128 of file ConfigObject.cpp.

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

◆ 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 143 of file ConfigObject.cpp.

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