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

#include <Command.hpp>

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

Public Member Functions

 remove (tref item, QUuid const &uuid=0, QUndoCommand *parent=0)
 
 ~remove ()
 
void redo ()
 
void undo ()
 
- Public Member Functions inherited from dbe::actions::onobject
 onobject (tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
 
- 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

gref this_remainder
 

Additional Inherited Members

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

Detailed Description

Definition at line 100 of file Command.hpp.

Constructor & Destructor Documentation

◆ remove()

dbe::actions::object::remove::remove ( tref item,
QUuid const & uuid = 0,
QUndoCommand * parent = 0 )

Definition at line 273 of file Command.cpp.

275 : onobject ( anobject, parent, uuid )
276{
277 setText (
278 QObject::tr ( "Delete object of class %1 with ID %2" ).arg (
279 ( this->checkedref().class_name() ).c_str() ).arg (
280 ( this->checkedref().UID() ).c_str() ) );
281}
tref checkedref() const
Definition Command.cpp:513
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:505
QUuid const uuid
Definition Command.hpp:32

◆ ~remove()

dbe::actions::object::remove::~remove ( )

Definition at line 283 of file Command.cpp.

284{
285}

Member Function Documentation

◆ redo()

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

Definition at line 316 of file Command.cpp.

317{
318 try
319 {
320 if ( redoable() and not checkedref().is_null() )
321 {
322 failed();
323 // notify for the objects that have been actually removed
324 gref::config_action_notifiable deletion = [&] ( dref const obj )
325 {
326 confaccessor::ref().force_emit_object_deleted ( source().toString(), obj );
327 };
328
330 decltype ( this_remainder ) ::t_extractor > ( checkedref(), deletion );
331 toggle();
332 }
333 }
334 catch ( dunedaq::conffwk::Exception const & e )
335 {
336 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
337 }
338 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
339 {
340 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
341 ex.what() );
342 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
343 }
344
345}
#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_deleted(QString const &, dref const)
static confaccessor & ref()
static configobject::gref< T > delete_object_request(configobject::tref const &obj)
#define FAIL(...)
std::string const parse(ers::Issue const &)
config_object_description dref

◆ undo()

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

Definition at line 287 of file Command.cpp.

288{
289 try
290 {
291 if ( undoable() )
292 {
293 failed();
294 gref::config_action_notifiable creation = [&] ( dref obj )
295 {
296 confaccessor::ref().force_emit_object_created ( source().toString(), obj );
297 };
298
300 toggle();
301 }
302 }
303 catch ( dunedaq::conffwk::Exception const & e )
304 {
305 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
306 }
307 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
308 {
309 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
310 ex.what() );
311 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
312 }
313
314}
bool undoable() const
Definition Command.cpp:558
void force_emit_object_created(QString const &, dref const)
static configobject::tref create_object_request(dbe::t_config_object_preimage const &rep)

Member Data Documentation

◆ this_remainder

gref dbe::actions::object::remove::this_remainder
private

Definition at line 110 of file Command.hpp.


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