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

Defines base class for cache of template objects. More...

#include <Configuration.hpp>

Collaboration diagram for dunedaq::conffwk::Configuration:
[legend]

Classes

struct  CallbackSubscription
struct  CallbackPreSubscription
class  AttributeConverterBase
class  AttributeConverter
 Virtual converter class. More...

Public Types

typedef void(*) notify(const std::vector< ConfigurationChange * > &changed_classes, void *parameter)
 The user notification callback function which is invoked in case of changes.
typedef void(*) pre_notify(void *parameter)
 The user notification callback function which is invoked before changes are going to be applied.
typedef CallbackSubscription * CallbackId
 Callback identifier.

Public Member Functions

 Configuration (const std::string &spec)
 Constructor to build a configuration object using implementation plug-in.
 Configuration ()
const std::string & get_impl_spec () const noexcept
const std::string & get_impl_name () const noexcept
const std::string & get_impl_param () const noexcept
 ~Configuration () noexcept
 Destructor to destroy a configuration object.
CallbackId subscribe (const ConfigurationSubscriptionCriteria &criteria, notify user_cb, void *user_param=nullptr)
 Subscribe on configuration changes.
CallbackId subscribe (pre_notify user_cb, void *user_param=nullptr)
 Subscribe on pre-notification on configuration changes.
void unsubscribe (CallbackId cb_handler=0)
 Remove callback function.
template<class T>
bool is_valid (const T *object) noexcept
 Checks validity of pointer to an objects of given user class.
template<class T>
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.
void update_cache (std::vector< ConfigurationChange * > &changes) noexcept
 System function invoked in case of modifications.
template<class T>
void _reset_objects () noexcept
 Update state of objects after abort operations.
void unread_all_objects (bool unread_implementation_objs=false) noexcept
 Unread all template (i.e. set their state as uninitialized) and implementation objects (i.e. clear their cache).
void unread_template_objects () noexcept
 Unread all template (i.e. set their state as uninitialized) objects.
void unread_implementation_objects (dunedaq::conffwk::ObjectState state) noexcept
 Unread implementation objects (i.e. clear their cache).
void create (const std::string &at, const std::string &class_name, const std::string &id, ConfigObject &object)
 Create new object by class name and object id.
void create (const ConfigObject &at, const std::string &class_name, const std::string &id, ConfigObject &object)
 Create new object by class name and object id.
template<class T>
const T * create (const std::string &at, const std::string &id, bool init_object=false)
 Create object of given class by identity and instantiate the template parameter with it.
template<class T>
const T * create (const DalObject &at, const std::string &id, bool init_object=false)
 Create object of given class by identity and instantiate the template parameter with it.
void destroy_obj (ConfigObject &object)
 Destroy object.
template<class T>
void destroy (T &obj)
 Destroy object of given class.
