DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
DalRegistry.hpp
Go to the documentation of this file.
1#ifndef __DUNEDAQ_CONFFWK_DALREGISTRY_HPP__
2#define __DUNEDAQ_CONFFWK_DALREGISTRY_HPP__
3
4#include "conffwk/Errors.hpp"
5#include "conffwk/map.hpp"
6
7namespace dunedaq {
8namespace conffwk {
9
10class DalObject;
11class Configuration;
12
19{
20
21 friend class DalObject;
22
23 struct DalDomain
24 {
25 mutable std::mutex mutex; // mutex used to access template objects (i.e. generated DAL
27 };
28
29public:
37
39 const Configuration& configuration() const { return m_confdb; }
40
45 void clear();
46
47 DalObject* get(ConfigObject& obj, bool upcast_unregistered = false);
48 std::vector<const DalObject*> get(std::vector<ConfigObject>& objs, bool upcast_unregistered = false);
49
72 template<class T>
73 T* get(ConfigObject& obj, bool init_children = false, bool init_object = true);
74
99 template<class T>
100 T* get(const std::string& name,
101 bool init_children = false,
102 bool init_object = true,
103 unsigned long rlevel = 0,
104 const std::vector<std::string>* rclasses = nullptr);
105
120 template<class T>
121 T* find(const std::string& id);
122
131 template<class T>
132 bool is_valid(const T* object) noexcept;
133
145 template<class T>
146 void update(const std::vector<std::string>& modified,
147 const std::vector<std::string>& removed,
148 const std::vector<std::string>& created);
149
150 void update(const std::string& class_name,
151 const std::vector<std::string>& modified,
152 const std::vector<std::string>& removed,
153 const std::vector<std::string>& created);
154
160 void unread_all();
161
178
179 template<class T>
180 const T* _ref(ConfigObject& obj, const std::string& name, bool read_children);
181
195 template<class T>
196 void _ref(ConfigObject& obj, const std::string& name, std::vector<const T*>& results, bool read_children);
197
203 template<class T>
204 void _reset_objects();
205
217 void _rename_object(std::string class_name, std::string old_id, std::string new_id);
218
224
225private:
227
228 mutable std::mutex m_mutex; // mutex used to access template objects (i.e. generated DAL)
229
231
233
234 std::unordered_map<uint, DalDomain> m_cache_domains;
235};
236
237} // namespace conffwk
238} // namespace dunedaq
239
240#endif /* __DUNEDAQ_CONFFWK_DALREGISTRY_HPP__ */
Represents database objects.
Defines base class for cache of template objects.
The base class for any generated DAL object.
Definition DalObject.hpp:51
DalObject * get(ConfigObject &obj, bool upcast_unregistered=false)
Configuration & configuration()
void _reset_objects()
Update state of objects after abort operations.
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.
const Configuration & configuration() const
void _rename_object(std::string class_name, std::string old_id, std::string new_id)
Rename object of given template class (multi-thread unsafe).
void clear()
Clear the content of the registy.
DalRegistry(Configuration &confdb)
Construct a new Dal Registry object.
void unread_all()
Set the status of all objects in cache to unread.
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).
void update_class_maps()
Update the internal class domains map.
conffwk::fmap< uint > m_class_domain_map
std::unordered_map< uint, DalDomain > m_cache_domains
bool is_valid(const T *object) noexcept
Checks validity of pointer to an objects of given user class.
The DUNE-DAQ namespace.
msgpack::object obj
conffwk::map< DalObject * > cache
Factory couldn t find
Definition Issues.hpp:24