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 152 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 439 of file Command.cpp.

441 : onobject ( object, parent, src ),
442 source_file ( this->checkedref().contained_in() ),
444{
445 setText (
446 QObject::tr ( "Object changed from file %1 to %2" ).arg ( source_file.c_str() ).arg (
447 destination_file.c_str() ) );
448}
tref checkedref() const
Definition Command.cpp:518
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:510

◆ ~move()

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

Definition at line 452 of file Command.cpp.

453{
454}

Member Function Documentation

◆ redo()

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

Definition at line 458 of file Command.cpp.

459{
460 try
461 {
462 if ( redoable() )
463 {
464 failed();
466 emit confaccessor::ref().force_emit_object_changed ( source().toString(), this->checkedref() );
467 toggle();
468 }
469 }
470 catch ( dunedaq::conffwk::Exception const & e )
471 {
472 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
473 }
474 catch ( daq::dbe::config_object_retrieval_result_is_null const & e )
475 {
476 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
477 e.what() );
478 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, e );
479 }
480}
#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_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 484 of file Command.cpp.

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

Member Data Documentation

◆ destination_file

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

Definition at line 163 of file Command.hpp.

◆ source_file

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

Definition at line 162 of file Command.hpp.


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