DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Command.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/Command.h to include/dbe/Command.hpp).
5
6#ifndef COMMAND_H
7#define COMMAND_H
8
9#include "dbe/Conversion.hpp"
10#include "dbe/Exceptions.hpp"
11#include "dbe/confaccessor.hpp"
15
16#include "dbe/dbcontroller.hpp"
17
19#include "conffwk/Schema.hpp"
20
21#include <QUndoCommand>
22#include <QUuid>
23
24namespace dbe
25{
26namespace actions
27{
33class state:
34 public QUndoCommand
35{
36private:
37 QUuid const uuid;
38 mutable bool rewind;
39 mutable bool forward;
40 mutable bool invalid;
41
42 bool canRedo() const;
43
44 bool canUndo() const;
45
46protected:
47 state ( QUndoCommand * parent = nullptr, QUuid const & uuid = 0 );
48
49public:
50 bool isvalid() const;
51
52 void toggle();
53
54 void failed() const;
55 void setundoable ( bool s = true ) const;
56 void setredoable ( bool s = true ) const;
57
58 bool undoable() const;
59
60 bool redoable() const;
61
62 void reload() const;
63
64 QUuid const & source() const;
65};
66//------------------------------------------------------------------------------------------
67
68//------------------------------------------------------------------------------------------
73 public state
74{
75public:
76 onobject ( tref obj, QUndoCommand * parent = nullptr, QUuid const & uuid = 0 );
77
78protected:
79 tref checkedref() const;
80
81private:
83};
84//------------------------------------------------------------------------------------------
85
86namespace object
87{
88
89//------------------------------------------------------------------------------------------
90class create:
91 public state
92{
93public:
94 create ( dbe::t_config_object_preimage const & img, QUuid const & src = 0,
95 QUndoCommand * parent = 0 );
96
97 void undo();
98 void redo();
99private:
101};
102//------------------------------------------------------------------------------------------
103
104//------------------------------------------------------------------------------------------
105class remove:
106 public onobject
107{
108public:
109 remove ( tref item, QUuid const & uuid = 0, QUndoCommand * parent = 0 );
110 ~remove();
111 void redo();
112 void undo();
113
114private:
116};
117//------------------------------------------------------------------------------------------
118
119//------------------------------------------------------------------------------------------
120class rename:
121 public onobject
122{
123public:
124 rename ( tref object, std::string const & Id, QUuid const & src = 0,
125 QUndoCommand * parent = nullptr );
126 void redo();
127 void undo();
128private:
129 std::string oldname;
130 std::string newname;
131};
132//------------------------------------------------------------------------------------------
133
134//------------------------------------------------------------------------------------------
136 public onobject
137{
138public:
139 changerefs ( tref object, dunedaq::conffwk::relationship_t const & relation,
140 std::vector<std::string> const & object_names_tolink, QUuid const & src = 0,
141 QUndoCommand * Parent = nullptr );
142 void redo();
143 void undo();
144private:
146 std::vector<tref> this_current_neighbors;
147 std::vector<tref> this_target_neighbors;
148};
149//------------------------------------------------------------------------------------------
150
151//------------------------------------------------------------------------------------------
152class move:
153 public onobject
154{
155public:
156 move ( tref ObjectChanged, std::string const & File, QUuid const & src = 0,
157 QUndoCommand * parent = nullptr );
158 ~move();
159 void redo();
160 void undo();
161private:
162 std::string source_file;
163 std::string destination_file;
164};
165//------------------------------------------------------------------------------------------
166}// end namespace object
167
168namespace file
169{
170/*
171 * This namespace handles operations related to files , but not those of object in files
172 */
173//------------------------------------------------------------------------------------------
174class add:
175 public state
176{
177public:
178 add ( std::string const & db_file, std::string const & include_file, QUuid const & src = 0,
179 QUndoCommand * parent = 0 );
180 void redo();
181 void undo();
182private:
183 std::string m_db_file;
184 std::string m_include_file;
185};
186//------------------------------------------------------------------------------------------
187
188//------------------------------------------------------------------------------------------
189class remove:
190 public state
191{
192public:
193 remove ( std::string & db_file, std::string & include_file, QUuid const & src = 0,
194 QUndoCommand * parent = 0 );
195 void redo();
196 void undo();
197private:
198 std::string m_db_file;
199 std::string m_include_file;
200};
201//------------------------------------------------------------------------------------------
202}// end namespace file
203
204} //end namespace actions
205} // end namespace dbe
206#endif // COMMAND_H
add(std::string const &db_file, std::string const &include_file, QUuid const &src=0, QUndoCommand *parent=0)
Definition Command.cpp:118
std::string m_include_file
Definition Command.hpp:184
remove(std::string &db_file, std::string &include_file, QUuid const &src=0, QUndoCommand *parent=0)
Definition Command.cpp:170
changerefs(tref object, dunedaq::conffwk::relationship_t const &relation, std::vector< std::string > const &object_names_tolink, QUuid const &src=0, QUndoCommand *Parent=nullptr)
Definition Command.cpp:22
std::vector< tref > this_target_neighbors
Definition Command.hpp:147
std::vector< tref > this_current_neighbors
Definition Command.hpp:146
dunedaq::conffwk::relationship_t this_relation
Definition Command.hpp:145
create(dbe::t_config_object_preimage const &img, QUuid const &src=0, QUndoCommand *parent=0)
Definition Command.cpp:218
dbe::t_config_object_preimage this_object_key
Definition Command.hpp:100
move(tref ObjectChanged, std::string const &File, QUuid const &src=0, QUndoCommand *parent=nullptr)
Definition Command.cpp:439
remove(tref item, QUuid const &uuid=0, QUndoCommand *parent=0)
Definition Command.cpp:278
rename(tref object, std::string const &Id, QUuid const &src=0, QUndoCommand *parent=nullptr)
Definition Command.cpp:353
tref checkedref() const
Definition Command.cpp:518
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:510
void setundoable(bool s=true) const
Definition Command.cpp:553
bool canRedo() const
Definition Command.cpp:578
void reload() const
Definition Command.cpp:588
bool undoable() const
Definition Command.cpp:563
bool canUndo() const
Definition Command.cpp:583
bool isvalid() const
Definition Command.cpp:548
void setredoable(bool s=true) const
Definition Command.cpp:558
void failed() const
Definition Command.cpp:541
bool redoable() const
Definition Command.cpp:568
state(QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:525
QUuid const & source() const
Definition Command.cpp:573
QUuid const uuid
Definition Command.hpp:37
Include QT Headers.
inner::configobject::tref tref
Definition tref.hpp:35
config_object_preimage< std::string > t_config_object_preimage
inner::configobject::gref< config_object_aggregates< std::string > > gref
Definition tref.hpp:38
config_object_description dref