bool test_object (const std::string &class_name, const std::string &id, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
 Test the object existence.
void get (const std::string &class_name, const std::string &id, ConfigObject &object, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
 Get object by class name and object id (multi-thread safe).
void get (const std::string &class_name, std::vector< ConfigObject > &objects, const std::string &query="", unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
 Get all objects of class.
void get (const ConfigObject &obj_from, const std::string &query, std::vector< ConfigObject > &objects, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
 Get path between objects.
template<class T>
const T * get (const std::string &id, bool init_children=false, bool init=true, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
 Get object of given class by identity and instantiate the template parameter with it (multi-thread safe).
template<class T>
const T * get (ConfigObject &obj, bool init_children=false, bool init=true)
 Get object of given class by object reference and instantiate the template parameter with it (multi-thread safe).
template<class T>
void get (std::vector< const T * > &objects, bool init_children=false, bool init=true, const std::string &query="", unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
 Get all objects of given class and instantiate a vector of the template parameters object with it (multi-thread safe).
template<class T>
const T * get (ConfigObject &obj, const std::string &id)
 Generate object of given class by object reference and instantiate the template parameter with it (multi-thread safe).
template<class T>
const T * find (const std::string &id)
 Find object of given class (multi-thread safe).
template<class T>
const T * ref (ConfigObject &obj, const std::string &name, bool init=false)
 Get signle value of object's relation and instantiate result with it (multi-thread safe).
template<class T>
void ref (ConfigObject &obj, const std::string &name, std::vector< const T * > &objects, bool init=false)
 Get multiple values of object's relation and instantiate result with them (multi-thread safe).
template<class T, class V>
void referenced_by (const T &obj, std::vector< const V * > &objects, const std::string &relationship_name="*", bool check_composite_only=true, bool init=false, unsigned long rlevel=0, const std::vector< std::string > *rclasses=nullptr)
 Get template DAL objects holding references on this object via given relationship (multi-thread safe).
std::vector< const DalObject * > referenced_by (const DalObject &obj, const std::string &relationship_name="*", bool check_composite_only=true, bool upcast_unregistered=true, bool init=false, unsigned long rlevel=0, const std::vector< std::string > *rclasses=nullptr)
 Get DAL objects holding references on this object via given relationship (multi-thread safe).
template<class TARGET, class SOURCE>
const TARGET * cast (const SOURCE *s) noexcept
 Cast objects from one class to another (multi-thread safe).
template<class T>
void downcast_dal_objects (const std::vector< const T * > &objs, bool, std::vector< const DalObject * > &result)
template<class T>
void downcast_dal_object (const T *obj, bool, std::vector< const DalObject * > &result)
template<class T>
const T * _find (const std::string &id)
 Multi-thread unsafe version of find(const std::string&) method.
template<class T>
const T * _ref (ConfigObject &obj, const std::string &name, bool read_children)
 Multi-thread unsafe version of ref(ConfigObject&, const std::string&, bool); The method should not be used by user.
template<class T>
void _ref (ConfigObject &obj, const std::string &name, std::vector< const T * > &results, bool read_children)
 Multi-thread unsafe version of ref(ConfigObject&, const std::string&, std::vector<const T*>&, bool); The method should not be used by user.
bool try_cast (const std::string &target, const std::string &source) noexcept
 Checks if cast from source class to target class is allowed.
bool try_cast (const std::string *target, const std::string *source) noexcept
bool is_superclass_of (const std::string &target, const std::string &source) noexcept
bool is_superclass_of (const std::string *target, const std::string *source) noexcept
bool loaded () const noexcept
 Check if database is correctly loaded.
void load (const std::string &db_name)
 Load database according to the name. If name is empty, take it from TDAQ_DB_NAME and TDAQ_DB_DATA environment variables.
void unload ()
 Unload database.
void create (const std::string &db_name, const std::list< std::string > &includes)
 Create database.
bool is_writable (const std::string &db_name) const
 Get write access status.
void add_include (const std::string &db_name, const std::string &include)
 Add include file to existing database.
void remove_include (const std::string &db_name, const std::string &include)
 Remove include file.
void get_includes (const std::string &db_name, std::list< std::string > &includes) const
 Get include files.
void get_updated_dbs (std::list< std::string > &dbs) const
 Get list of updated files to be committed.
void set_commit_credentials (const std::string &user, const std::string &password)
 Set commit credentials.
void commit (const std::string &log_message="")
 Commit database changes.
void abort ()
 Abort database changes.
void prefetch_all_data ()
 Prefetch all data into client cache.
std::vector< dunedaq::conffwk::Version > get_changes ()
 Get new conffwk versions.
std::vector< dunedaq::conffwk::Version > get_versions (const std::string &since, const std::string &until, dunedaq::conffwk::Version::QueryType type=dunedaq::conffwk::Version::query_by_date, bool skip_irrelevant=true)
 Get repository versions in interval.
const dunedaq::conffwk::class_t & get_class_info (const std::string &class_name, bool direct_only=false)
 The method provides access to description of class.
void export_schema (boost::property_tree::ptree &tree, const std::string &classes="", bool direct_only=false)
 Export configuration schema into ptree.
void export_data (boost::property_tree::ptree &tree, const std::string &classes="", const std::string &objects="", const std::string &files="", const std::string &empty_array_item="")
 Export configuration data into ptree.
template<class T>
void register_converter (AttributeConverter< T > *object) noexcept
 Register user function for attribute conversion.
template<class T>
void convert (T &value, const ConfigObject &obj, const std::string &attr_name) noexcept
 Converts single value.
template<class T>
void convert2 (std::vector< T > &value, const ConfigObject &obj, const std::string &attr_name) noexcept
 Converts vector of single values.
void print_profiling_info () noexcept
 Print out profiling information.
const conffwk::fmap< conffwk::fset > & superclasses () const noexcept
const conffwk::fmap< conffwk::fset > & subclasses () const
std::vector< std::string > classes_in_python () const
void print (std::ostream &) const noexcept
 Prints out details of configuration object.
void add_action (ConfigAction *ac)
void remove_action (ConfigAction *ac)
std::unordered_map< std::string, std::unordered_map< std::string, std::string > > attributes_pybind (const std::string &class_name, bool all)
std::vector< std::string > get_class_list () const
ConfigObject * create_and_return_obj_pybind (const std::string &at, const std::string &class_name, const std::string &id)
ConfigObject * create_and_return_obj_pybind (const ConfigObject &at, const std::string &class_name, const std::string &id)
ConfigObject * get_obj_pybind (const std::string &class_name, const std::string &id)
std::vector< ConfigObject > * get_objs_pybind (const std::string &class_name, const std::string &query="")
std::unordered_map< std::string, std::unordered_map< std::string, std::string > > relations_pybind (const std::string &class_name, bool all)
std::list< std::string > * return_includes_pybind (const std::string &db_name)
std::vector< std::string > subclasses_pybind (const std::string &class_name, bool all)
std::vector< std::string > superclasses_pybind (const std::string &class_name, bool all)
const std::string & get_schema_path_pybind (const std::string &class_name)

Static Public Member Functions

static void system_cb (std::vector< ConfigurationChange * > &, Configuration *) noexcept
 System callback function invoked in case of modifications.
static void system_pre_cb (Configuration *) noexcept
 System callback function invoked in case of pre-modifications.

Private Types

typedef std::set< CallbackSubscription *, std::less< CallbackSubscription * > > CallbackSet
typedef std::set< CallbackPreSubscription *, std::less< CallbackPreSubscription * > > PreCallbackSet

Private Member Functions

void reset_subscription ()
void _unread_template_objects () noexcept
void _unread_implementation_objects (dunedaq::conffwk::ObjectState state) noexcept
void _get (const std::string &class_name, const std::string &id, ConfigObject &object, unsigned long rlevel, const std::vector< std::string > *rclasses)
template<class T>
const T * _get (const std::string &id, bool init_children=false, bool init=true, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
template<class T>
const T * _get (ConfigObject &obj, bool init_children=false, bool init=true)
template<class T>
void _get (std::vector< const T * > &objects, bool init_children=false, bool init=true, const std::string &query="", unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
template<class T>
DalObject * _make_instance (ConfigObject &obj, const std::string &uid)
const dunedaq::conffwk::class_t & _get_class_info (const std::string &class_name, bool direct_only=false)
void set_subclasses () noexcept
void set_class_domain_map ()
void update_classes () noexcept
std::deque< std::set< std::string > > find_class_domains ()
void rename_object (ConfigObject &obj, const std::string &new_id)
 Cache of template object of given type.
CallbackSubscription * find_callback (CallbackId cb_handler) const
void action_on_update (const ConfigObject &obj, const std::string &name)
 Configuration (const Configuration &)
Configuration & operator= (const Configuration &)

Static Private Member Functions

static void update_impl_objects (conffwk::pmap< conffwk::map< ConfigObjectImpl * > * > &cache, ConfigurationChange &change, const std::string *class_name)
static std::string mk_ref_ex_text (const char *what, const std::string &cname, const std::string &rname, const ConfigObject &obj) noexcept
static std::string mk_ref_by_ex_text (const std::string &cname, const std::string &rname, const ConfigObject &obj) noexcept

Private Attributes

conffwk::map< dunedaq::conffwk::class_t * > p_direct_classes_desc_cache
conffwk::map< dunedaq::conffwk::class_t * > p_all_classes_desc_cache
std::atomic< uint_least64_t > p_number_of_cache_hits
std::atomic< uint_least64_t > p_number_of_template_object_created
std::atomic< uint_least64_t > p_number_of_template_object_read
conffwk::fmap< conffwk::fset > p_superclasses
conffwk::fmap< conffwk::fset > p_subclasses
conffwk::fmap< uint > p_class_domain_map
conffwk::map< std::list< AttributeConverterBase * > * > m_convert_map
ConfigurationImpl * m_impl
std::string m_impl_spec
std::string m_impl_name
std::string m_impl_param
void * m_shlib_h
CallbackSet m_callbacks
PreCallbackSet m_pre_callbacks
std::list< ConfigAction * > m_actions
DalRegistry m_registry
std::mutex m_impl_mutex
std::mutex m_tmpl_mutex
std::mutex m_actn_mutex
std::mutex m_else_mutex

Friends

class DalObject
class ConfigObject
class ConfigurationImpl
class DalRegistry

Detailed Description

Defines base class for cache of template objects.

The class is used as a base class for any cached template object. It defines:

  • virtual destructor
  • DAL factory functions

Provides abstract interface to database data.

The class provides interfaces to data access and notification on data changes which are independent from the database implementation.

The class is an entry point to the database information. It provides access to the database objects by name of the class and optionally (for named objects) by object identities. Normally, user should use this class to open/close database and to access objects via template get methods invoked with classes generated by the genconffwk utility.

Below there is brief description of main methods. Most of then can only be used after successful initialization (i.e. database load) of the Configuration object.

Methods throw exceptions in case of an error unless noexcept is explicitly used in their specification. The following exceptions can be thrown:

  • dunedaq::conffwk::Generic is used to report most of the problems (bad DB, wrong parameter, plug-in specific, etc.)
  • dunedaq::conffwk::NotFound the conffwk object accessed by ID is not found, class accessed by name is not found
  • dunedaq::conffwk::DeletedObject accessing template object that has been deleted (via notification or by the user's code)
    All above exceptions have common class dunedaq::conffwk::Exception, that can be used to catch all of them.
    
try {
// load database using oks file /tmp/mydb.data.xml
Configuration db("oksconflibs:/tmp/mydb.data.xml");
// get object "foo@bar"
db.get("bar", "foo", obj);
// print object to the standard output stream
obj.print_ref(std::cout, db);
}
// the catch of dunedaq::conffwk::NotFound exception is optional:
// it is only used to distinguish NotFound exception from other possible once
catch (dunedaq::conffwk::NotFound & ex) {
std::cerr << "Object foo@bar is not found: " << ex << std::endl;
}
// always catch this exception: it can come unexpectedly from DBMS implementation,
// e.g. because of hardware problems or lack of computer resources
catch (dunedaq::conffwk::Exception & ex) {
std::cerr << "ERROR: " << ex << std::endl;
}
Configuration(const std::string &spec)
Constructor to build a configuration object using implementation plug-in.
msgpack::object obj
Database Manipulation

To get data a database can be opened, closed and it's state can be checked by the following methods:

  • load() open database (by default, the database is opened by the constructor)
  • unload() closes database (by default, the database is closed by the destructor)
  • loaded() returns true, if a database is correctly loaded

To create or to modify data a database the following methods can be used:

  • create(const std::string&, const std::string&, const std::list<std::string>&) create new database
  • add_include() add include to an existing database
  • remove_include() remove include from an existing database
  • commit() save chain of changes
  • abort() cancel all previous changes
Objects Access

The access to the objects is provided via two main methods:

  • get(const std::string& class, const std::string& id, ConfigObject&, unsigned long, const std::vector<std::string> ) get single object by name of class and id
  • get(const std::string& class, std::vector<ConfigObject>&, const std::string& query, unsigned long, const std::vector<std::string> *) get objects of class by name
    Below there is example to read all computer objects
    
    try {
    Configuration db("oksconflibs:daq/partitions/part_hlt.data.xml");
    // read all objects of "Computer" class
    std::vector<ConfigObject> hosts;
    db.get("Computer", hosts);
    // print details of the Computer objects
    for (const auto& x : objects)
    x.print_ref(std::cout, db);
    }
    catch (dunedaq::conffwk::Exception & ex) {
    std::cerr << "ERROR: " << ex << std::endl;
    }
    For objects of classes generated by genconffwk there are analogous template methods which
    in addition store pointers to objects in the cache and which to be used by end-user:
    - get(const std::string& id, bool, bool, unsigned long, const std::vector<std::string> *) return const pointer to
    
    object of given user class
  • get(std::vector<const T*>& objects, bool, bool, const std::string& query, unsigned long, const std::vector<std::string> *) fills vector of objects of given user class
    Below there is an example for generated \b dal package:
    
    // include generated files for classes used below
    #include "dal/Variable.h"
    #include "dal/Segment.h"
    try {
    Configuration db("oksconflibs:daq/partitions/part_hlt.data.xml");
    // read all variables with Name = "TDAQ_DB_NAME"
    std::vector<const daq::core::Variable*> vars;
    db.get(vars, false, true, "(all (\"Name\" \"TDAQ_ERS_INFO\" =))");
    // print variables
    std::cout << "Got " << vars.size() << " variables with name TDAQ_ERS_INFO:\n";
    for (const auto& x : vars)
    std::cout << "object " << x << " => " << x->get_Value() << std::endl;
    // get segment with id = "online" and print if found
    if (const daq::core::Segment * p = db.get<daq::core::Segment>("online"))
    std::cout << "The segment object is: " << *p << std::endl;
    }
    catch (dunedaq::conffwk::Exception & ex) {
    std::cerr << "ERROR: " << ex << std::endl;
    }
    \par Notification
    
    To subscribe and unsubscribe on changes it is necessary to create a subscription criteria
    (see ConfigurationSubscriptionCriteria class for more information).
    When a subscription criteria object is created, the following methods can be used:
    - subscribe() subscribe on any changes according criteria
    - unsubscribe() unsubscribe above changes (the CallbackId is returned by above method)
    

Definition at line 233 of file Configuration.hpp.

Member Typedef Documentation

◆ CallbackId

Callback identifier.

It uniquely identifies a callback inside given process. It is returned by subscribe() method and must be used as parameter for the unsubscribe() methods.

Definition at line 328 of file Configuration.hpp.

◆ CallbackSet

Definition at line 1679 of file Configuration.hpp.

◆ notify

typedef void(*) dunedaq::conffwk::Configuration::notify(const std::vector< ConfigurationChange * > &changed_classes, void *parameter)

The user notification callback function which is invoked in case of changes.

Parameters
changed_classesvector of changed classes
parameteruser-defined parameter

Definition at line 292 of file Configuration.hpp.

◆ pre_notify

typedef void(*) dunedaq::conffwk::Configuration::pre_notify(void *parameter)

The user notification callback function which is invoked before changes are going to be applied.

Parameters
parameteruser-defined parameter

Definition at line 301 of file Configuration.hpp.

◆ PreCallbackSet

Constructor & Destructor Documentation

◆ Configuration() [1/3]

dunedaq::Configuration::Configuration ( const std::string & spec)

Constructor to build a configuration object using implementation plug-in.

The constructor expects parameter in format "plugin-name:plugin-parameter". The plugin-name is used to get implementation shared library by adding "lib" prefix and ".so" suffix, e.g. "oksconflibs" -> "liboksconflibs.so". The plugin-parameter is optional; if non-empty, it is passed to the plug-in constructor.

Parameters
specdatabase name to be understood by the database implementation
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 102 of file Configuration.cpp.

106 , m_impl(nullptr)
107 , m_shlib_h(nullptr)
108 , m_registry(*this)
109{
110 std::string s;
111
112 if (spec.empty()) {
113 if (const char* env = getenv("TDAQ_DB"))
114 m_impl_spec = env;
115 } else {
116 m_impl_spec = spec;
117 }
118
119 if (m_impl_spec.empty())
120 throw dunedaq::conffwk::Generic(
121 ERS_HERE,
122 "no database parameter found (check parameter of the constructor or value of TDAQ_DB environment variable)");
123
124 std::string::size_type idx = m_impl_spec.find_first_of(':');
125
126 if (idx == std::string::npos) {
128 } else {
129 m_impl_name = m_impl_spec.substr(0, idx);
130 m_impl_param = m_impl_spec.substr(idx + 1);
131 }
132
133 std::string plugin_name = std::string("lib") + m_impl_name + ".so";
134 std::string impl_creator = std::string("_") + m_impl_name + "_creator_";
135
136 // load plug-in
137 m_shlib_h = dlopen(plugin_name.c_str(), RTLD_LAZY | RTLD_GLOBAL);
138
139 if (!m_shlib_h) {
140 std::ostringstream text;
141 text << "failed to load implementation plug-in \'" << plugin_name << "\': \"" << dlerror() << '\"';
142 throw(dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str()));
143 }
144
145 // search in plug-in implementation creator function
146
147 ConfigurationImpl* (*f)(const std::string& spec);
148
149 f = (ConfigurationImpl * (*)(const std::string&)) dlsym(m_shlib_h, impl_creator.c_str());
150
151 char* error = 0;
152
153 if ((error = dlerror()) != 0) {
154 std::ostringstream text;
155 text << "failed to find implementation creator function \'" << impl_creator << "\' in plug-in \'" << plugin_name
156 << "\': \"" << error << '\"';
157 throw(dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str()));
158 }
159
160 // create implementation
161
162 m_impl = (*f)(m_impl_param);
163
164 if (m_impl) {
165 // m_impl->get_superclasses(p_superclasses);
166 // set_subclasses();
168 m_impl->set(this);
169 }
170
173
174 TLOG_DEBUG(2) << "\n*** DUMP CONFIGURATION ***\n" << *this;
175}
#define ERS_HERE
virtual void prefetch_all_data()=0
Prefetch all data into client cache.
void set(Configuration *db) noexcept
set configuration object
std::atomic< uint_least64_t > p_number_of_template_object_created
std::atomic< uint_least64_t > p_number_of_template_object_read
std::atomic< uint_least64_t > p_number_of_cache_hits
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:116
static bool check_prefetch_needs()
CIB Buffer std::string descriptor Message from std::string descriptor CIB process error

◆ Configuration() [2/3]

dunedaq::conffwk::Configuration::Configuration ( )

◆ ~Configuration()

dunedaq::Configuration::~Configuration ( )
noexcept

Destructor to destroy a configuration object.

The destructor unloads database for given database implementation and destroys all user objects in cache.

Definition at line 213 of file Configuration.cpp.

214{
215 if (::getenv("TDAQ_DUMP_CONFFWK_PROFILER_INFO"))
217
218 try {
219 unload();
220
221 if (m_shlib_h) {
222 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
223
224 delete m_impl;
225 m_impl = 0;
226 // dlclose(m_shlib_h);
227 m_shlib_h = 0;
228 }
229 } catch (dunedaq::conffwk::Generic& ex) {
230 ers::error(ex);
231 }
232}
void print_profiling_info() noexcept
Print out profiling information.
void unload()
Unload database.
void error(const Issue &issue)
Definition ers.hpp:101

◆ Configuration() [3/3]

dunedaq::conffwk::Configuration::Configuration ( const Configuration & )
private

Member Function Documentation

◆ _find()

template<class T>
const T * dunedaq::conffwk::Configuration::_find ( const std::string & id)

Multi-thread unsafe version of find(const std::string&) method.

Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 57 of file Configuration.hxx.

58{
59 // auto it = m_cache_map.find(&T::s_class_name);
60 // return (it != m_cache_map.end() ? static_cast<Cache<T>*>(it->second)->find(id) : nullptr);
61 return m_registry.find<T>(id);
62}
T * find(const std::string &id)
Find template object using ID.

◆ _get() [1/4]

template<class T>
const T * dunedaq::conffwk::Configuration::_get ( ConfigObject & obj,
bool init_children = false,
bool init = true )
private
Exceptions
dunedaq::conffwk::Generic

Definition at line 42 of file Configuration.hxx.

43{
44 return m_registry.get<T>(obj, init_children, init_object);
45}
DalObject * get(ConfigObject &obj, bool upcast_unregistered=false)

◆ _get() [2/4]

void dunedaq::conffwk::Configuration::_get ( const std::string & class_name,
const std::string & id,
ConfigObject & object,
unsigned long rlevel,
const std::vector< std::string > * rclasses )
private

◆ _get() [3/4]

template<class T>
const T * dunedaq::conffwk::Configuration::_get ( const std::string & id,
bool init_children = false,
bool init = true,
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = 0 )
private
Exceptions
dunedaq::conffwk::Generic

Definition at line 30 of file Configuration.hxx.

35{
36 return m_registry.get<T>(name, init_children, init_object, rlevel, rclasses);
37}

◆ _get() [4/4]

template<class T>
void dunedaq::conffwk::Configuration::_get ( std::vector< const T * > & objects,
bool init_children = false,
bool init = true,
const std::string & query = "",
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = 0 )
private
Exceptions
dunedaq::conffwk::Generic

Definition at line 67 of file Configuration.hxx.

73{
74 std::vector<ConfigObject> objs;
75
76 try {
77 get(T::s_class_name, objs, query, rlevel, rclasses);
78 } catch (dunedaq::conffwk::NotFound& ex) {
79 std::ostringstream text;
80 text << "wrong database schema, cannot find class \'" << ex.get_data() << '\'';
81 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
82 }
83
84 if (!objs.empty()) {
85 for (auto& i : objs) {
86 result.push_back(this->_get<T>(i, init_children, init_object));
87 }
88 }
89}
void _get(const std::string &class_name, const std::string &id, ConfigObject &object, unsigned long rlevel, const std::vector< std::string > *rclasses)
void get(const std::string &class_name, const std::string &id, ConfigObject &object, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
Get object by class name and object id (multi-thread safe).

◆ _get_class_info()

const dunedaq::conffwk::class_t & dunedaq::Configuration::_get_class_info ( const std::string & class_name,
bool direct_only = false )
private

Definition at line 832 of file Configuration.cpp.

833{
834 conffwk::map<dunedaq::conffwk::class_t*>& d_cache(direct_only ? p_direct_classes_desc_cache
836
837 conffwk::map<dunedaq::conffwk::class_t*>::const_iterator i = d_cache.find(class_name);
838
839 if (i != d_cache.end())
840 return *(i->second);
841
842 try {
843 dunedaq::conffwk::class_t* d = m_impl->get(class_name, direct_only);
844 d_cache[class_name] = d;
845 return *d;
846 }
847 // catch Generic exception only; the NotFound is forwarded from implementation
848 catch (dunedaq::conffwk::Generic& ex) {
849 std::ostringstream text;
850 text << "failed to get description of class \'" << class_name << '\'';
851 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex);
852 }
853}
virtual void get(const std::string &class_name, const std::string &id, ConfigObject &object, unsigned long rlevel, const std::vector< std::string > *rclasses)=0
Get object of class by id.
conffwk::map< dunedaq::conffwk::class_t * > p_all_classes_desc_cache
conffwk::map< dunedaq::conffwk::class_t * > p_direct_classes_desc_cache

◆ _make_instance()

template<class T>
DalObject * dunedaq::conffwk::Configuration::_make_instance ( ConfigObject & obj,
const std::string & uid )
inlineprivate
Exceptions
dunedaq::conffwk::Generic

Definition at line 1009 of file Configuration.hpp.

1010 {
1011 // note upcast since the _get() returns pointer to T
1012 return const_cast<T*>(_get<T>(obj, uid));
1013 }

◆ _ref() [1/2]

template<class T>
const T * dunedaq::conffwk::Configuration::_ref ( ConfigObject & obj,
const std::string & name,
bool read_children )

Multi-thread unsafe version of ref(ConfigObject&, const std::string&, bool); The method should not be used by user.

Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 94 of file Configuration.hxx.

95{
96 return m_registry._ref<T>(obj, name, read_children);
97 // ConfigObject res;
98
99 // try
100 // {
101 // obj.get(name, res);
102 // }
103 // catch (dunedaq::conffwk::Generic & ex)
104 // {
105 // throw(dunedaq::conffwk::Generic( ERS_HERE, mk_ref_ex_text("an object", T::s_class_name, name, obj).c_str(), ex
106 // ) );
107 // }
108
109 // return ((!res.is_null()) ? get_cache<T>(res.class_name())->get(*this, res, read_children, read_children) :
110 // nullptr);
111}
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).

◆ _ref() [2/2]

template<class T>
void dunedaq::conffwk::Configuration::_ref ( ConfigObject & obj,
const std::string & name,
std::vector< const T * > & results,
bool read_children )

Multi-thread unsafe version of ref(ConfigObject&, const std::string&, std::vector<const T*>&, bool); The method should not be used by user.

Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 116 of file Configuration.hxx.

117{
118
119 return m_registry._ref<T>(obj, name, results, read_children);
120 // std::vector<ConfigObject> objs;
121
122 // results.clear();
123
124 // try
125 // {
126 // obj.get(name, objs);
127 // results.reserve(objs.size());
128
129 // for (auto& i : objs)
130 // {
131 // results.push_back(get_cache<T>(i.class_name())->get(*this, i, read_children, read_children));
132 // }
133 // }
134 // catch (dunedaq::conffwk::Generic & ex)
135 // {
136 // throw(dunedaq::conffwk::Generic( ERS_HERE, mk_ref_ex_text("objects", T::s_class_name, name, obj).c_str(), ex )
137 // );
138 // }
139}

◆ _reset_objects()

template<class T>
void dunedaq::conffwk::Configuration::_reset_objects ( )
noexcept

Update state of objects after abort operations.

It is used by automatically generated data access libraries.

Definition at line 320 of file Configuration.hxx.

321{
322 // auto j = m_cache_map.find(&T::s_class_name);
323
324 // if (j != m_cache_map.end())
325 // {
326 // _unread_objects(static_cast<Cache<T>*>(j->second));
327 // }
329}
void _reset_objects()
Update state of objects after abort operations.

◆ _unread_implementation_objects()

void dunedaq::Configuration::_unread_implementation_objects ( dunedaq::conffwk::ObjectState state)
privatenoexcept

Definition at line 611 of file Configuration.cpp.

612{
613 for (auto& i : m_impl->m_impl_objects)
614 for (auto& j : *i.second) {
615 std::lock_guard<std::mutex> scoped_lock(j.second->m_mutex);
616 j.second->clear();
617 j.second->m_state = state;
618 }
619
620 for (auto& x : m_impl->m_tangled_objects) {
621 std::lock_guard<std::mutex> scoped_lock(x->m_mutex);
622 x->clear();
623 x->m_state = state;
624 }
625}
conffwk::pmap< conffwk::map< ConfigObjectImpl * > * > m_impl_objects
cache of implementation objects (class-name::->object_id->implementation)
std::vector< ConfigObjectImpl * > m_tangled_objects

◆ _unread_template_objects()

void dunedaq::Configuration::_unread_template_objects ( )
privatenoexcept

Definition at line 605 of file Configuration.cpp.

606{
608}
void unread_all()
Set the status of all objects in cache to unread.

◆ abort()

void dunedaq::Configuration::abort ( )

Abort database changes.

The method rolls back non-committed database modifications.

Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 558 of file Configuration.cpp.

559{
560 TLOG_DEBUG(1) << "call abort";
561
562 if (m_impl == nullptr)
563 throw dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded");
564
565 std::lock_guard<std::mutex> scoped_lock1(m_tmpl_mutex); // always lock template objects mutex first
566 std::lock_guard<std::mutex> scoped_lock2(m_impl_mutex);
567
568 try {
569 m_impl->abort();
572 // m_impl->get_superclasses(p_superclasses);
573 // set_subclasses();
575
576 } catch (dunedaq::conffwk::Generic& ex) {
577 throw(dunedaq::conffwk::Generic(ERS_HERE, "abort failed", ex));
578 }
579}
virtual void abort()=0
Abort database changes.
void _unread_implementation_objects(dunedaq::conffwk::ObjectState state) noexcept

◆ action_on_update()

void dunedaq::Configuration::action_on_update ( const ConfigObject & obj,
const std::string & name )
private

Definition at line 75 of file Configuration.cpp.

76{
77 std::lock_guard<std::mutex> scoped_lock(m_actn_mutex);
78 for (auto& i : m_actions)
79 i->update(obj, name);
80}
std::list< ConfigAction * > m_actions

◆ add_action()

void dunedaq::Configuration::add_action ( ConfigAction * ac)

Add global action performed by user code on db [un]load and updates.

Definition at line 61 of file Configuration.cpp.

62{
63 std::lock_guard<std::mutex> scoped_lock(m_actn_mutex);
64 m_actions.push_back(ac);
65}

◆ add_include()

void dunedaq::Configuration::add_include ( const std::string & db_name,
const std::string & include )

Add include file to existing database.

The method adds (and loads) existing include file to the database.

Parameters
db_namename of database file to be included
includefile to be included
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 452 of file Configuration.cpp.

453{
454 if (m_impl == nullptr)
455 throw dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded");
456
457 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
458
459 try {
460 m_impl->add_include(db_name, include);
461 // m_impl->get_superclasses(p_superclasses);
462 // set_subclasses();
464 } catch (dunedaq::conffwk::Generic& ex) {
465 std::ostringstream text;
466 text << "failed to add include \'" << include << "\' to database \'" << db_name << '\'';
467 throw(dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex));
468 }
469}
virtual void add_include(const std::string &db_name, const std::string &include)=0
Add include file.
None include(str oksfile, bool exclude, list[str] excludable_entity, str session_name)
Definition include.py:8

◆ attributes_pybind()

std::unordered_map< std::string, std::unordered_map< std::string, std::string > > dunedaq::Configuration::attributes_pybind ( const std::string & class_name,
bool all )

Definition at line 1849 of file Configuration.cpp.

1850{
1851
1852 std::unordered_map<std::string, std::unordered_map<std::string, std::string>> all_attributes_properties;
1853
1854 const dunedaq::conffwk::class_t& c = this->get_class_info(class_name, !all);
1855
1856 for (const auto& ap : c.p_attributes) {
1857 std::unordered_map<std::string, std::string> attribute_properties;
1858 attribute_properties["type"] = dunedaq::conffwk::attribute_t::type(ap.p_type);
1859
1860 attribute_properties["range"] = ap.p_range.empty() ? "None" : ap.p_range;
1861
1862 attribute_properties["description"] = ap.p_description;
1863
1864 attribute_properties["multivalue"] = ap.p_is_multi_value ? "True" : "False";
1865
1866 attribute_properties["not-null"] = ap.p_is_not_null ? "True" : "False";
1867
1868 attribute_properties["init-value"] = ap.p_default_value.empty() ? "None" : ap.p_default_value;
1869
1870 all_attributes_properties[ap.p_name] = attribute_properties;
1871 }
1872
1873 return all_attributes_properties;
1874}
const dunedaq::conffwk::class_t & get_class_info(const std::string &class_name, bool direct_only=false)
The method provides access to description of class.
static const char * type(type_t type)

◆ cast()

template<class TARGET, class SOURCE>
const TARGET * dunedaq::conffwk::Configuration::cast ( const SOURCE * s)
inlinenoexcept

Cast objects from one class to another (multi-thread safe).

Try to cast object SOURCE to TARGET. Returns 0 if not successful. Do not use the normal dynamic_cast<T>() for database classes.

Returns
Return nullptr if the cast is not successful.

Definition at line 970 of file Configuration.hpp.

971 {
972 return s->template cast<TARGET>();
973 }
const TARGET * cast(const SOURCE *s) noexcept
Cast objects from one class to another (multi-thread safe).

◆ classes_in_python()

std::vector< std::string > dunedaq::conffwk::Configuration::classes_in_python ( ) const

◆ commit()

void dunedaq::Configuration::commit ( const std::string & log_message = "")

Commit database changes.

The method commits the changes after a database was modified.

Parameters
log_messagelog information
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 540 of file Configuration.cpp.

541{
542 TLOG_DEBUG(1) << "call commit";
543
544 if (m_impl == nullptr)
545 throw dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded");
546
547 std::lock_guard<std::mutex> scoped_lock1(m_tmpl_mutex); // always lock template objects mutex first
548 std::lock_guard<std::mutex> scoped_lock2(m_impl_mutex);
549
550 try {
551 m_impl->commit(log_message);
552 } catch (dunedaq::conffwk::Generic& ex) {
553 throw(dunedaq::conffwk::Generic(ERS_HERE, "commit failed", ex));
554 }
555}
virtual void commit(const std::string &log_message)=0
Commit database changes.

◆ convert()

template<class T>
void dunedaq::conffwk::Configuration::convert ( T & value,
const ConfigObject & obj,
const std::string & attr_name )
noexcept

Converts single value.

The method is used by the code generated by the genconffwk utility.

Definition at line 387 of file Configuration.hxx.

388{
389 conffwk::map<std::list<AttributeConverterBase*>*>::const_iterator l = m_convert_map.find(typeid(T).name());
390 if (l != m_convert_map.end()) {
391 for (const auto& i : *l->second) {
392 static_cast<AttributeConverter<T>*>(i)->convert(value, *this, obj, attr_name);
393 }
394 }
395}
conffwk::map< std::list< AttributeConverterBase * > * > m_convert_map
void convert(T &value, const ConfigObject &obj, const std::string &attr_name) noexcept
Converts single value.

◆ convert2()

template<class T>
void dunedaq::conffwk::Configuration::convert2 ( std::vector< T > & value,
const ConfigObject & obj,
const std::string & attr_name )
noexcept

Converts vector of single values.

The method is used by the code generated by the genconffwk utility.

Definition at line 399 of file Configuration.hxx.

400{
401 conffwk::map<std::list<AttributeConverterBase*>*>::const_iterator l = m_convert_map.find(typeid(T).name());
402 if (l != m_convert_map.end()) {
403 for (auto& j : value) {
404 for (const auto& i : *l->second) {
405 static_cast<AttributeConverter<T>*>(i)->convert(j, *this, obj, attr_name);
406 }
407 }
408 }
409}

◆ create() [1/5]

void dunedaq::Configuration::create ( const ConfigObject & at,
const std::string & class_name,
const std::string & id,
ConfigObject & object )

Create new object by class name and object id.

The method tries to create an object with given id in given class. If found, the method fills 'object' reference.

Parameters
atcreate new object at the same database file where 'at' object is located
class_namename of the class
idobject identity
objectreturned value in case of success
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 752 of file Configuration.cpp.

756{
757 try {
758 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
759 m_impl->create(at, class_name, id, object);
760 } catch (dunedaq::conffwk::Generic& ex) {
761 std::ostringstream text;
762 text << "failed to create object \'" << id << '@' << class_name << '\'';
763 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex);
764 }
765}
virtual void create(const std::string &db_name, const std::list< std::string > &includes)=0
Create database.

◆ create() [2/5]

template<class T>
const T * dunedaq::conffwk::Configuration::create ( const DalObject & at,
const std::string & id,
bool init_object = false )

Create object of given class by identity and instantiate the template parameter with it.

Such method to be used for user classes generated by the genconffwk utility.

Parameters
atan existing object of class generated by genconffwk to define location of the file where to store new object
idobject identity
init_objectif true, initialize object's attributes and relationships
Returns
non-null pointer to created object.
Exceptions
dunedaq::conffwk::Genericin case of an error

◆ create() [3/5]

void dunedaq::Configuration::create ( const std::string & at,
const std::string & class_name,
const std::string & id,
ConfigObject & object )

Create new object by class name and object id.

The method tries to create an object with given id in given class. If found, the method fills 'object' reference.

Parameters
atdatabase file where to create new object
class_namename of the class
idobject identity
objectreturned value in case of success
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 739 of file Configuration.cpp.

740{
741 try {
742 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
743 m_impl->create(at, class_name, id, object);
744 } catch (dunedaq::conffwk::Generic& ex) {
745 std::ostringstream text;
746 text << "failed to create object \'" << id << '@' << class_name << '\'';
747 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex);
748 }
749}

◆ create() [4/5]

template<class T>
const T * dunedaq::conffwk::Configuration::create ( const std::string & at,
const std::string & id,
bool init_object = false )

Create object of given class by identity and instantiate the template parameter with it.

Such method to be used for user classes generated by the genconffwk utility.

Parameters
atdatabase file where to create new object
idobject identity
init_objectif true, initialise object's attributes and relationships
Returns
non-null pointer to created object.
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 11 of file Configuration.hxx.

12{
14
15 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
16 create(at, T::s_class_name, id, obj);
17 return m_registry.get<T>(obj, false, init_object);
18}
void create(const std::string &at, const std::string &class_name, const std::string &id, ConfigObject &object)
Create new object by class name and object id.

◆ create() [5/5]

void dunedaq::Configuration::create ( const std::string & db_name,
const std::list< std::string > & includes )

Create database.

The method creates database according to the name and list of others database files to be included.

Parameters
db_namename of new database file (must be an absolute path to non-existing file)
includesoptional list of others database files to be included
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 417 of file Configuration.cpp.

418{
419 if (m_impl == nullptr)
420 throw dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded");
421
422 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
423
424 try {
425 m_impl->create(db_name, includes);
427 } catch (dunedaq::conffwk::Generic& ex) {
428 std::ostringstream text;
429 text << "failed to create database \'" << db_name << '\'';
430 throw(dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex));
431 }
432}

◆ create_and_return_obj_pybind() [1/2]

ConfigObject * dunedaq::Configuration::create_and_return_obj_pybind ( const ConfigObject & at,
const std::string & class_name,
const std::string & id )

Definition at line 1896 of file Configuration.cpp.

1899{
1900 auto co = new ConfigObject;
1901 this->create(at, class_name, id, *co);
1902 return co;
1903}

◆ create_and_return_obj_pybind() [2/2]

ConfigObject * dunedaq::Configuration::create_and_return_obj_pybind ( const std::string & at,
const std::string & class_name,
const std::string & id )

Definition at line 1888 of file Configuration.cpp.

1889{
1890 auto co = new ConfigObject;
1891 this->create(at, class_name, id, *co);
1892 return co;
1893}

◆ destroy()

template<class T>
void dunedaq::conffwk::Configuration::destroy ( T & obj)

Destroy object of given class.

The method tries to destoy given object.

Parameters
objthe object's reference
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 22 of file Configuration.hxx.

23{
24 destroy_obj(const_cast<ConfigObject&>(obj.config_object()));
25}
void destroy_obj(ConfigObject &object)
Destroy object.

◆ destroy_obj()

void dunedaq::Configuration::destroy_obj ( ConfigObject & object)

Destroy object.

The method tries to destroy given object.

Parameters
objectthe object's reference
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 768 of file Configuration.cpp.

769{
770 try {
771 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
772 std::lock_guard<std::mutex> scoped_lock2(m_tmpl_mutex);
773 m_impl->destroy(object);
774 } catch (dunedaq::conffwk::Generic& ex) {
775 std::ostringstream text;
776 text << "failed to destroy object \'" << object << '\'';
777 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex);
778 }
779}
virtual void destroy(ConfigObject &object)=0
Destroy object of class by id.

◆ downcast_dal_object()

template<class T>
void dunedaq::conffwk::Configuration::downcast_dal_object ( const T * obj,
bool ,
std::vector< const DalObject * > & result )
inline

Definition at line 1032 of file Configuration.hpp.

1033 {
1034 if (obj)
1035 result.push_back(obj);
1036 }

◆ downcast_dal_objects()

template<class T>
void dunedaq::conffwk::Configuration::downcast_dal_objects ( const std::vector< const T * > & objs,
bool ,
std::vector< const DalObject * > & result )
inline

Definition at line 1023 of file Configuration.hpp.

1026 {
1027 for (auto& i : objs)
1028 result.push_back(i);
1029 }

◆ export_data()

void dunedaq::Configuration::export_data ( boost::property_tree::ptree & tree,
const std::string & classes = "",
const std::string & objects = "",
const std::string & files = "",
const std::string & empty_array_item = "" )

Export configuration data into ptree.

Parameters
treeoutput ptree object
classesregex defining class names; ignore if empty
objectsregex defining object IDs; ignore if empty
filesregex defining data file names; ignore if empty
empty_array_itemif provided, add this item to mark empty arrays
Exceptions
dunedaq::conffwk::Genericin case of a problem

Definition at line 1019 of file Configuration.cpp.

1024{
1025 std::unique_ptr<std::regex> classes_regex, objects_regex, files_regex;
1026
1027 init_regex(classes_regex, classes_str, "classes");
1028 init_regex(objects_regex, objects_str, "objects");
1029 init_regex(files_regex, files_str, "files");
1030
1031 auto cmp_str_ptr = [](const std::string* s1, const std::string* s2) { return *s1 < *s2; };
1032 std::set<const std::string*, decltype(cmp_str_ptr)> sorted_classes(cmp_str_ptr);
1033
1034 for (const auto& c : superclasses())
1035 if (classes_str.empty() || std::regex_match(*c.first, *classes_regex.get()))
1036 sorted_classes.insert(c.first);
1037
1038 for (const auto& c : sorted_classes)
1039 if (classes_str.empty() || std::regex_match(*c, *classes_regex.get())) {
1040 const dunedaq::conffwk::class_t& info(get_class_info(*c));
1041
1042 boost::property_tree::ptree pt_objects;
1043
1044 std::vector<ConfigObject> objects;
1045 get(*c, objects);
1046
1047 auto comp_obj_ptr = [](const ConfigObject* o1, const ConfigObject* o2) { return o1->UID() < o2->UID(); };
1048 std::set<const ConfigObject*, decltype(comp_obj_ptr)> sorted_objects(comp_obj_ptr);
1049
1050 for (const auto& x : objects)
1051 if (objects_str.empty() || std::regex_match(x.UID(), *objects_regex.get()))
1052 if (x.class_name() == *c)
1053 if (files_str.empty() || std::regex_match(x.contained_in(), *files_regex.get()))
1054 sorted_objects.insert(&x);
1055
1056 if (!sorted_objects.empty()) {
1057 boost::property_tree::ptree pt_objects;
1058
1059 for (const auto& x : sorted_objects) {
1060 boost::property_tree::ptree data;
1061
1062 for (const auto& a : info.p_attributes)
1063 switch (a.p_type) {
1065 add_data<bool>(data, *x, a, empty_array_item);
1066 break;
1068 add_data<int8_t>(data, *x, a, empty_array_item);
1069 break;
1071 add_data<uint8_t>(data, *x, a, empty_array_item);
1072 break;
1074 add_data<int16_t>(data, *x, a, empty_array_item);
1075 break;
1077 add_data<uint16_t>(data, *x, a, empty_array_item);
1078 break;
1080 add_data<int32_t>(data, *x, a, empty_array_item);
1081 break;
1083 add_data<uint32_t>(data, *x, a, empty_array_item);
1084 break;
1086 add_data<int64_t>(data, *x, a, empty_array_item);
1087 break;
1089 add_data<uint64_t>(data, *x, a, empty_array_item);
1090 break;
1092 add_data<float>(data, *x, a, empty_array_item);
1093 break;
1095 add_data<double>(data, *x, a, empty_array_item);
1096 break;
1102 add_data<std::string>(data, *x, a, empty_array_item);
1103 break;
1104 default:
1105 throw std::runtime_error("Invalid type of attribute " + a.p_name);
1106 }
1107
1108 for (const auto& r : info.p_relationships)
1109 add_data(data, *x, r, empty_array_item);
1110
1111 pt_objects.push_back(boost::property_tree::ptree::value_type(x->UID(), data));
1112 }
1113
1114 pt.put_child(boost::property_tree::ptree::path_type(*c), pt_objects);
1115 }
1116 }
1117}
const conffwk::fmap< conffwk::fset > & superclasses() const noexcept
static void init_regex(std::unique_ptr< std::regex > &ptr, const std::string &str, const char *what)
static void add_data(boost::property_tree::ptree &pt, const ConfigObject &obj, const dunedaq::conffwk::attribute_t &attribute, const std::string &empty_array_item)

◆ export_schema()

void dunedaq::Configuration::export_schema ( boost::property_tree::ptree & tree,
const std::string & classes = "",
bool direct_only = false )

Export configuration schema into ptree.

Parameters
treeoutput ptree object
classesregex defining class names; all classes if empty
direct_onlyif true is set explicitly, return descriptions of direct attributes, relationships, super- and subclasses; by default return all descriptions taking into account inheritance
Exceptions
dunedaq::conffwk::Genericin case of a problem

Definition at line 880 of file Configuration.cpp.

881{
882 std::unique_ptr<std::regex> classes_regex;
883
884 init_regex(classes_regex, classes_str, "classes");
885
886 auto cmp_str_ptr = [](const std::string* s1, const std::string* s2) { return *s1 < *s2; };
887 std::set<const std::string*, decltype(cmp_str_ptr)> sorted_classes(cmp_str_ptr);
888
889 for (const auto& c : superclasses())
890 if (classes_str.empty() || std::regex_match(*c.first, *classes_regex.get()))
891 sorted_classes.insert(c.first);
892
893 for (const auto& c : sorted_classes)
894 if (classes_str.empty() || std::regex_match(*c, *classes_regex.get())) {
895 const dunedaq::conffwk::class_t& info(get_class_info(*c, direct_only));
896
897 boost::property_tree::ptree class_pt;
898
899 class_pt.put("abstract", info.p_abstract);
900 if (!info.p_description.empty())
901 class_pt.put("description", info.p_description);
902
903 if (!info.p_superclasses.empty()) {
904 boost::property_tree::ptree superclasses;
905
906 for (const auto& x : info.p_superclasses)
908
909 class_pt.add_child("superclasses", superclasses);
910 }
911
912 if (!info.p_attributes.empty()) {
913 boost::property_tree::ptree attributes;
914
915 for (const auto& x : info.p_attributes) {
916 boost::property_tree::ptree attribute;
917
918 attribute.put("type", dunedaq::conffwk::attribute_t::type(x.p_type));
919 if (!x.p_range.empty())
920 attribute.put("range", x.p_range);
921 if (x.p_int_format != dunedaq::conffwk::na_int_format)
922 attribute.put("format", dunedaq::conffwk::attribute_t::format2str(x.p_int_format));
923 if (x.p_is_not_null)
924 attribute.put("is-not-null", x.p_is_not_null);
925 if (x.p_is_multi_value)
926 attribute.put("is-multi-value", x.p_is_multi_value);
927 if (!x.p_default_value.empty())
928 attribute.put("default-value", x.p_default_value);
929 if (!x.p_description.empty())
930 attribute.put("description", x.p_description);
931
932 attributes.push_back(boost::property_tree::ptree::value_type(x.p_name, attribute));
933 }
934
935 class_pt.add_child("attributes", attributes);
936 }
937
938 if (!info.p_relationships.empty()) {
939 boost::property_tree::ptree relationships;
940
941 for (const auto& x : info.p_relationships) {
942 boost::property_tree::ptree relationship;
943
944 relationship.put("type", x.p_type);
945 relationship.put("cardinality", dunedaq::conffwk::relationship_t::card2str(x.p_cardinality));
946 if (!x.p_is_aggregation)
947 relationship.put("is-aggregation", x.p_is_aggregation);
948 if (!x.p_description.empty())
949 relationship.put("description", x.p_description);
950
951 relationships.push_back(boost::property_tree::ptree::value_type(x.p_name, relationship));
952 }
953
954 class_pt.add_child("relationships", relationships);
955 }
956
957 pt.put_child(boost::property_tree::ptree::path_type(*c), class_pt);
958 }
959}
std::vector< T > attributes(tref const &item)
T attribute(tref item, dunedaq::conffwk::attribute_t const &attr)
static void add_array_item(boost::property_tree::ptree &pt, const T &val)
static const char * format2str(int_format_t format)
static const char * card2str(cardinality_t cardinality)

◆ find()

template<class T>
const T * dunedaq::conffwk::Configuration::find ( const std::string & id)
inline

Find object of given class (multi-thread safe).

Could be used for generated template objects.

Parameters
idID of object
Returns
Return pointer to object or nullptr if there is no such object
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 841 of file Configuration.hpp.

842 {
843 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
844 return _find<T>(id);
845 }
const T * _find(const std::string &id)
Multi-thread unsafe version of find(const std::string&) method.

◆ find_callback()

Configuration::CallbackSubscription * dunedaq::Configuration::find_callback ( CallbackId cb_handler) const
private

Definition at line 1163 of file Configuration.cpp.

1164{
1165 return ((!cb_handler || (m_callbacks.find(cb_handler) == m_callbacks.end())) ? 0 : cb_handler);
1166}

◆ find_class_domains()

std::deque< std::set< std::string > > dunedaq::Configuration::find_class_domains ( )
private

Definition at line 647 of file Configuration.cpp.

648{
649 std::deque<std::set<std::string>> domains;
650
651 std::deque<dunedaq::conffwk::class_t> seeds;
652 for (const auto& c : get_class_list()) {
653 auto ci = this->_get_class_info(c);
654 if (ci.p_superclasses.empty())
655 seeds.push_back(ci);
656 }
657
658 for (const auto& ci : seeds) {
659 // Make a candidate domain based using the seed subclasses
660 std::set<std::string> class_domain;
661 class_domain.insert(ci.p_name);
662 class_domain.insert(ci.p_subclasses.begin(), ci.p_subclasses.end());
663
664 // Look for overlaps with other domains
665 std::deque<std::set<std::string>> overlapping;
666 for (auto& d : domains) {
667 std::set<std::string> intersection;
668 std::set_intersection(d.begin(),
669 d.end(),
670 class_domain.begin(),
671 class_domain.end(),
672 std::inserter(intersection, intersection.begin()));
673 // non-zero intersection, overlap found
674 if (intersection.size() > 0) {
675 overlapping.push_back(d);
676 }
677 }
678
679 // If overlapping are found, add all overlapping to
680 // the new domain and remove them from the domain list
681 if (!overlapping.empty()) {
682 for (auto& d : overlapping) {
683 // merge the existing cluster in class_domain
684 class_domain.insert(d.begin(), d.end());
685 // Remove the old cluster from the list
686 auto it = std::find(domains.begin(), domains.end(), d);
687 if (it != domains.end()) {
688 domains.erase(it);
689 }
690 }
691 }
692
693 domains.push_back(class_domain);
694 }
695
696 return domains;
697}
const dunedaq::conffwk::class_t & _get_class_info(const std::string &class_name, bool direct_only=false)
std::vector< std::string > get_class_list() const

◆ get() [1/7]

template<class T>
const T * dunedaq::conffwk::Configuration::get ( ConfigObject & obj,
bool init_children = false,
bool init = true )
inline

Get object of given class by object reference and instantiate the template parameter with it (multi-thread safe).

Such method to be used for user classes generated by the genconffwk utility.

Parameters
objreference to conffwk object, that is used to instantiate template object
init_childrenif true, the referenced objects are initialized
initif true, the object's attributes and relationships are read
Returns
Return pointer to object.
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 771 of file Configuration.hpp.

772 {
773 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
774 return _get<T>(obj, init_children, init);
775 }
void init(unordered_map< std::string, std::string > params)

◆ get() [2/7]

template<class T>
const T * dunedaq::conffwk::Configuration::get ( ConfigObject & obj,
const std::string & id )
inline

Generate object of given class by object reference and instantiate the template parameter with it (multi-thread safe).

Such method to be used to generate template objects.

Parameters
objreference to conffwk object, that is used to instantiate template object
idID of generated object could be different from obj.UID()
Returns
Return pointer to object.
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 822 of file Configuration.hpp.

823 {
824 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
825 return _get<T>(obj, id);
826 }

◆ get() [3/7]

void dunedaq::Configuration::get ( const ConfigObject & obj_from,
const std::string & query,
std::vector< ConfigObject > & objects,
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = 0 )

Get path between objects.

The method returns all objects which are in the path starting from source object matching to the path query pattern.

Parameters
obj_fromobject to start from
querypath query
objectsreturned value in case of success
rleveloptional references level to optimize performance (defines how many objects referenced by found objects have also to be read to the implementation cache)
rclassesoptional array of class names to optimize performance (defines which referenced objects have to be read to the implementation cache)
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 282 of file Configuration.cpp.

287{
288 try {
289 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
290 m_impl->get(obj_from, query, objects, rlevel, rclasses);
291 } catch (dunedaq::conffwk::Generic& ex) {
292 std::ostringstream text;
293 text << "failed to get path \'" << query << "\' from object \'" << obj_from << '\'';
294 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex);
295 }
296}

◆ get() [4/7]

void dunedaq::Configuration::get ( const std::string & class_name,
const std::string & id,
ConfigObject & object,
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = 0 )

Get object by class name and object id (multi-thread safe).

The method searches an object with given id within the class and all derived subclasses.

Parameters
class_namename of the class
idobject identity
objectreturned value in case of success
rleveloptional references level to optimize performance (defines how many objects referenced by given object have also to be read to the implementation cache)
rclassesoptional array of class names to optimize performance (defines which referenced objects have to be read to the implementation cache)
Exceptions
dunedaq::conffwk::NotFoundexception if there is no such object or dunedaq::conffwk::Generic in case of an error

Definition at line 235 of file Configuration.cpp.

240{
241 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
242 _get(class_name, id, object, rlevel, rclasses);
243}

◆ get() [5/7]

void dunedaq::Configuration::get ( const std::string & class_name,
std::vector< ConfigObject > & objects,
const std::string & query = "",
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = 0 )

Get all objects of class.

The method returns all objects of given class and objects of subclasses derived from it.

Parameters
class_namename of the class
objectsreturned value in case of success
queryoptional parameter defining selection criteria for objects of given class
rleveloptional references level to optimize performance (defines how many objects referenced by found objects have also to be read to the implementation cache)
rclassesoptional array of class names to optimize performance (defines which referenced objects have to be read to the implementation cache)
Exceptions
dunedaq::conffwk::NotFoundexception if there is no such class or dunedaq::conffwk::Generic in case of an error

Definition at line 262 of file Configuration.cpp.

267{
268 try {
269 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
270 m_impl->get(class_name, objects, query, rlevel, rclasses);
271 } catch (dunedaq::conffwk::Generic& ex) {
272 std::ostringstream text;
273 text << "failed to get objects of class \'" << class_name << '\'';
274 if (!query.empty()) {
275 text << " with query \'" << query << '\'';
276 }
277 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex);
278 }
279}

