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

#include <Command.hpp>

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

Public Member Functions

 changerefs (tref object, dunedaq::conffwk::relationship_t const &relation, std::vector< std::string > const &object_names_tolink, QUuid const &src=0, QUndoCommand *Parent=nullptr)
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

dunedaq::conffwk::relationship_t this_relation
std::vector< tref > this_current_neighbors
std::vector< tref > this_target_neighbors

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

Constructor & Destructor Documentation

◆ changerefs()

dbe::actions::object::changerefs::changerefs ( tref object,
dunedaq::conffwk::relationship_t const & relation,
std::vector< std::string > const & object_names_tolink,
QUuid const & src = 0,
QUndoCommand * Parent = nullptr )

Definition at line 22 of file Command.cpp.

27 : onobject(object, parent, src)
28 , this_relation(relation)
30{
31 try {
32 for (std::string const& oname : object_names_tolink) {
33 try {
34 this_target_neighbors.push_back(inner::dbcontroller::get({ oname, relation.p_type }));
35 } catch (daq::dbe::config_object_retrieval_result_is_null const& ex) {
36 // Actually there is no need to handle this error here ,
37 // since the object will not be added to the result list of references,
38 // and can be safely ignored
39 }
40 }
41 } catch (dunedaq::conffwk::Exception const& e) {
42 failed();
43 throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, dbe::config::errors::parse(e));
44 }
45
46 setText(
47 QObject::tr("Relation %1 of object %2 was updated.").arg(this_relation.p_name.c_str()).arg(object.UID().c_str()));
48}
#define ERS_HERE
std::vector< tref > this_target_neighbors
Definition Command.hpp:141
std::vector< tref > this_current_neighbors
Definition Command.hpp:140
dunedaq::conffwk::relationship_t this_relation
Definition Command.hpp:139
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:403
void failed() const
Definition Command.cpp:437
static configobject::tref get(dbe::cokey const &desc)
T relation(tref item, dunedaq::conffwk::relationship_t const &relation)
std::string const parse(ers::Issue const &)

Member Function Documentation

◆ redo()

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

Definition at line 53 of file Command.cpp.

54{
55 try {
56 if (redoable()) {
57 failed();
60 toggle();
61 }
62 } catch (dunedaq::conffwk::Exception const& e) {
63 throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, config::errors::parse(e));
64 } catch (daq::dbe::config_object_retrieval_result_is_null const& ex) {
65 FAIL("Operation did not complete because a lookup in the underlying database failed", ex.what());
66 throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, ex);
67 }
68}
tref checkedref() const
Definition Command.cpp:412
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()
#define FAIL(...)
void relation(dbe::inner::configobject::tref src, dunedaq::conffwk::relationship_t const &edge, std::vector< dbe::inner::configobject::tref > const &targets)

◆ undo()

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

Definition at line 73 of file Command.cpp.

74{
75 try {
76 if (undoable()) {
77 failed();
80 toggle();
81 }
82 } catch (dunedaq::conffwk::Exception const& e) {
83 failed();
84 throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, dbe::config::errors::parse(e));
85 } catch (daq::dbe::config_object_retrieval_result_is_null const& ex) {
86 FAIL("Operation did not complete because a lookup in the underlying database failed", ex.what());
87 throw daq::dbe::ObjectChangeWasNotSuccessful(ERS_HERE, ex);
88 }
89}
bool undoable() const
Definition Command.cpp:463

Member Data Documentation

◆ this_current_neighbors

std::vector<tref> dbe::actions::object::changerefs::this_current_neighbors
private

Definition at line 140 of file Command.hpp.

◆ this_relation

dunedaq::conffwk::relationship_t dbe::actions::object::changerefs::this_relation
private

Definition at line 139 of file Command.hpp.

◆ this_target_neighbors

std::vector<tref> dbe::actions::object::changerefs::this_target_neighbors
private

Definition at line 141 of file Command.hpp.


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