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 {
25namespace actions {
31class state : public QUndoCommand
32{
33private:
34 QUuid const uuid;
35 mutable bool rewind;
36 mutable bool forward;
37 mutable bool invalid;
38
39 bool canRedo() const;
40
41 bool canUndo() const;
42
43protected:
44 state(QUndoCommand* parent = nullptr, QUuid const& uuid = 0);
45
46public:
47 bool isvalid() const;
48
49 void toggle();
50
51 void failed() const;
52 void setundoable(bool s = true) const;
53 void setredoable(bool s = true) const;
54
55 bool undoable() const;
56
57 bool redoable() const;
58
59 void reload() const;
60
61 QUuid const& source() const;
62};
63//------------------------------------------------------------------------------------------
64
65//------------------------------------------------------------------------------------------
69class onobject : public state
70{
71public:
72 onobject(tref obj, QUndoCommand* parent = nullptr, QUuid const& uuid = 0);
73
74protected:
75 tref checkedref() const;
76
77private:
79};
80//------------------------------------------------------------------------------------------
81
82namespace object {
83
84//------------------------------------------------------------------------------------------
85class create : public state
86{
87public:
88 create(dbe::t_config_object_preimage const& img, QUuid const& src = 0, QUndoCommand* parent = 0);
89
90 void undo();
91 void redo();
92
93private:
95};
96//------------------------------------------------------------------------------------------
97
98//------------------------------------------------------------------------------------------
99class remove : public onobject
100{
101public:
102 remove(tref item, QUuid const& uuid = 0, QUndoCommand* parent = 0);
103 ~remove();
104 void redo();
105 void undo();
106
107private:
109};
110//------------------------------------------------------------------------------------------
111
112//------------------------------------------------------------------------------------------
113class rename : public onobject
114{
115public:
116 rename(tref object, std::string const& Id, QUuid const& src = 0, QUndoCommand* parent = nullptr);
117 void redo();
118 void undo();
119
120private:
121 std::string oldname;
122 std::string newname;
123};
124//------------------------------------------------------------------------------------------
125
126//------------------------------------------------------------------------------------------
127class changerefs : public onobject
128{
129public:
130 changerefs(tref object,
131 dunedaq::conffwk::relationship_t const& relation,
132 std::vector<std::string> const& object_names_tolink,
133 QUuid const& src = 0,
134 QUndoCommand* Parent = nullptr);
135 void redo();
136 void undo();
137
138private:
140 std::vector<tref> this_current_neighbors;
141 std::vector<tref> this_target_neighbors;
142};
143//------------------------------------------------------------------------------------------
144
145//------------------------------------------------------------------------------------------
146class move : public onobject
147{
148public:
149 move(tref ObjectChanged, std::string const& File, QUuid const& src = 0, QUndoCommand* parent = nullptr);
150 ~move();
151 void redo();
152 void undo();
153
154private:
155 std::string source_file;
156 std::string destination_file;
157};
158//------------------------------------------------------------------------------------------
159} // end namespace object
160
161namespace file {
162/*
163 * This namespace handles operations related to files , but not those of object in files
164 */
165//------------------------------------------------------------------------------------------
166class add : public state
167{
168public:
169 add(std::string const& db_file, std::string const& include_file, QUuid const& src = 0, QUndoCommand* parent = 0);
170 void redo();
171 void undo();
172
173private:
174 std::string m_db_file;
175 std::string m_include_file;
176};
177//------------------------------------------------------------------------------------------
178
179//------------------------------------------------------------------------------------------
180class remove : public state
181{
182public:
183 remove(std::string& db_file, std::string& include_file, QUuid const& src = 0, QUndoCommand* parent = 0);
184 void redo();
185 void undo();
186
187private:
188 std::string m_db_file;
189 std::string m_include_file;
190};
191//------------------------------------------------------------------------------------------
192} // end namespace file
193
194} // end namespace actions
195} // end namespace dbe
196#endif // COMMAND_H
add(std::string const &db_file, std::string const &include_file, QUuid const &src=0, QUndoCommand *parent=0)
Definition Command.cpp:93
std::string m_include_file
Definition Command.hpp:175
remove(std::string &db_file, std::string &include_file, QUuid const &src=0, QUndoCommand *parent=0)
Definition Command.cpp:139
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:141
std::vector< tref > this_current_neighbors
Definition Command.hpp:140
dunedaq::conffwk::relationship_t this_relation
Definition Command.hpp:139
create(dbe::t_config_object_preimage const &img, QUuid const &src=0, QUndoCommand *parent=0)
Definition Command.cpp:182
dbe::t_config_object_preimage this_object_key
Definition Command.hpp:94
move(tref ObjectChanged, std::string const &File, QUuid const &src=0, QUndoCommand *parent=nullptr)
Definition Command.cpp:350
remove(tref item, QUuid const &uuid=0, QUndoCommand *parent=0)
Definition Command.cpp:230
rename(tref object, std::string const &Id, QUuid const &src=0, QUndoCommand *parent=nullptr)
Definition Command.cpp:285
tref checkedref() const
Definition Command.cpp:412
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:403
void setundoable(bool s=true) const
Definition Command.cpp:451
bool canRedo() const
Definition Command.cpp:481
void reload() const
Definition Command.cpp:493
bool undoable() const
Definition Command.cpp:463
bool canUndo() const
Definition Command.cpp:487
bool isvalid() const
Definition Command.cpp:445
void setredoable(bool s=true) const
Definition Command.cpp:457
void failed() const
Definition Command.cpp:437
bool redoable() const
Definition Command.cpp:469
state(QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:419
QUuid const & source() const
Definition Command.cpp:475
QUuid const uuid
Definition Command.hpp:34
Include QT Headers.
inner::configobject::tref tref
Definition tref.hpp:36
config_object_preimage< std::string > t_config_object_preimage
inner::configobject::gref< config_object_aggregates< std::string > > gref
Definition tref.hpp:39
config_object_description dref