◆ get() [6/7]

template<class T>
const T * dunedaq::conffwk::Configuration::get ( const std::string & id,
bool init_children = false,
bool init = true,
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = 0 )
inline

Get object of given class by identity and instantiate the template parameter with it (multi-thread safe).

Such method to be used for user classes generated by the genconffwk utility.

Parameters
idobject identity
init_childrenif true, the referenced objects are initialized
initif true, the object's attributes and relationships are read
rleveloptional references level to optimize performance (defines how many objects referenced by given object have also to be read to the implementation cache)
rclassesoptional array of class names to optimize performance (defines which referenced objects have to be read to the implementation cache)
Returns
Return 0 if there is no object with such id or pointer to object otherwise.
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 745 of file Configuration.hpp.

750 {
751 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
752 return _get<T>(id, init_children, init, rlevel, rclasses);
753 }

◆ get() [7/7]

template<class T>
void dunedaq::conffwk::Configuration::get ( std::vector< const T * > & objects,
bool init_children = false,
bool init = true,
const std::string & query = "",
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = 0 )
inline

Get all objects of given class and instantiate a vector of the template parameters object with it (multi-thread safe).

Such method to be used for user classes generated by the genconffwk utility.

Parameters
objectsthe vector is filled by the method
init_childrenif true, the referenced objects are initialized
initif true, the object's attributes and relationships are read
queryoptional parameter defining selection criteria for objects of given class
rleveloptional references level to optimize performance (defines how many objects referenced by found objects have also to be read to the implementation cache)
rclassesoptional array of class names to optimize performance (defines which referenced objects have to be read to the implementation cache)
Exceptions
dunedaq::conffwk::Genericin case of a problem (e.g. no such class, plug-in specific problem)

Definition at line 796 of file Configuration.hpp.

802 {
803 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
804 _get<T>(objects, init_children, init, query, rlevel, rclasses);
805 }

◆ get_changes()

std::vector< dunedaq::conffwk::Version > dunedaq::Configuration::get_changes ( )

Get new conffwk versions.

Returns
repository changes: new versions created on remote origin after current HEAD version, or externally modified files
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 1128 of file Configuration.cpp.

1129{
1130 try {
1131 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
1132 return m_impl->get_changes();
1133 } catch (dunedaq::conffwk::Generic& ex) {
1134 throw dunedaq::conffwk::Generic(ERS_HERE, "failed to get new versions", ex);
1135 }
1136}
virtual std::vector< dunedaq::conffwk::Version > get_changes()=0
Get newly available versions.

◆ get_class_info()

const dunedaq::conffwk::class_t & dunedaq::Configuration::get_class_info ( const std::string & class_name,
bool direct_only = false )

The method provides access to description of class.

Parameters
class_namename of the class
direct_onlyif true is set explicitly, return descriptions of direct attributes, relationships, super- and subclasses; by default return all descriptions taking into account inheritance
Returns
Return pointer to class description object.
Exceptions
dunedaq::conffwk::NotFoundexception if there is no class with such name or dunedaq::conffwk::Generic in case of a problem

