DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::actions::object::create Class Reference

#include <Command.hpp>

Inheritance diagram for dbe::actions::object::create:
[legend]
Collaboration diagram for dbe::actions::object::create:
[legend]

Public Member Functions

 create (dbe::t_config_object_preimage const &img, QUuid const &src=0, QUndoCommand *parent=0)
void undo ()
void redo ()
Public Member Functions inherited from dbe::actions::state
bool isvalid () const
void toggle ()
void failed () const
void setundoable (bool s=true) const
void setredoable (bool s=true) const
bool undoable () const
bool redoable () const
void reload () const
QUuid const & source () const

Private Attributes

dbe::t_config_object_preimage this_object_key

Additional Inherited Members

Protected Member Functions inherited from dbe::actions::state
 state (QUndoCommand *parent=nullptr, QUuid const &uuid=0)

Detailed Description

Definition at line 90 of file Command.hpp.

Constructor & Destructor Documentation

◆ create()

dbe::actions::object::create::create ( dbe::t_config_object_preimage const & img,
QUuid const & src = 0,
QUndoCommand * parent = 0 )

Definition at line 218 of file Command.cpp.

220 : state ( parent, src ),
221 this_object_key ( img )
222{
223 setText (
224 QObject::tr ( "Creation of : Object %2@%1 " ).arg ( this_object_key.ref.this_class.c_str() )
225 .arg ( this_object_key.ref.this_name.c_str() ) );
226}
dbe::t_config_object_preimage this_object_key
Definition Command.hpp:100
state(QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:525

Member Function Documentation

◆ redo()

void dbe::actions::object::create::redo ( )

Definition at line 257 of file Command.cpp.

258{
259 try
260 {
261 if ( redoable() )
262 {
263 failed();
266 source().toString(), inner::dbcontroller::get ( this_object_key.ref ) );
267 toggle();
268 }
269 }
270 catch ( dunedaq::conffwk::Exception const & e )
271 {
272 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
273 }
274}
#define ERS_HERE
void failed() const
Definition Command.cpp:541
bool redoable() const
Definition Command.cpp:568
QUuid const & source() const
Definition Command.cpp:573
void force_emit_object_created(QString const &, dref const)
static confaccessor & ref()
static configobject::tref get(dbe::cokey const &desc)
static configobject::tref create_object_request(dbe::t_config_object_preimage const &rep)
std::string const parse(ers::Issue const &)

◆ undo()

void dbe::actions::object::create::undo ( )

Definition at line 228 of file Command.cpp.

229{
230 try
231 {
232 if ( undoable() )
233 {
234 failed();
235 // notify for the objects that have been actually removed
237 [&] ( dref const obj )
238 {
239 confaccessor::ref().force_emit_object_deleted ( source().toString(), obj );
240 };
241
243 inner::dbcontroller::get ( this_object_key.ref ), deletion );
244 toggle();
245 }
246 }
247 catch ( dunedaq::conffwk::Exception const & e )
248 {
249 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
250 }
251 catch ( daq::dbe::config_object_retrieval_result_is_null const & e )
252 {
253 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, e );
254 }
255}
bool undoable() const
Definition Command.cpp:563
void force_emit_object_deleted(QString const &, dref const)
static configobject::gref< T > delete_object_request(configobject::tref const &obj)
config_object_description dref

Member Data Documentation

◆ this_object_key

dbe::t_config_object_preimage dbe::actions::object::create::this_object_key
private

Definition at line 100 of file Command.hpp.


The documentation for this class was generated from the following files: