DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
model_common_interface.hpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3// Fork baseline commit: dbe-02-12-17 (2022-05-12).
4// Renamed since fork: yes (from dbe/model_common_interface.h to include/dbe/model_common_interface.hpp).
5
6/*
7 * model_common_interface.h
8 *
9 * Created on: Nov 16, 2015
10 * Author: lgeorgop
11 */
12
13#ifndef DBE_MODEL_COMMON_INTERFACE_H_
14#define DBE_MODEL_COMMON_INTERFACE_H_
15
17#include "dbe/confaccessor.hpp"
18
19#include <QModelIndex>
20#include <QString>
21#include <QUuid>
22
23#include <set>
24#include <vector>
25
26#define MODEL_COMMON_INTERFACE_UUID_DEF QUuid const uuid;
27#define MODEL_COMMON_INTERFACE_UUID_DECL uuid(QUuid::createUuid())
28
29#define MODEL_COMMON_TYPES_TOPLEVEL_DEFINITIONS \
30 typedef QModelIndex type_index; \
31 typedef std::vector<type_index> type_indices; \
32 typedef dbe::tref type_object_ref; \
33 typedef dbe::dref type_object_info; \
34 typedef dunedaq::conffwk::class_t type_class_info;
35
36namespace dbe {
37//------------------------------------------------------------------------------------------
38
40{
42
43public:
44 virtual ~model_common_slots() = default;
45
46private:
47 // These methods should be placed in slots declaration such that they can be parsed
48 // appropriately to create slots at each derived class
57 virtual void slot_remove_object(QString const&, dref const&) = 0;
58
68 virtual void slot_rename_object(QString const&, dref const&) = 0;
69
79 virtual void slot_update_object(QString const&, dref const&) = 0;
80
90 virtual void slot_create_object(QString const&, dref const&) = 0;
91};
92//------------------------------------------------------------------------------------------
93
94//------------------------------------------------------------------------------------------
96{
98public:
99 virtual type_object_ref getobject(type_index const& index) const = 0;
100
101 virtual type_class_info getclass(type_index const& index) const = 0;
102
103 virtual QAbstractItemModel* ReturnSourceModel() const = 0;
104
106};
107//------------------------------------------------------------------------------------------
108
109//------------------------------------------------------------------------------------------
111{
113
114public:
116 //-------------------------- FORWARD CHAIN ------------------------------------------------------------------------
117 // Front end functionality permits explicit actions on the objects linked to this model
118 // These methods should provoke actions onto the database itself
125 virtual bool delete_objects(type_indices::iterator, type_indices::iterator) = 0;
126 virtual bool update_objects(type_indices::iterator, type_indices::iterator) = 0;
127 virtual bool create_objects(type_indices::iterator, type_indices::iterator) = 0;
128};
129//------------------------------------------------------------------------------------------
130
131//------------------------------------------------------------------------------------------
138 , private model_common_slots
139{
141
142 friend class model_common_slots;
143
144public:
145 virtual ~model_common_interface() = default;
146
147protected:
153 virtual void remove_deleted_object(type_index const& index) = 0;
154
162 virtual void rename_contained_object(type_index const& index, type_object_info const& obj) = 0;
163
171 virtual void update_contained_object(type_index const& index, type_object_info const& obj) = 0;
179 virtual void create_contained_object(type_index const& index, type_object_info const& obj) = 0;
180
187 virtual type_index lookup(type_object_info const&) = 0;
188
189 QUuid getuuid() const;
190};
191//------------------------------------------------------------------------------------------
192
193//------------------------------------------------------------------------------------------
202template<typename T>
204{
206
207public:
215 bool delete_objects(type_indices::iterator, type_indices::iterator) override;
216
223 bool update_objects(type_indices::iterator, type_indices::iterator) override;
224
231 bool create_objects(type_indices::iterator, type_indices::iterator) override;
232
233 // private:
234 // FOR FUTURE USE
235 // static std::vector<type_object_info> filter_indices(type_indices::iterator,
236 // type_indices::iterator);
237};
238//------------------------------------------------------------------------------------------
239
240//------------------------------------------------------------------------------------------
253template<typename T>
255{
256public:
258
260
267
268protected:
269 //-------------------------- BACK CHAIN
270 //-------------------------------------------------------------------------------
271 // Back end functionality that permits to implicitly act on an object referenced in this model
272 // These methods should NOT take action onto the database but only on the referenced model
273
279 void remove_object(type_object_info const&);
280 void create_object(type_object_info const&);
281 void rename_object(type_object_info const&);
282 void update_object(type_object_info const&);
283 void update_multiple_objects(std::vector<type_object_info> const&);
284
286};
287//------------------------------------------------------------------------------------------
288
289} // namespace dbe
290
293
294#endif /* DBE_MODEL_COMMON_INTERFACE_H_ */
void update_multiple_objects(std::vector< type_object_info > const &)
void remove_object(type_object_info const &)
void rename_object(type_object_info const &)
void update_object(type_object_info const &)
MODEL_COMMON_TYPES_TOPLEVEL_DEFINITIONS model_common_async_operations()
void create_object(type_object_info const &)
bool create_objects(type_indices::iterator, type_indices::iterator) override
bool delete_objects(type_indices::iterator, type_indices::iterator) override
bool update_objects(type_indices::iterator, type_indices::iterator) override
virtual void remove_deleted_object(type_index const &index)=0
virtual void rename_contained_object(type_index const &index, type_object_info const &obj)=0
virtual type_index lookup(type_object_info const &)=0
virtual void update_contained_object(type_index const &index, type_object_info const &obj)=0
virtual ~model_common_interface()=default
virtual void create_contained_object(type_index const &index, type_object_info const &obj)=0
virtual void slot_rename_object(QString const &, dref const &)=0
virtual void slot_update_object(QString const &, dref const &)=0
virtual ~model_common_slots()=default
virtual void slot_remove_object(QString const &, dref const &)=0
virtual void slot_create_object(QString const &, dref const &)=0
virtual bool delete_objects(type_indices::iterator, type_indices::iterator)=0
virtual bool create_objects(type_indices::iterator, type_indices::iterator)=0
virtual ~model_initiate_actions_interface()=default
virtual bool update_objects(type_indices::iterator, type_indices::iterator)=0
#define MODEL_COMMON_TYPES_TOPLEVEL_DEFINITIONS
#define MODEL_COMMON_INTERFACE_UUID_DEF
Include QT Headers.
config_object_description dref
virtual ~model_common_data_access_interface()=default
virtual type_class_info getclass(type_index const &index) const =0
virtual type_object_ref getobject(type_index const &index) const =0
virtual QAbstractItemModel * ReturnSourceModel() const =0