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 85 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 213 of file Command.cpp.

215 : state ( parent, src ),
216 this_object_key ( img )
217{
218 setText (
219 QObject::tr ( "Creation of : Object %2@%1 " ).arg ( this_object_key.ref.this_class.c_str() )
220 .arg ( this_object_key.ref.this_name.c_str() ) );
221}
dbe::t_config_object_preimage this_object_key
Definition Command.hpp:95
state(QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:520

Member Function Documentation

◆ redo()

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

Definition at line 252 of file Command.cpp.

253{
254 try
255 {
256 if ( redoable() )
257 {
258 failed();
262 toggle();
263 }
264 }
265 catch ( dunedaq::conffwk::Exception const & e )
266 {
267 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
268 }
269}
#define ERS_HERE
void failed() const
Definition Command.cpp:536
bool redoable() const
Definition Command.cpp:563
QUuid const & source() const
Definition Command.cpp:568
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 223 of file Command.cpp.

224{
225 try
226 {
227 if ( undoable() )
228 {
229 failed();
230 // notify for the objects that have been actually removed
232 [&] ( dref const obj )
233 {
234 confaccessor::ref().force_emit_object_deleted ( source().toString(), obj );
235 };
236
239 toggle();
240 }
241 }
242 catch ( dunedaq::conffwk::Exception const & e )
243 {
244 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
245 }
246 catch ( daq::dbe::config_object_retrieval_result_is_null const & e )
247 {
248 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, e );
249 }
250}
bool undoable() const
Definition Command.cpp:558
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 95 of file Command.hpp.


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