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 146 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 350 of file Command.cpp.

351 : onobject(object, parent, src)
352 , source_file(this->checkedref().contained_in())
353 , destination_file(filename)
354{
355 setText(QObject::tr("Object changed from file %1 to %2").arg(source_file.c_str()).arg(destination_file.c_str()));
356}
tref checkedref() const
Definition Command.cpp:412
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:403

◆ ~move()

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

Definition at line 360 of file Command.cpp.

360{}

Member Function Documentation

◆ redo()

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

Definition at line 365 of file Command.cpp.

366{
367 try {
368 if (redoable()) {
369 failed();
371 emit confaccessor::ref().force_emit_object_changed(source().toString(), this -> checkedref());
372 toggle();
373 }
374 } catch (dunedaq::conffwk::Exception const& e) {
375 throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, dbe::config::errors::parse(e));
376 } catch (daq::dbe::config_object_retrieval_result_is_null const& e) {
377 FAIL("Operation did not complete because a lookup in the underlying database failed", e.what());
378 throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, e);
379 }
380}
#define ERS_HERE
void failed() const
Definition Command.cpp:437
bool redoable() const
Definition Command.cpp:469
QUuid const & source() const
Definition Command.cpp:475
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 385 of file Command.cpp.

386{
387 try {
388 if (undoable()) {
389 failed();
391 toggle();
392 }
393 } catch (dunedaq::conffwk::Exception const& e) {
394 throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, dbe::config::errors::parse(e));
395 } catch (daq::dbe::config_object_retrieval_result_is_null const& e) {
396 FAIL("Operation did not complete because a lookup in the underlying database failed", e.what());
397 throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, e);
398 }
399}
bool undoable() const
Definition Command.cpp:463

Member Data Documentation

◆ destination_file

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

Definition at line 156 of file Command.hpp.

◆ source_file

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

Definition at line 155 of file Command.hpp.


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