DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dbe
include
dbe
model_common_interface_macros.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_macros.h to include/dbe/model_common_interface_macros.hpp).
5
6
/*
7
* model_common_interface_macros.h
8
*
9
* Created on: Dec 7, 2015
10
* Author: lgeorgop
11
*/
12
13
#ifndef DBE_MODEL_COMMON_INTERFACE_MACROS_H_
14
#define DBE_MODEL_COMMON_INTERFACE_MACROS_H_
15
16
#include "
dbe/model_common_interface.hpp
"
17
18
//------------------------------------------------------------------------------------------
19
#define MODEL_COMMON_INTERFACE_TYPES(classname) \
20
\
21
typedef model_common_async_operations<classname>::type_index type_index; \
22
typedef model_common_async_operations<classname>::type_indices type_indices; \
23
typedef model_common_async_operations<classname>::type_object_ref type_object_ref; \
24
typedef model_common_async_operations<classname>::type_class_info type_class_info; \
25
typedef model_common_async_operations<classname>::type_object_info type_object_info; \
26
\
27
//------------------------------------------------------------------------------------------
28
29
//------------------------------------------------------------------------------------------
30
#define MODEL_COMMON_IMPL_REQ_DEF(classname) \
31
\
32
friend class model_common_async_operations<classname>; \
33
friend class model_common_impl<classname>; \
34
\
35
public: \
36
QModelIndex lookup(dbe::dref const&) override; \
37
\
38
MODEL_COMMON_INTERFACE_TYPES(classname) \
39
\
40
type_object_ref getobject(type_index const& index) const override; \
41
type_class_info getclass(const QModelIndex& index) const override; \
42
QAbstractItemModel* ReturnSourceModel() const override; \
43
\
44
private: \
45
void remove_deleted_object(type_index const& index) override; \
46
void create_contained_object(type_index const& index, type_object_info const& obj) override; \
47
void rename_contained_object(type_index const& index, type_object_info const& obj) override; \
48
void update_contained_object(type_index const& index, type_object_info const& obj) override; \
49
\
50
bool removeRows(int row, int count, type_index const& parent) override; \
51
\
52
//------------------------------------------------------------------------------------------
53
54
//------------------------------------------------------------------------------------------
55
#define MODEL_COMMON_INTERFACE_REQ_DEF(classname) \
56
\
57
MODEL_COMMON_IMPL_REQ_DEF(classname) \
58
\
59
public: \
60
bool delete_objects(type_indices::iterator, type_indices::iterator) override; \
61
bool create_objects(type_indices::iterator, type_indices::iterator) override; \
62
bool update_objects(type_indices::iterator, type_indices::iterator) override; \
63
\
64
private:
65
66
//------------------------------------------------------------------------------------------
67
68
//------------------------------------------------------------------------------------------
69
#define MODEL_REMOVE_ROWS_DEF(classname) bool classname::removeRows(int row, int count, type_index const& parent)
70
//------------------------------------------------------------------------------------------
71
72
//------------------------------------------------------------------------------------------
73
#define MODEL_DELETE_OBJECTS_DEF(classname) \
74
bool classname::delete_objects(type_indices::iterator b, type_indices::iterator e)
75
76
#define MODEL_CREATE_OBJECTS_DEF(classname) \
77
bool classname::create_objects(type_indices::iterator b, type_indices::iterator e)
78
79
#define MODEL_UPDATE_OBJECTS_DEF(classname) \
80
bool classname::update_objects(type_indices::iterator b, type_indices::iterator e)
81
82
#define MODEL_RENAME_OBJECTS_DEF(classname) \
83
bool classname::rename_objects( \
84
type_indices::iterator b, \
85
type_indices::iterator \
86
e)
//------------------------------------------------------------------------------------------
87
88
//------------------------------------------------------------------------------------------
89
/*
90
* Below are macros that facilitate to define the methods required by model interface
91
*/
92
98
#define MODEL_COMMON_INTERFACE_LOOKUP_IMPL(classname) QModelIndex classname::lookup(type_object_info const& obj)
99
104
#define MODEL_COMMON_INTERFACE_DELETE_THAT_OBJ_IMPL(classname) \
105
void classname::remove_deleted_object(type_index const& index)
106
111
#define MODEL_COMMON_INTERFACE_CREATE_THAT_OBJ_IMPL(classname) \
112
void classname::create_contained_object(type_index const& index, type_object_info const& obj)
113
118
#define MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL(classname) \
119
void classname::rename_contained_object(type_index const& index, type_object_info const& obj)
120
125
#define MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL(classname) \
126
void classname::update_contained_object(type_index const& index, type_object_info const& obj)
127
128
//------------------------------------------------------------------------------------------
129
130
//------------------------------------------------------------------------------------------
131
// INCLUDE this macro in the derived class source file
132
//
133
// Slots need be defined in the header file of the derived class directly for Qt
134
// to be aware and generate the code needed , this forces the definition in the source file
135
// of the derived class for the slots, which can be uniformly achieved with this macro.
136
#define MODEL_COMMON_INTERFACE_SLOTS_DEF(classname) \
137
void classname::slot_remove_object(QString const& src, type_object_info const& obj) \
138
{ \
139
if (uuid.toString() != src) { \
140
remove_object(obj); \
141
} \
142
} \
143
\
144
void classname::slot_update_object(QString const& src, type_object_info const& obj) \
145
{ \
146
if (uuid.toString() != src) { \
147
update_object(obj); \
148
} \
149
} \
150
\
151
void classname::slot_rename_object(QString const& src, type_object_info const& obj) \
152
{ \
153
if (uuid.toString() != src) { \
154
rename_object(obj); \
155
} \
156
} \
157
\
158
void classname::slot_create_object(QString const& src, type_object_info const& obj) \
159
{ \
160
if (uuid.toString() != src) { \
161
create_object(obj); \
162
} \
163
}
164
165
//------------------------------------------------------------------------------------------
166
167
#endif
/* DBE_MODEL_COMMON_INTERFACE_MACROS_H_ */
model_common_interface.hpp
Generated on
for DUNE-DAQ by
1.18.0