Definition at line 824 of file Configuration.cpp.

825{
826 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
827
828 return this->_get_class_info(class_name, direct_only);
829}

◆ get_class_list()

std::vector< std::string > dunedaq::Configuration::get_class_list ( ) const

Definition at line 1877 of file Configuration.cpp.

1878{
1879 std::vector<std::string> classes;
1880 for (const auto& it : this->superclasses()) {
1881 classes.push_back(*it.first);
1882 }
1883
1884 return classes;
1885}

◆ get_impl_name()

const std::string & dunedaq::conffwk::Configuration::get_impl_name ( ) const
inlinenoexcept

Get implementation plug-in name used to build conffwk object

Definition at line 268 of file Configuration.hpp.

268{ return m_impl_name; }

◆ get_impl_param()

const std::string & dunedaq::conffwk::Configuration::get_impl_param ( ) const
inlinenoexcept

Get implementation plug-in parameter used to build conffwk object

Definition at line 272 of file Configuration.hpp.

272{ return m_impl_param; }

◆ get_impl_spec()

const std::string & dunedaq::conffwk::Configuration::get_impl_spec ( ) const
inlinenoexcept

Get implementation plug-in and it's parameter used to build conffwk object

Definition at line 264 of file Configuration.hpp.

264{ return m_impl_spec; }

◆ get_includes()

void dunedaq::Configuration::get_includes ( const std::string & db_name,
std::list< std::string > & includes ) const

Get include files.

The method returns list of files included by given database.

Parameters
db_namename of database file
includesreturned list of include files
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 493 of file Configuration.cpp.

494{
495 if (m_impl == nullptr)
496 throw dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded");
497
498 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
499
500 try {
501 m_impl->get_includes(db_name, includes);
502 } catch (dunedaq::conffwk::Generic& ex) {
503 std::ostringstream text;
504 text << "failed to get includes of database \'" << db_name << '\'';
505 throw(dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex));
506 }
507}
virtual void get_includes(const std::string &db_name, std::list< std::string > &includes) const =0
Get included files.

◆ get_obj_pybind()

ConfigObject * dunedaq::Configuration::get_obj_pybind ( const std::string & class_name,
const std::string & id )

Definition at line 1906 of file Configuration.cpp.

1907{
1908 auto co = new ConfigObject;
1909 this->get(class_name, id, *co);
1910 if (co->is_null()) {
1911 delete co;
1912 co = nullptr;
1913 }
1914 return co;
1915}

◆ get_objs_pybind()

std::vector< ConfigObject > * dunedaq::Configuration::get_objs_pybind ( const std::string & class_name,
const std::string & query = "" )

Definition at line 1918 of file Configuration.cpp.

1919{
1920 auto objs = new std::vector<ConfigObject>;
1921 this->get(class_name, *objs, query);
1922 return objs;
1923}

◆ get_schema_path_pybind()

const std::string & dunedaq::Configuration::get_schema_path_pybind ( const std::string & class_name)
nodiscard

Definition at line 1978 of file Configuration.cpp.

1979{
1980 const dunedaq::conffwk::class_t& c = this->get_class_info(class_name, false);
1981 return c.p_schema_path;
1982}

◆ get_updated_dbs()

void dunedaq::Configuration::get_updated_dbs ( std::list< std::string > & dbs) const

Get list of updated files to be committed.

The method returns list of uncommitted database files.

Parameters
dbsreturned list of uncommitted database files
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 510 of file Configuration.cpp.

511{
512 if (m_impl == nullptr)
513 throw dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded");
514
515 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
516
517 try {
519 } catch (dunedaq::conffwk::Generic& ex) {
520 throw(dunedaq::conffwk::Generic(ERS_HERE, "get_updated_dbs failed", ex));
521 }
522}
virtual void get_updated_dbs(std::list< std::string > &dbs) const =0
Get uncommitted files.

◆ get_versions()

std::vector< dunedaq::conffwk::Version > dunedaq::Configuration::get_versions ( const std::string & since,
const std::string & until,
dunedaq::conffwk::Version::QueryType type = dunedaq::conffwk::Version::query_by_date,
bool skip_irrelevant = true )

Get repository versions in interval.

Access historical versions.

The date/time format has to be either a date in format "yyyy-mm-dd" or date-and-time in format "yyyy-mm-dd hh:mm:ss" (UTC).

Parameters
sincelimit the versions committed on-or-after the specified hash key, tag or date/time; if empty, start from earliest available
untillimit the versions committed on-or-before the specified hash key, tag or date/time; if empty, retrieve all versions until latest available
typedefine query type
skip_irrelevantif true, ignore changes not affecting loaded configuration
Returns
repository versions satisfying query
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 1139 of file Configuration.cpp.

1143{
1144 try {
1145 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
1146 return m_impl->get_versions(since, until, type, skip_irrelevant);
1147 } catch (dunedaq::conffwk::Generic& ex) {
1148 throw dunedaq::conffwk::Generic(ERS_HERE, "failed to get versions", ex);
1149 }
1150}
virtual std::vector< dunedaq::conffwk::Version > get_versions(const std::string &since, const std::string &until, dunedaq::conffwk::Version::QueryType type, bool skip_irrelevant)=0
Get archived versions.

◆ is_superclass_of() [1/2]

bool dunedaq::conffwk::Configuration::is_superclass_of ( const std::string & target,
const std::string & source )
noexcept

◆ is_superclass_of() [2/2]

bool dunedaq::conffwk::Configuration::is_superclass_of ( const std::string * target,
const std::string * source )
noexcept

◆ is_valid()

template<class T>
bool dunedaq::conffwk::Configuration::is_valid ( const T * object)
noexcept

Checks validity of pointer to an objects of given user class.

Check if the pointer to the object is a valid pointer in the cache. Dangling pointers to removed objects may appear after notification.

Returns
Return true if the pointer is valid and false otherwise.

Definition at line 276 of file Configuration.hxx.

277{
278 // std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
279
280 // auto j = m_cache_map.find(&T::s_class_name);
281
282 // if (j != m_cache_map.end())
283 // {
284 // Cache<T> *c = static_cast<Cache<T>*>(j->second);
285
286 // for (const auto& i : c->m_cache)
287 // {
288 // if (i->second == object)
289 // return true;
290 // }
291 // }
292
293 // return false;
294
295 return m_registry.is_valid(object);
296}
bool is_valid(const T *object) noexcept
Checks validity of pointer to an objects of given user class.

◆ is_writable()

bool dunedaq::Configuration::is_writable ( const std::string & db_name) const

Get write access status.

Check if given database file is writable by current user.

Parameters
db_namename of database
Returns
true, if database file is writable and false otherwise.
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 435 of file Configuration.cpp.

436{
437 if (m_impl == nullptr)
438 throw(dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded"));
439
440 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
441
442 try {
443 return m_impl->is_writable(db_name);
444 } catch (dunedaq::conffwk::Generic& ex) {
445 std::ostringstream text;
446 text << "failed to get write access status for database \'" << db_name << '\'';
447 throw(dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex));
448 }
449}
virtual bool is_writable(const std::string &db_name)=0
Return write access status.

◆ load()

void dunedaq::Configuration::load ( const std::string & db_name)

Load database according to the name. If name is empty, take it from TDAQ_DB_NAME and TDAQ_DB_DATA environment variables.

Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 305 of file Configuration.cpp.

306{
307 std::string name;
308
309 if (db_name.empty()) {
310 if (!m_impl_spec.empty() && !m_impl_param.empty()) {
311 name = m_impl_param;
312 } else {
313 const char* s = ::getenv("TDAQ_DB_NAME");
314 if (s == 0 || *s == 0)
315 s = ::getenv("TDAQ_DB_DATA");
316
317 if (s && *s) {
318 name = s;
319 } else {
320 throw(dunedaq::conffwk::Generic(ERS_HERE, "no database name was provided"));
321 }
322 }
323 } else {
324 name = db_name;
325 }
326
327 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
328
329 // call conffwk actions if any
330 {
331 std::lock_guard<std::mutex> scoped_lock(m_actn_mutex);
332 for (auto& i : m_actions) {
333 i->load();
334 }
335 }
336
337 if (m_impl) {
338 m_impl->open_db(name);
339 // m_impl->get_superclasses(p_superclasses);
340 // set_subclasses();
342 m_impl->set(this);
343
344 if (check_prefetch_needs()) {
346 }
347
348 TLOG_DEBUG(2) << "\n*** DUMP CONFIGURATION ***\n" << *this;
349 } else {
350 throw dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded");
351 }
352}
virtual void open_db(const std::string &db_name)=0
Open database implementation in accordance with given name.

◆ loaded()

bool dunedaq::Configuration::loaded ( ) const
noexcept

Check if database is correctly loaded.

Check state of the database after configuration object creation.

Returns
true if the database was successfully loaded and false otherwise.

Definition at line 299 of file Configuration.cpp.

300{
301 return (m_impl != nullptr) ? m_impl->loaded() : false;
302}
virtual bool loaded() const noexcept=0
Check if a database is loaded.

◆ mk_ref_by_ex_text()

std::string dunedaq::Configuration::mk_ref_by_ex_text ( const std::string & cname,
const std::string & rname,
const ConfigObject & obj )
staticprivatenoexcept

Helper method to prepare exception text when template referenced_by() method fails

Definition at line 1798 of file Configuration.cpp.

1799{
1800 std::ostringstream text;
1801 text << "failed to get objects of class \'" << cname << "\' referencing object \'" << obj << "\' via relationship \'"
1802 << rname << '\'';
1803 return text.str();
1804}

◆ mk_ref_ex_text()

std::string dunedaq::Configuration::mk_ref_ex_text ( const char * what,
const std::string & cname,
const std::string & rname,
const ConfigObject & obj )
staticprivatenoexcept

Helper method to prepare exception text when template ref() method fails

Definition at line 1786 of file Configuration.cpp.

1790{
1791 std::ostringstream text;
1792 text << "failed to get " << what << " of class \'" << cname << "\' via relationship \'" << rname << "\' of object \'"
1793 << obj << '\'';
1794 return text.str();
1795}

◆ operator=()

Configuration & dunedaq::conffwk::Configuration::operator= ( const Configuration & )
private

◆ prefetch_all_data()

void dunedaq::Configuration::prefetch_all_data ( )

Prefetch all data into client cache.

The method reads all objects defined in database into client cache.

Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 582 of file Configuration.cpp.

583{
584 std::lock_guard<std::mutex> scoped_lock1(m_tmpl_mutex); // always lock template objects mutex first
585 std::lock_guard<std::mutex> scoped_lock2(m_impl_mutex);
586
587 try {
589 } catch (dunedaq::conffwk::Generic& ex) {
590 throw(dunedaq::conffwk::Generic(ERS_HERE, "prefetch all data failed", ex));
591 }
592}

◆ print()

void dunedaq::Configuration::print ( std::ostream & s) const
noexcept

Prints out details of configuration object.

For the moment only inheritance hierarchy of configuration database is printed. In future it is planned to add more details, such as:

  • conffwk objects
  • status of template cache
  • profiling info

Definition at line 1688 of file Configuration.cpp.

1689{
1690 s << "Configuration object:\n Inheritance Hierarchy (class - all it's superclasses):\n";
1691
1692 for (const auto& i : p_superclasses) {
1693 s << " * \'" << *i.first << "\' - ";
1694 if (i.second.empty())
1695 s << "(null)";
1696 else
1697 for (auto j = i.second.begin(); j != i.second.end(); ++j) {
1698 if (j != i.second.begin())
1699 s << ", ";
1700 s << '\'' << **j << '\'';
1701 }
1702 s << std::endl;
1703 }
1704}
conffwk::fmap< conffwk::fset > p_superclasses

◆ print_profiling_info()

void dunedaq::Configuration::print_profiling_info ( )
noexcept

Print out profiling information.

The method prints out to the standard output stream profiling information of configuration object and it's implementation.

Definition at line 178 of file Configuration.cpp.

179{
180 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
181
182 std::cout << "Configuration profiler report:\n"
183 " number of created template objects: "
185 << "\n"
186 " number of read template objects: "
188 << "\n"
189 " number of cache hits: "
190 << p_number_of_cache_hits << std::endl;
191
192 // FIXME: re-implement for the dal registry
193 // const char * s = ::getenv("TDAQ_DUMP_CONFFWK_PROFILER_INFO");
194 // if (s && !strcmp(s, "DEBUG"))
195 // {
196 // std::cout << " Details of accessed objects:\n";
197
198 // for (auto & i : m_cache_map)
199 // {
200 // Cache<DalObject> *c = static_cast<Cache<DalObject>*>(i.second);
201 // std::cout << " *** " << c->m_cache.size() << " objects is class \'" << *i.first << "\' were accessed
202 // ***\n"; for (auto & j : c->m_cache)
203 // std::cout << " - object \'" << j.first << '\'' << std::endl;
204 // }
205 // }
206
207 if (m_impl) {
210 }
211}
virtual void print_profiling_info() noexcept=0
Print implementation specific profiling information.
void print_cache_info() noexcept
Print profiling information about objects in cache.

