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

#include <Command.hpp>

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

Public Member Functions

 move (tref ObjectChanged, std::string const &File, QUuid const &src=0, QUndoCommand *parent=nullptr)
 
 ~move ()
 
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

std::string source_file
 
std::string destination_file
 

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 147 of file Command.hpp.

Constructor & Destructor Documentation

◆ move()

dbe::actions::object::move::move ( tref ObjectChanged,
std::string const & File,
QUuid const & src = 0,
QUndoCommand * parent = nullptr )

Definition at line 434 of file Command.cpp.

436 : onobject ( object, parent, src ),
437 source_file ( this->checkedref().contained_in() ),
439{
440 setText (
441 QObject::tr ( "Object changed from file %1 to %2" ).arg ( source_file.c_str() ).arg (
442 destination_file.c_str() ) );
443}
tref checkedref() const
Definition Command.cpp:513
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:505

◆ ~move()

dbe::actions::object::move::~move ( )

Definition at line 447 of file Command.cpp.

448{
449}

Member Function Documentation

◆ redo()

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

Definition at line 453 of file Command.cpp.

454{
455 try
456 {
457 if ( redoable() )
458 {
459 failed();
461 emit confaccessor::ref().force_emit_object_changed ( source().toString(), this->checkedref() );
462 toggle();
463 }
464 }
465 catch ( dunedaq::conffwk::Exception const & e )
466 {
467 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
468 }
469 catch ( daq::dbe::config_object_retrieval_result_is_null const & e )
470 {
471 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
472 e.what() );
473 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, e );
474 }
475}
#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_changed(QString const &, dref const)
static confaccessor & ref()
static configobject::tref move_object_request(configobject::tref objref, std::string const &destfile)
#define FAIL(...)
std::string const parse(ers::Issue const &)

◆ undo()

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

Definition at line 479 of file Command.cpp.

480{
481 try
482 {
483 if ( undoable() )
484 {
485 failed();
487 toggle();
488 }
489 }
490 catch ( dunedaq::conffwk::Exception const & e )
491 {
492 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
493 }
494 catch ( daq::dbe::config_object_retrieval_result_is_null const & e )
495 {
496 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
497 e.what() );
498 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, e );
499 }
500
501}
bool undoable() const
Definition Command.cpp:558

Member Data Documentation

◆ destination_file

std::string dbe::actions::object::move::destination_file
private

Definition at line 158 of file Command.hpp.

◆ source_file

std::string dbe::actions::object::move::source_file
private

Definition at line 157 of file Command.hpp.


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