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 105 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 278 of file Command.cpp.

280 : onobject ( anobject, parent, uuid )
281{
282 setText (
283 QObject::tr ( "Delete object of class %1 with ID %2" ).arg (
284 ( this->checkedref().class_name() ).c_str() ).arg (
285 ( this->checkedref().UID() ).c_str() ) );
286}
tref checkedref() const
Definition Command.cpp:518
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:510
QUuid const uuid
Definition Command.hpp:37

◆ ~remove()

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

Definition at line 288 of file Command.cpp.

289{
290}

Member Function Documentation

◆ redo()

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

Definition at line 321 of file Command.cpp.

322{
323 try
324 {
325 if ( redoable() and not checkedref().is_null() )
326 {
327 failed();
328 // notify for the objects that have been actually removed
329 gref::config_action_notifiable deletion = [&] ( dref const obj )
330 {
331 confaccessor::ref().force_emit_object_deleted ( source().toString(), obj );
332 };
333
335 decltype ( this_remainder ) ::t_extractor > ( checkedref(), deletion );
336 toggle();
337 }
338 }
339 catch ( dunedaq::conffwk::Exception const & e )
340 {
341 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
342 }
343 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
344 {
345 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
346 ex.what() );
347 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
348 }
349
350}
#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_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 292 of file Command.cpp.

293{
294 try
295 {
296 if ( undoable() )
297 {
298 failed();
299 gref::config_action_notifiable creation = [&] ( dref obj )
300 {
301 confaccessor::ref().force_emit_object_created ( source().toString(), obj );
302 };
303
305 toggle();
306 }
307 }
308 catch ( dunedaq::conffwk::Exception const & e )
309 {
310 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
311 }
312 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
313 {
314 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
315 ex.what() );
316 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
317 }
318
319}
bool undoable() const
Definition Command.cpp:563
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 115 of file Command.hpp.


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