◆ ref() [1/2]

template<class T>
const T * dunedaq::conffwk::Configuration::ref ( ConfigObject & obj,
const std::string & name,
bool init = false )
inline

Get signle value of object's relation and instantiate result with it (multi-thread safe).

The method is used by the code generated by the genconffwk utility.

Parameters
objobject
namename of the relationship
initif true, the object and it's referenced objects are initialized
Returns
Return non-null pointer to object of user class in case if relationship with such name exists and it's value is set. Otherwise the method returns 0.
Exceptions
dunedaq::conffwk::Genericin case of a problem (e.g. no relationship with such name, plug-in specific problem)

Definition at line 865 of file Configuration.hpp.

866 {
867 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
868 return _ref<T>(obj, name, init);
869 }
const T * _ref(ConfigObject &obj, const std::string &name, bool read_children)
Multi-thread unsafe version of ref(ConfigObject&, const std::string&, bool); The method should not be...

◆ ref() [2/2]

template<class T>
void dunedaq::conffwk::Configuration::ref ( ConfigObject & obj,
const std::string & name,
std::vector< const T * > & objects,
bool init = false )
inline

Get multiple values of object's relation and instantiate result with them (multi-thread safe).

The method is used by the code generated by the genconffwk utility.

Parameters
objobject
namename of the relationship
objectsreturned value
initif true, the objects and their referenced objects are initialized
Exceptions
dunedaq::conffwk::Genericin case of a problem (e.g. no relationship with such name, plug-in specific problem)

Definition at line 886 of file Configuration.hpp.

887 {
888 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
889 _ref<T>(obj, name, objects, init);
890 }

◆ referenced_by() [1/2]

std::vector< const DalObject * > dunedaq::conffwk::Configuration::referenced_by ( const DalObject & obj,
const std::string & relationship_name = "*",
bool check_composite_only = true,
bool upcast_unregistered = true,
bool init = false,
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = nullptr )

Get DAL objects holding references on this object via given relationship (multi-thread safe).

The method returns vector of DalObject, which have references on given object via explicitly provided relationship name. If the relationship name is set to "*", then the method takes into account all relationships of all objects.

It is expected that the DAL for returned objects is generated and linked with user code. If this is not the case, then an exception will be thrown. The parameter upcast_unregistered allows to select one of the registered base classes instead. Note, this will be a random base class, not the closest based one.

The method is efficient only for composite relationships (i.e. when a parent has composite reference on this object). For generic relationships the method performs full scan of all database objects. It is not recommended at large scale to build complete graph of relations between all database object.

Parameters
objobject
relationship_namename of the relationship, via which the object is referenced
upcast_unregisteredif true, try to upcast objects of classes which DAL classes are not loaded; otherwise throw exception if such DAL class is not registered
check_composite_onlyonly returned composite parent objects
initif true, the returned objects and their referenced objects are initialized
rleveloptional references level to optimize performance (defines how many objects referenced by found objects have also to be read to the implementation cache)
rclassesoptional array of class names to optimize performance (defines which referenced objects have to be read to the implementation cache)
Returns
objects referencing given one
Exceptions
dunedaq::conffwk::Genericin case of an error

◆ referenced_by() [2/2]

template<class T, class V>
void dunedaq::conffwk::Configuration::referenced_by ( const T & obj,
std::vector< const V * > & objects,
const std::string & relationship_name = "*",
bool check_composite_only = true,
bool init = false,
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = nullptr )

Get template DAL objects holding references on this object via given relationship (multi-thread safe).

The method returns objects of class V, which have references on given object via explicitly provided relationship name. If the relationship name is set to "*", then the method takes into account all relationships of all objects. The method is efficient only for composite relationships (i.e. when a parent has composite reference on this object). For generic relationships the method performs full scan of all database objects. It is not recommended at large scale to build complete graph of relations between all database object.

Parameters
objobject
objectsreturned value
relationship_namename of the relationship, via which the object is referenced
check_composite_onlyonly returned composite parent objects
initif true, the returned objects and their referenced objects are initialized
rleveloptional references level to optimize performance (defines how many objects referenced by found objects have also to be read to the implementation cache)
rclassesoptional array of class names to optimize performance (defines which referenced objects have to be read to the implementation cache)
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 143 of file Configuration.hxx.

150{
151 std::vector<ConfigObject> objs;
152
153 results.clear();
154
155 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
156
157 try {
158 obj.p_obj.referenced_by(objs, relationship_name, check_composite_only, rlevel, rclasses);
159
160 for (auto& i : objs) {
161 if (try_cast(V::s_class_name, i.class_name()) == true) {
162 // if (const V * o = get_cache<V>()->get(*this, i, init, init))
163 if (const V* o = m_registry.get<V>(i, init, init)) {
164 results.push_back(o);
165 }
166 }
167 }
168 } catch (dunedaq::conffwk::Generic& ex) {
169 throw(dunedaq::conffwk::Generic(
170 ERS_HERE, mk_ref_by_ex_text(V::s_class_name, relationship_name, obj.p_obj).c_str(), ex));
171 }
172}
static std::string mk_ref_by_ex_text(const std::string &cname, const std::string &rname, const ConfigObject &obj) noexcept
bool try_cast(const std::string &target, const std::string &source) noexcept
Checks if cast from source class to target class is allowed.

◆ register_converter()

template<class T>
void dunedaq::conffwk::Configuration::register_converter ( AttributeConverter< T > * object)
noexcept

Register user function for attribute conversion.

The user can register several objects which are used for attribute values conversion. The attributes conversion type is defined by the template parameter, e.g. given object to be used for string attribute values conversion, another object to be used for short unsigned integers, etc. It is possible to define several converters for each type. There is no check that given object was already registered or not. It is registered several times, the conversion will be done several times.

Parameters
objectthe converter object

Definition at line 373 of file Configuration.hxx.

374{
375 std::lock_guard<std::mutex> scoped_lock(m_else_mutex);
376
377 std::list<AttributeConverterBase*>* c = m_convert_map[typeid(T).name()];
378 if (c == 0) {
379 c = m_convert_map[typeid(T).name()] = new std::list<AttributeConverterBase*>();
380 }
381
382 c->push_back(object);
383}

◆ relations_pybind()

std::unordered_map< std::string, std::unordered_map< std::string, std::string > > dunedaq::Configuration::relations_pybind ( const std::string & class_name,
bool all )

Definition at line 1926 of file Configuration.cpp.

1927{
1928
1929 std::unordered_map<std::string, std::unordered_map<std::string, std::string>> all_relationships_properties;
1930
1931 const dunedaq::conffwk::class_t& c = this->get_class_info(class_name, !all);
1932
1933 for (const auto& rp : c.p_relationships) {
1934 std::unordered_map<std::string, std::string> relationship_properties;
1935
1936 relationship_properties["type"] = rp.p_type;
1937 relationship_properties["description"] = rp.p_description;
1938 relationship_properties["multivalue"] =
1939 (rp.p_cardinality == dunedaq::conffwk::zero_or_many || rp.p_cardinality == dunedaq::conffwk::one_or_many)
1940 ? "True"
1941 : "False";
1942 relationship_properties["aggregation"] = rp.p_is_aggregation ? "True" : "False";
1943 relationship_properties["not-null"] =
1944 (rp.p_cardinality == dunedaq::conffwk::only_one || rp.p_cardinality == dunedaq::conffwk::one_or_many) ? "True"
1945 : "False";
1946
1947 all_relationships_properties[rp.p_name] = relationship_properties;
1948 }
1949
1950 return all_relationships_properties;
1951}

◆ remove_action()

void dunedaq::Configuration::remove_action ( ConfigAction * ac)

Remove global action performed by user code on db [un]load and updates.

Definition at line 68 of file Configuration.cpp.

69{
70 std::lock_guard<std::mutex> scoped_lock(m_actn_mutex);
71 m_actions.remove(ac);
72}

◆ remove_include()

void dunedaq::Configuration::remove_include ( const std::string & db_name,
const std::string & include )

Remove include file.

The method removes existing include file from the database.

Parameters
db_namename of database file from which the include to be removed
includefile to be removed from includes
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 472 of file Configuration.cpp.

473{
474 if (m_impl == nullptr)
475 throw dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded");
476
477 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
478 std::lock_guard<std::mutex> scoped_lock2(m_tmpl_mutex);
479
480 try {
481 m_impl->remove_include(db_name, include);
482 // m_impl->get_superclasses(p_superclasses);
483 // set_subclasses();
485 } catch (dunedaq::conffwk::Generic& ex) {
486 std::ostringstream text;
487 text << "failed to remove include \'" << include << "\' from database \'" << db_name << '\'';
488 throw(dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex));
489 }
490}
virtual void remove_include(const std::string &db_name, const std::string &include)=0
Remove include file.

◆ rename_object()

void dunedaq::Configuration::rename_object ( ConfigObject & obj,
const std::string & new_id )
private

Cache of template object of given type.

The class defines the cache of template objects of given type. The objects are stored in cache, where the key is object-ID and the value is a pointer on template object.

The access to cache and objects insertion are provided via two get() methods:

  • T * get(Configuration&, ConfigObject&, bool, bool) - get template object for given conffwk object
  • T * get(Configuration&, const std::string&, bool, bool, unsigned long, const std::vector<std::string> *) - get template object for given object ID

Definition at line 782 of file Configuration.cpp.

783{
784 std::lock_guard<std::mutex> scoped_impl_lock(m_tmpl_mutex); // always lock template objects mutex first
785 std::lock_guard<std::mutex> scoped_tmpl_lock(m_impl_mutex);
786
787 std::lock_guard<std::mutex> scoped_obj_lock(obj.m_impl->m_mutex);
788
789 const std::string old_id(obj.m_impl->m_id);
790
791 obj.m_impl->throw_if_deleted();
792 obj.m_impl->rename(new_id);
793 obj.m_impl->m_id = new_id;
794 m_impl->rename_impl_object(obj.m_impl->m_class_name, old_id, new_id);
795
796 TLOG_DEBUG(3) << " * call rename \'" << old_id << "\' to \'" << new_id << "\' in class \'" << obj.class_name()
797 << "\')";
798
799 m_registry._rename_object(obj.class_name(), old_id, new_id);
800
801 // conffwk::fmap<CacheBase*>::iterator j = m_cache_map.find(&obj.class_name());
802 // if (j != m_cache_map.end())
803 // j->second->m_functions.m_rename_object_fn(j->second, old_id, new_id);
804
805 // conffwk::fmap<conffwk::fset>::const_iterator sc = p_superclasses.find(&obj.class_name());
806
807 // if (sc != p_superclasses.end())
808 // for (conffwk::fset::const_iterator c = sc->second.begin(); c != sc->second.end(); ++c)
809 // {
810 // conffwk::fmap<CacheBase*>::iterator j = m_cache_map.find(*c);
811
812 // if (j != m_cache_map.end())
813 // j->second->m_functions.m_rename_object_fn(j->second, old_id, new_id);
814 // }
815}
void rename_impl_object(const std::string *class_name, const std::string &old_id, const std::string &new_id) noexcept
rename object in cache
void _rename_object(std::string class_name, std::string old_id, std::string new_id)
Rename object of given template class (multi-thread unsafe).

◆ reset_subscription()

void dunedaq::Configuration::reset_subscription ( )
private
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 1262 of file Configuration.cpp.

1263{
1264 // check that there is no at least one subscription
1265 // if NO, then unsubscribe
1266
1267 if (m_callbacks.empty()) {
1269 return;
1270 }
1271
1272 // prepare subscription criteria
1273
1275 std::set<std::string> class_subscriptions;
1276
1277 // among existing subscriptions find one who has all subscriptions
1278
1279 bool found_subscribe_all = false;
1280
1281 for (const auto& i : m_callbacks)
1282 if (i->m_criteria.get_classes_subscription().empty() && i->m_criteria.get_objects_subscription().empty()) {
1283 found_subscribe_all = true;
1284 break;
1285 }
1286
1287 if (found_subscribe_all == false) {
1288 // build list of all classes for which there is a subscription
1289 for (const auto& i : m_callbacks)
1290 for (const auto& j : i->m_criteria.get_classes_subscription())
1291 class_subscriptions.insert(j);
1292
1293 // build list of all objects for which there is a subscription (if there is no such class)
1294 for (const auto& i : m_callbacks)
1295 for (const auto& j : i->m_criteria.get_objects_subscription()) {
1296 const std::string& obj_class_name = j.first;
1297 if (class_subscriptions.find(obj_class_name) == class_subscriptions.end())
1298 for (const auto& k : j.second)
1299 obj_subscriptions[obj_class_name].insert(k);
1300 }
1301 }
1302
1303 m_impl->subscribe(class_subscriptions, obj_subscriptions, system_cb, system_pre_cb);
1304}
virtual void subscribe(const std::set< std::string > &class_names, const std::map< std::string, std::set< std::string > > &objs, notify cb, pre_notify pre_cb)=0
Subscribe on database changes.
virtual void unsubscribe()=0
Remove subscription on database changes.
std::map< std::string, std::set< std::string > > ObjectMap
The map stores full subsription information.
static void system_cb(std::vector< ConfigurationChange * > &, Configuration *) noexcept
System callback function invoked in case of modifications.
static void system_pre_cb(Configuration *) noexcept
System callback function invoked in case of pre-modifications.

◆ return_includes_pybind()

std::list< std::string > * dunedaq::Configuration::return_includes_pybind ( const std::string & db_name)

Definition at line 1954 of file Configuration.cpp.

1955{
1956 auto l = new std::list<std::string>;
1957 this->get_includes(db_name, *l);
1958 return l;
1959}
void get_includes(const std::string &db_name, std::list< std::string > &includes) const
Get include files.

◆ set_class_domain_map()

void dunedaq::Configuration::set_class_domain_map ( )
private

Definition at line 700 of file Configuration.cpp.

701{
702
703 p_class_domain_map.clear();
704
705 auto domains = this->find_class_domains();
706 for (size_t i(0); i < domains.size(); ++i) {
707 const auto& dom = domains[i];
708 for (const auto& class_name : dom) {
709 p_class_domain_map[&conffwk::DalFactory::instance().get_known_class_name_ref(class_name)] = i;
710 }
711 }
712}
std::deque< std::set< std::string > > find_class_domains()
conffwk::fmap< uint > p_class_domain_map

◆ set_commit_credentials()

void dunedaq::Configuration::set_commit_credentials ( const std::string & user,
const std::string & password )

Set commit credentials.

The method sets credentials used by commit method.

Parameters
useruser name
passworduser password
Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 525 of file Configuration.cpp.

526{
527 if (m_impl == nullptr)
528 throw dunedaq::conffwk::Generic(ERS_HERE, "no implementation loaded");
529
530 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
531
532 try {
533 m_impl->set_commit_credentials(user, password);
534 } catch (dunedaq::conffwk::Generic& ex) {
535 throw(dunedaq::conffwk::Generic(ERS_HERE, "set_commit_credentials failed", ex));
536 }
537}
virtual void set_commit_credentials(const std::string &user, const std::string &password)=0
Set commit credentials.

