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/map.hpp"
5#include "conffwk/Errors.hpp"
6
7namespace dunedaq {
8namespace conffwk {
9
10class DalObject;
11class Configuration;
12
13
20
21 friend class DalObject;
22
23struct DalDomain {
24 mutable std::mutex mutex; // mutex used to access template objects (i.e. generated DAL
26};
27
28public:
36
38 const Configuration& configuration() const { return m_confdb; }
39
44 void clear();
45
46 DalObject* get(ConfigObject& obj, bool upcast_unregistered=false);
47 std::vector<const DalObject*> get(std::vector<ConfigObject>& objs, bool upcast_unregistered=false);
48
69 template<class T>
70 T * get(ConfigObject& obj, bool init_children=false, bool init_object=true);
71
72
93 template<class T>
94 T * get(const std::string& name, bool init_children=false, bool init_object=true, unsigned long rlevel = 0, const std::vector<std::string> * rclasses = nullptr);
95
96
111 template<class T>
112 T * find(const std::string & id);
113
122 template<class T>
123 bool is_valid(const T * object) noexcept;
124
135 template<class T>
136 void update(const std::vector<std::string>& modified,
137 const std::vector<std::string>& removed,
138 const std::vector<std::string>& created);
139
140 void update(const std::string& class_name,
141 const std::vector<std::string>& modified,
142 const std::vector<std::string>& removed,
143 const std::vector<std::string>& created);
144
150 void unread_all();
151
168 template<class T>
169 const T* _ref(ConfigObject& obj, const std::string& name, bool read_children);
170
183 template<class T>
184 void _ref(ConfigObject& obj, const std::string& name, std::vector<const T*>& results, bool read_children);
185
191 template<class T>
192 void _reset_objects();
193
205 void _rename_object(std::string class_name, std::string old_id, std::string new_id);
206
213 }
214
215
216private:
217
219
220 mutable std::mutex m_mutex; // mutex used to access template objects (i.e. generated DAL)
221
223
225
226 std::unordered_map<uint,DalDomain> m_cache_domains;
227
228};
229
230} // namespace conffwk
231} // namespace dunedaq
232
233#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:45
DalRegistry: A registry of DalObjects It provides a single interface to create, cache and manage DalO...
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.
std::unordered_map< uint, DalDomain > m_cache_domains
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
bool is_valid(const T *object) noexcept
Checks validity of pointer to an objects of given user class.
Including Qt Headers.
conffwk::map< DalObject * > cache
Factory couldn t find
Definition Issues.hpp:24