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