◆ set_subclasses()

void dunedaq::Configuration::set_subclasses ( )
privatenoexcept

Definition at line 628 of file Configuration.cpp.

629{
630 p_subclasses.clear();
631
632 for (const auto& i : p_superclasses)
633 for (const auto& j : i.second)
634 p_subclasses[j].insert(i.first);
635}
conffwk::fmap< conffwk::fset > p_subclasses

◆ subclasses()

const conffwk::fmap< conffwk::fset > & dunedaq::conffwk::Configuration::subclasses ( ) const
inline

Get names of subclasses for each class

Definition at line 1462 of file Configuration.hpp.

1462{ return p_subclasses; }

◆ subclasses_pybind()

std::vector< std::string > dunedaq::Configuration::subclasses_pybind ( const std::string & class_name,
bool all )

Definition at line 1962 of file Configuration.cpp.

1963{
1964
1965 const dunedaq::conffwk::class_t& c = this->get_class_info(class_name, !all);
1966 return c.p_subclasses;
1967}

◆ subscribe() [1/2]

CallbackId dunedaq::conffwk::Configuration::subscribe ( const ConfigurationSubscriptionCriteria & criteria,
notify user_cb,
void * user_param = nullptr )

Subscribe on configuration changes.

The method is used to make a subscription. The returned value is a subscription handler.

When subscribed changes occurred, the user callback function is invoked with changes description and parameter 'user_param' defined by user.

Parameters
criteriasubscription criteria
user_cbuser-defined callback function
user_paramoptional user-defined parameter
Returns
non-null value in case of success (the value to be used for unsubscribe() method).
Exceptions
dunedaq::conffwk::Genericin case of an error

◆ subscribe() [2/2]

CallbackId dunedaq::conffwk::Configuration::subscribe ( pre_notify user_cb,
void * user_param = nullptr )

Subscribe on pre-notification on configuration changes.

The method is used to make complimentary subscription on pre-notification about changes, that can only be used together with real subscription on changes, i.e. using subscribe(const ConfigurationSubscriptionCriteria&, notify, void *) method.

When subscribed changes occurred, but before they are going to be applied, the user callback function is invoked with parameter 'user_param' defined by user. This subscription can be used to be informed, that some changes are took place already and will be applied immediately after user's code exits given callback function.

Parameters
user_cbuser-defined callback function
user_paramoptional user-defined parameter
Returns
non-null value in case of success (the value to be used for unsubscribe() method).
Exceptions
dunedaq::conffwk::Genericin case of an error

◆ superclasses()

const conffwk::fmap< conffwk::fset > & dunedaq::conffwk::Configuration::superclasses ( ) const
inlinenoexcept

Get names of superclasses for each class

Definition at line 1458 of file Configuration.hpp.

1458{ return p_superclasses; }

◆ superclasses_pybind()

std::vector< std::string > dunedaq::Configuration::superclasses_pybind ( const std::string & class_name,
bool all )

Definition at line 1970 of file Configuration.cpp.

1971{
1972
1973 const dunedaq::conffwk::class_t& c = this->get_class_info(class_name, !all);
1974 return c.p_superclasses;
1975}

◆ system_cb()

void dunedaq::Configuration::system_cb ( std::vector< ConfigurationChange * > & changes,
Configuration * conf )
staticnoexcept

System callback function invoked in case of modifications.

It is used by the database implementation. Only is called, when a user subscription to related class is set.

Definition at line 1457 of file Configuration.cpp.

1458{
1459
1460 TLOG_DEBUG(3) << "*** Enter Configuration::system_cb()\n"
1461 "*** Number of user subscriptions: "
1462 << conf->m_callbacks.size();
1463
1464 // call conffwk actions if any
1465 {
1466 std::lock_guard<std::mutex> scoped_lock(conf->m_impl_mutex);
1467 std::lock_guard<std::mutex> scoped_lock2(conf->m_actn_mutex);
1468 for (auto& i : conf->m_actions)
1469 i->notify(changes);
1470 }
1471
1472 // update template objects in cache
1473 {
1474 std::lock_guard<std::mutex> scoped_lock(conf->m_tmpl_mutex); // always lock template objects mutex first
1475 std::lock_guard<std::mutex> scoped_lock2(conf->m_impl_mutex);
1476 conf->update_cache(changes);
1477 }
1478
1479 // user removed all subscriptions
1480 if (conf->m_callbacks.empty())
1481 return;
1482
1483 // note, one cannot lock m_tmpl_mutex or m_impl_mutex here,
1484 // since user callback may call arbitrary get() methods to access conffwk
1485 // and template objects locking above two mutexes
1486 std::lock_guard<std::mutex> scoped_lock(conf->m_else_mutex);
1487
1488 // check if there is only one subscription
1489 if (conf->m_callbacks.size() == 1) {
1490 auto j = *conf->m_callbacks.begin();
1491 (*(j->m_cb))(changes, j->m_param);
1492 }
1493 // may need to calculate the changes for each subscription
1494 else {
1495 for (const auto& j : conf->m_callbacks) {
1496
1497 if (ers::debug_level() >= 3) {
1498 std::ostringstream text;
1499
1500 text << "*** Process subscription " << (void*)j
1501 << "\n"
1502 " class subscription done for "
1503 << j->m_criteria.get_classes_subscription().size() << " classes:\n";
1504
1505 for (const auto& i1 : j->m_criteria.get_classes_subscription())
1506 text << " * class \"" << i1 << "\"\n";
1507
1508 text << " object subscription done in " << j->m_criteria.get_objects_subscription().size() << " classes:\n";
1509
1510 for (const auto& i2 : j->m_criteria.get_objects_subscription()) {
1511 text << " * class \"" << (i2.first) << "\":\n";
1512 for (const auto& i3 : i2.second)
1513 text << " - \"" << i3 << "\"\n";
1514 }
1515
1516 TLOG_DEBUG(3) << text.str();
1517 }
1518
1519 if (j->m_criteria.get_classes_subscription().empty() && j->m_criteria.get_objects_subscription().empty()) {
1520 try {
1521 TLOG_DEBUG(3) << "*** Invoke callback " << (void*)j << " with\n" << changes;
1522 (*(j->m_cb))(changes, j->m_param);
1523 } catch (const ers::Issue& ex) {
1524 ers::error(dunedaq::conffwk::Generic(ERS_HERE, "user callback thrown ers exception", ex));
1525 } catch (const std::exception& ex) {
1526 ers::error(dunedaq::conffwk::Generic(ERS_HERE, "user callback thrown std exception", ex));
1527 } catch (...) {
1528 ers::error(dunedaq::conffwk::Generic(ERS_HERE, "user callback thrown unknown exception"));
1529 }
1530 } else {
1531 std::vector<ConfigurationChange*> changes1;
1532
1533 for (const auto& i : changes) {
1534 const std::string& cname = i->get_class_name();
1535 ConfigurationChange* class_changes = nullptr;
1536
1537 ConfigurationSubscriptionCriteria::ObjectMap::const_iterator p =
1538 j->m_criteria.get_objects_subscription().find(cname);
1539 const bool found_obj_subscription(p != j->m_criteria.get_objects_subscription().end());
1540 const bool found_class_subscription(j->m_criteria.get_classes_subscription().find(cname) !=
1541 j->m_criteria.get_classes_subscription().end());
1542
1543 if (found_class_subscription || found_obj_subscription)
1544 class_changes = new ConfigurationChange(cname);
1545
1546 if (found_class_subscription) {
1547 for (const auto& k : i->m_modified)
1548 class_changes->m_modified.push_back(k);
1549
1550 for (const auto& k : i->m_created)
1551 class_changes->m_created.push_back(k);
1552
1553 for (const auto& k : i->m_removed)
1554 class_changes->m_removed.push_back(k);
1555 }
1556
1557 if (found_obj_subscription) {
1558 for (const auto& obj_id : i->m_modified)
1559 if (p->second.find(obj_id) != p->second.end())
1560 class_changes->m_modified.push_back(obj_id);
1561
1562 for (const auto& obj_id : i->m_removed)
1563 if (p->second.find(obj_id) != p->second.end())
1564 class_changes->m_removed.push_back(obj_id);
1565 }
1566
1567 // the changes for given class can be empty if there is subscription on objects of given class, but no such
1568 // objects were modified
1569 if (class_changes) {
1570 if (class_changes->m_modified.empty() && class_changes->m_created.empty() &&
1571 class_changes->m_removed.empty())
1572 delete class_changes;
1573 else
1574 changes1.push_back(class_changes);
1575 }
1576 }
1577
1578 if (!changes1.empty()) {
1579 TLOG_DEBUG(3) << "*** Invoke callback " << (void*)j << " with\n" << changes1;
1580
1581 try {
1582 (*(j->m_cb))(changes1, j->m_param);
1583 } catch (const ers::Issue& ex) {
1584 ers::error(dunedaq::conffwk::Generic(ERS_HERE, "user callback thrown ers exception", ex));
1585 } catch (const std::exception& ex) {
1586 ers::error(dunedaq::conffwk::Generic(ERS_HERE, "user callback thrown std exception", ex));
1587 } catch (...) {
1588 ers::error(dunedaq::conffwk::Generic(ERS_HERE, "user callback thrown unknown exception"));
1589 }
1590
1591 for (const auto& i : changes1)
1592 delete i;
1593 }
1594 }
1595 }
1596 }
1597
1598 TLOG_DEBUG(3) << "*** Leave Configuration::system_cb()";
1599}
ConfigurationChange(const ConfigurationChange &)
int debug_level()
Definition ers.hpp:80

◆ system_pre_cb()

void dunedaq::Configuration::system_pre_cb ( Configuration * conf)
staticnoexcept

System callback function invoked in case of pre-modifications.

It is used by the database implementation. Only is called, when a user subscription is set.

Definition at line 1602 of file Configuration.cpp.

1603{
1604 TLOG_DEBUG(3) << "*** Enter Configuration::system_pre_cb()";
1605
1606 std::lock_guard<std::mutex> scoped_lock(conf->m_else_mutex);
1607
1608 for (auto& j : conf->m_pre_callbacks) {
1609 TLOG_DEBUG(3) << "*** Invoke callback " << (void*)(j);
1610 (*(j->m_cb))(j->m_param);
1611 }
1612
1613 TLOG_DEBUG(3) << "*** Leave Configuration::system_pre_cb()";
1614}

◆ test_object()

bool dunedaq::Configuration::test_object ( const std::string & class_name,
const std::string & id,
unsigned long rlevel = 0,
const std::vector< std::string > * rclasses = 0 )

Test the object existence.

The method searches an object with given id within the class and all derived subclasses. If found, the method returns true, otherwise the method return false.

Parameters
class_namename of the class
idobject identity
rleveloptional references level to optimize performance (defines how many objects referenced by given object have also to be read to the implementation cache)
rclassesoptional array of class names to optimize performance (defines which referenced objects have to be read to the implementation cache)
Exceptions
dunedaq::conffwk::Genericif there is no such class or in case of an error

Definition at line 723 of file Configuration.cpp.

727{
728 try {
729 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
730 return m_impl->test_object(class_name, id, rlevel, rclasses);
731 } catch (dunedaq::conffwk::Generic& ex) {
732 std::ostringstream text;
733 text << "failed to test existence of object \'" << id << '@' << class_name << '\'';
734 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str(), ex);
735 }
736}
virtual bool test_object(const std::string &class_name, const std::string &id, unsigned long rlevel, const std::vector< std::string > *rclasses)=0
Test object existence (used by Python binding).

◆ try_cast() [1/2]

bool dunedaq::Configuration::try_cast ( const std::string & target,
const std::string & source )
noexcept

Checks if cast from source class to target class is allowed.

Parameters
targetname of desired class (e.g. try to cast object of "source" class to this "target" one)
sourcename of casted object class
Returns
Return true if the cast is allowed by database schema

Definition at line 1707 of file Configuration.cpp.

1708{
1709 return is_superclass_of(target, source);
1710}
bool is_superclass_of(const std::string &target, const std::string &source) noexcept

◆ try_cast() [2/2]

bool dunedaq::Configuration::try_cast ( const std::string * target,
const std::string * source )
noexcept

Definition at line 1713 of file Configuration.cpp.

1714{
1715 return is_superclass_of(target, source);
1716}

◆ unload()

void dunedaq::Configuration::unload ( )

Unload database.

The database should be previously loaded. The method destroys all user objects from cache (i.e. created via conffwk and template get methods) and frees all DB resources allocated by the implementation plug-in.

Exceptions
dunedaq::conffwk::Genericin case of an error

Definition at line 355 of file Configuration.cpp.

356{
357 if (m_impl == nullptr)
358 throw dunedaq::conffwk::Generic(ERS_HERE, "nothing to unload");
359
360 std::lock_guard<std::mutex> scoped_lock1(m_tmpl_mutex); // always lock template objects mutex first
361 std::lock_guard<std::mutex> scoped_lock2(m_impl_mutex);
362
363 // call conffwk actions if any
364 {
365 std::lock_guard<std::mutex> scoped_lock(m_actn_mutex);
366 for (auto& i : m_actions) {
367 i->unload();
368 }
369 }
370
371 // for (auto& i : m_cache_map) {
372 // delete i.second;
373 // }
374
375 // m_cache_map.clear();
377
378 {
379 std::lock_guard<std::mutex> scoped_lock3(m_else_mutex);
380
381 for (auto& cb : m_callbacks)
382 delete cb;
383
384 for (auto& cb : m_pre_callbacks)
385 delete cb;
386
387 m_callbacks.clear();
388 m_pre_callbacks.clear();
389
391
392 for (auto& l : m_convert_map) {
393 for (auto& a : *l.second)
394 delete a;
395
396 delete l.second;
397 }
398
399 m_convert_map.clear();
400 }
401
402 p_superclasses.clear();
403
404 for (auto& j : p_direct_classes_desc_cache)
405 delete j.second;
406
407 for (auto& j : p_all_classes_desc_cache)
408 delete j.second;
409
412
413 m_impl->close_db();
414}
virtual void close_db()=0
Close database implementation.
void clear()
Clear the content of the registy.

◆ unread_all_objects()

void dunedaq::Configuration::unread_all_objects ( bool unread_implementation_objs = false)
noexcept

Unread all template (i.e. set their state as uninitialized) and implementation objects (i.e. clear their cache).

Unread template objects result changing their state to uninitialized. They will be re-initialized, when accessed by user code. This feature is used by attribute converter methods using unread_all_objects().

Unread implementation objects result removing any information from implementation cache, e.g. clear any object attributes data read from server. One may use the unread_all_objects() to re-read database after reload.

Parameters
unread_implementation_objsif true, clear implementation objects; otherwise only template objects are unread and the implementation conffwk objects are still valid.

Definition at line 595 of file Configuration.cpp.

596{
597 if (unread_implementation_objs)
599
601}
void unread_template_objects() noexcept
Unread all template (i.e. set their state as uninitialized) objects.
void unread_implementation_objects(dunedaq::conffwk::ObjectState state) noexcept
Unread implementation objects (i.e. clear their cache).

◆ unread_implementation_objects()

void dunedaq::conffwk::Configuration::unread_implementation_objects ( dunedaq::conffwk::ObjectState state)
inlinenoexcept

Unread implementation objects (i.e. clear their cache).

This results removing any information from implementation cache, e.g. clear any object attributes data read from server.

Parameters
stateset state of implementation objects after unread; is set to "Unknown" after abort()

Definition at line 527 of file Configuration.hpp.

528 {
529 std::lock_guard<std::mutex> scoped_lock(m_impl_mutex);
531 }

◆ unread_template_objects()

void dunedaq::conffwk::Configuration::unread_template_objects ( )
inlinenoexcept

Unread all template (i.e. set their state as uninitialized) objects.

Unread template objects result changing their state to uninitialized. They will be re-initialized, when accessed by user code. This feature is used by attribute converter methods using unread_all_objects().

Definition at line 512 of file Configuration.hpp.

513 {
514 std::lock_guard<std::mutex> scoped_lock(m_tmpl_mutex);
516 }

◆ unsubscribe()

void dunedaq::Configuration::unsubscribe ( CallbackId cb_handler = 0)

Remove callback function.

Remove callback function previously added by the subscribe() methods. If the parameter is a non-null value, it must be equal to id returned by the add_callback() method. Otherwise the method stops all subscription.

Exceptions
dunedaq::conffwk::Genericin case of an error (e.g. bad ID, plugin-specific problems)

Definition at line 1224 of file Configuration.cpp.

1225{
1226 std::lock_guard<std::mutex> scoped_lock(m_else_mutex);
1227
1228 if (id) {
1229 CallbackSet::iterator i = m_callbacks.find(id);
1230 PreCallbackSet::iterator j = m_pre_callbacks.find(reinterpret_cast<CallbackPreSubscription*>(id));
1231
1232 if (i != m_callbacks.end()) {
1233 delete id;
1234 m_callbacks.erase(i);
1235 } else if (j != m_pre_callbacks.end()) {
1236 delete reinterpret_cast<CallbackPreSubscription*>(id);
1237 m_pre_callbacks.erase(j);
1238 } else {
1239 std::ostringstream text;
1240 text << "unsubscription failed for CallbackId = " << (void*)id << " (no such callback id found)";
1241 throw(dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str()));
1242 }
1243 } else {
1244 for (auto& i : m_callbacks)
1245 delete i;
1246
1247 for (auto& i : m_pre_callbacks)
1248 delete i;
1249
1250 m_callbacks.clear();
1251 m_pre_callbacks.clear();
1252 }
1253
1254 try {
1256 } catch (dunedaq::conffwk::Generic& ex) {
1257 throw dunedaq::conffwk::Generic(ERS_HERE, "unsubscription failed", ex);
1258 }
1259}

◆ update()

template<class T>
void dunedaq::conffwk::Configuration::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.

Only is called, when a user subscription to related class is set. It is used by automatically generated data access libraries.

Parameters
modifiedvector of modified objects of given user class (objects to be re-read in cache)
removedvector of removed objects of given user class (objects to be removed from cache)
createdvector of created objects of given user class (objects to be reset in cache, if they were removed)

Definition at line 300 of file Configuration.hxx.

303{
304 // auto j = m_cache_map.find(&T::s_class_name);
305
306 // TLOG_DEBUG(4) << "call for class \'" << T::s_class_name << '\'';
307
308 // if (j != m_cache_map.end())
309 // {
310 // Cache<T> *c = static_cast<Cache<T>*>(j->second);
311 // set_cache_unread(removed, *c);
312 // set_cache_unread(created, *c);
313 // set_cache_unread(modified, *c);
314 // }
315 m_registry.update<T>(modified, removed, created);
316}
void update(const std::vector< std::string > &modified, const std::vector< std::string > &removed, const std::vector< std::string > &created)
Update cache of objects in case of modification.

◆ update_cache()

void dunedaq::Configuration::update_cache ( std::vector< ConfigurationChange * > & changes)
noexcept

System function invoked in case of modifications.

It is used by the database implementation. Update cache of template DB objects.

Definition at line 1370 of file Configuration.cpp.

1371{
1372 TLOG_DEBUG(3) << "*** Enter Configuration::update_cache() with changes:\n" << changes;
1373
1374 // Remove deleted and update modified implementation objects first
1375 for (const auto& i : changes) {
1376 const std::string* class_name = &DalFactory::instance().get_known_class_name_ref(i->get_class_name());
1377
1378 update_impl_objects(m_impl->m_impl_objects, *i, class_name);
1379
1380 // delete/update implementation objects defined in superclasses
1381 conffwk::fmap<conffwk::fset>::const_iterator sc = p_superclasses.find(class_name);
1382
1383 if (sc != p_superclasses.end())
1384 for (const auto& c : sc->second)
1386
1387 // delete/update implementation objects defined in subclasses
1388 sc = p_subclasses.find(class_name);
1389
1390 if (sc != p_subclasses.end())
1391 for (const auto& c : sc->second)
1393 }
1394
1395 for (const auto& i : changes) {
1396
1397 m_registry.update(i->get_class_name(), i->get_modified_objs(), i->get_removed_objs(), i->get_created_objs());
1398
1399 // const std::string * class_name = &DalFactory::instance().get_known_class_name_ref(i->get_class_name()); // FIXME:
1400 // optimise with above
1401
1402 // // invoke configuration update if there are template objects of given class
1403
1404 // {
1405 // conffwk::fmap<CacheBase*>::iterator j = m_cache_map.find(class_name);
1406
1407 // if (j != m_cache_map.end())
1408 // {
1409 // TLOG_DEBUG(3) << " * call update on \'" << j->first << "\' template objects";
1410 // j->second->m_functions.m_update_fn(*this, i);
1411 // }
1412 // }
1413
1414 // // invoke configuration update if there are template objects in super-classes
1415
1416 // {
1417 // conffwk::fmap<conffwk::fset>::const_iterator sc = p_superclasses.find(class_name);
1418
1419 // if (sc != p_superclasses.end())
1420 // {
1421 // for (const auto& c : sc->second)
1422 // {
1423 // conffwk::fmap<CacheBase*>::iterator j = m_cache_map.find(c);
1424
1425 // if (j != m_cache_map.end())
1426 // {
1427 // TLOG_DEBUG(3) << " * call update on \'" << j->first << "\' template objects (as super-class of
1428 // \'" << *class_name << "\')"; j->second->m_functions.m_update_fn(*this, i);
1429 // }
1430 // }
1431 // }
1432 // }
1433
1434 // // invoke configuration update if there are template objects in sub-classes
1435
1436 // {
1437 // conffwk::fmap<conffwk::fset>::const_iterator sc = p_subclasses.find(class_name);
1438
1439 // if (sc != p_subclasses.end())
1440 // {
1441 // for (const auto& c : sc->second)
1442 // {
1443 // conffwk::fmap<CacheBase*>::iterator j = m_cache_map.find(c);
1444
1445 // if (j != m_cache_map.end())
1446 // {
1447 // TLOG_DEBUG(3) << " * call update on \'" << j->first << "\' template objects (as sub-class of \'"
1448 // << *class_name << "\')"; j->second->m_functions.m_update_fn(*this, i);
1449 // }
1450 // }
1451 // }
1452 // }
1453 }
1454}
static void update_impl_objects(conffwk::pmap< conffwk::map< ConfigObjectImpl * > * > &cache, ConfigurationChange &change, const std::string *class_name)

◆ update_classes()

void dunedaq::Configuration::update_classes ( )
privatenoexcept

Definition at line 638 of file Configuration.cpp.

639{
641 this->set_subclasses();
642 this->set_class_domain_map();
644}
virtual void get_superclasses(conffwk::fmap< conffwk::fset > &schema)=0
Get inheritance hierarchy.
void update_class_maps()
Update the internal class domains map.

◆ update_impl_objects()

void dunedaq::Configuration::update_impl_objects ( conffwk::pmap< conffwk::map< ConfigObjectImpl * > * > & cache,
ConfigurationChange & change,
const std::string * class_name )
staticprivate

Definition at line 1307 of file Configuration.cpp.

1310{
1311 if (change.get_removed_objs().empty() == false) {
1312 conffwk::pmap<conffwk::map<ConfigObjectImpl*>*>::iterator i = cache.find(class_name);
1313
1314 if (i != cache.end()) {
1315 for (auto& x : change.get_removed_objs()) {
1316 conffwk::map<ConfigObjectImpl*>::iterator j = i->second->find(x);
1317 if (j != i->second->end()) {
1318 TLOG_DEBUG(2) << "set implementation object " << x << '@' << *class_name << " [" << (void*)j->second
1319 << "] deleted";
1320
1321 std::lock_guard<std::mutex> scoped_lock(j->second->m_mutex);
1322 j->second->m_state = dunedaq::conffwk::Deleted;
1323 j->second->clear();
1324 }
1325 }
1326 }
1327 }
1328
1329 if (change.get_created_objs().empty() == false) {
1330 conffwk::pmap<conffwk::map<ConfigObjectImpl*>*>::iterator i = cache.find(class_name);
1331
1332 if (i != cache.end()) {
1333 for (auto& x : change.get_created_objs()) {
1334 conffwk::map<ConfigObjectImpl*>::iterator j = i->second->find(x);
1335 if (j != i->second->end()) {
1336 TLOG_DEBUG(2) << "re-set created implementation object " << x << '@' << *class_name << " ["
1337 << (void*)j->second << ']';
1338
1339 std::lock_guard<std::mutex> scoped_lock(j->second->m_mutex);
1340 j->second->reset(); // it does not matter what the state was, always reset
1341 }
1342 }
1343 }
1344 }
1345
1346 if (change.get_modified_objs().empty() == false) {
1347 conffwk::pmap<conffwk::map<ConfigObjectImpl*>*>::iterator i = cache.find(class_name);
1348
1349 if (i != cache.end()) {
1350 for (auto& x : change.get_modified_objs()) {
1351 conffwk::map<ConfigObjectImpl*>::iterator j = i->second->find(x);
1352 if (j != i->second->end()) {
1353 TLOG_DEBUG(2) << "clear implementation object " << x << '@' << *class_name << " [" << (void*)j->second << ']';
1354
1355 std::lock_guard<std::mutex> scoped_lock(j->second->m_mutex);
1356
1357 if (j->second->m_state != dunedaq::conffwk::Valid)
1358 j->second->reset();
1359 else
1360 j->second->clear();
1361 }
1362 }
1363 }
1364 }
1365}

◆ ConfigObject

friend class ConfigObject
friend

Definition at line 237 of file Configuration.hpp.

◆ ConfigurationImpl

friend class ConfigurationImpl
friend

Definition at line 238 of file Configuration.hpp.

◆ DalObject

DalObject
friend

Definition at line 236 of file Configuration.hpp.

◆ DalRegistry

friend class DalRegistry
friend

Definition at line 241 of file Configuration.hpp.

Member Data Documentation

◆ m_actions

std::list<ConfigAction*> dunedaq::conffwk::Configuration::m_actions
private

Definition at line 1697 of file Configuration.hpp.

◆ m_actn_mutex

std::mutex dunedaq::conffwk::Configuration::m_actn_mutex
mutableprivate

Definition at line 1705 of file Configuration.hpp.

◆ m_callbacks

CallbackSet dunedaq::conffwk::Configuration::m_callbacks
private

Definition at line 1682 of file Configuration.hpp.

◆ m_convert_map

conffwk::map<std::list<AttributeConverterBase*>*> dunedaq::conffwk::Configuration::m_convert_map
private

Definition at line 1467 of file Configuration.hpp.

◆ m_else_mutex

std::mutex dunedaq::conffwk::Configuration::m_else_mutex
mutableprivate

Definition at line 1706 of file Configuration.hpp.

◆ m_impl

ConfigurationImpl* dunedaq::conffwk::Configuration::m_impl
private

Definition at line 1667 of file Configuration.hpp.

◆ m_impl_mutex

std::mutex dunedaq::conffwk::Configuration::m_impl_mutex
mutableprivate

Definition at line 1703 of file Configuration.hpp.

◆ m_impl_name

std::string dunedaq::conffwk::Configuration::m_impl_name
private

Definition at line 1669 of file Configuration.hpp.

◆ m_impl_param

std::string dunedaq::conffwk::Configuration::m_impl_param
private

Definition at line 1670 of file Configuration.hpp.

◆ m_impl_spec

std::string dunedaq::conffwk::Configuration::m_impl_spec
private

Definition at line 1668 of file Configuration.hpp.

◆ m_pre_callbacks

PreCallbackSet dunedaq::conffwk::Configuration::m_pre_callbacks
private

Definition at line 1683 of file Configuration.hpp.

◆ m_registry

DalRegistry dunedaq::conffwk::Configuration::m_registry
private

Definition at line 1701 of file Configuration.hpp.

◆ m_shlib_h

void* dunedaq::conffwk::Configuration::m_shlib_h
private

Definition at line 1672 of file Configuration.hpp.

◆ m_tmpl_mutex

std::mutex dunedaq::conffwk::Configuration::m_tmpl_mutex
mutableprivate

Definition at line 1704 of file Configuration.hpp.

◆ p_all_classes_desc_cache

conffwk::map<dunedaq::conffwk::class_t*> dunedaq::conffwk::Configuration::p_all_classes_desc_cache
private

Definition at line 1314 of file Configuration.hpp.

◆ p_class_domain_map

conffwk::fmap<uint> dunedaq::conffwk::Configuration::p_class_domain_map
private

Definition at line 1445 of file Configuration.hpp.

◆ p_direct_classes_desc_cache

conffwk::map<dunedaq::conffwk::class_t*> dunedaq::conffwk::Configuration::p_direct_classes_desc_cache
private

Definition at line 1313 of file Configuration.hpp.

◆ p_number_of_cache_hits

std::atomic<uint_least64_t> dunedaq::conffwk::Configuration::p_number_of_cache_hits
private

Definition at line 1438 of file Configuration.hpp.

◆ p_number_of_template_object_created

std::atomic<uint_least64_t> dunedaq::conffwk::Configuration::p_number_of_template_object_created
private

Definition at line 1439 of file Configuration.hpp.

◆ p_number_of_template_object_read

std::atomic<uint_least64_t> dunedaq::conffwk::Configuration::p_number_of_template_object_read
private

Definition at line 1440 of file Configuration.hpp.

◆ p_subclasses

conffwk::fmap<conffwk::fset> dunedaq::conffwk::Configuration::p_subclasses
private

Definition at line 1444 of file Configuration.hpp.

◆ p_superclasses

conffwk::fmap<conffwk::fset> dunedaq::conffwk::Configuration::p_superclasses
private

Definition at line 1443 of file Configuration.hpp.


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