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< trefthis_current_neighbors
std::vector< trefthis_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 135 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.

26 : onobject ( object, parent, src ),
27 this_relation ( relation ),
29 dbe::config::api::graph::linked::through::relation<std::vector<tref>> ( object, relation ) )
30{
31 try
32 {
33 for ( std::string const & oname : object_names_tolink )
34 {
35 try
36 {
38 { oname, relation.p_type } ) );
39 }
40 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
41 {
42 // Actually there is no need to handle this error here ,
43 // since the object will not be added to the result list of references,
44 // and can be safely ignored
45 }
46 }
47 }
48 catch ( dunedaq::conffwk::Exception const & e )
49 {
50 failed();
51 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
52 }
53
54 setText (
55 QObject::tr ( "Relation %1 of object %2 was updated." ).arg (
56 this_relation.p_name.c_str() ).arg ( object.UID().c_str() ) );
57}
#define ERS_HERE
std::vector< tref > this_target_neighbors
Definition Command.hpp:147
std::vector< tref > this_current_neighbors
Definition Command.hpp:146
dunedaq::conffwk::relationship_t this_relation
Definition Command.hpp:145
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:510
void failed() const
Definition Command.cpp:541
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 61 of file Command.cpp.

62{
63 try
64 {
65 if ( redoable() )
66 {
67 failed();
71 toggle();
72 }
73 }
74 catch ( dunedaq::conffwk::Exception const & e )
75 {
76 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, config::errors::parse ( e ) );
77 }
78 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
79 {
80 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
81 ex.what() );
82 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
83 }
84
85}
tref checkedref() const
Definition Command.cpp:518
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()
#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 89 of file Command.cpp.

90{
91 try
92 {
93 if ( undoable() )
94 {
95 failed();
99 toggle();
100 }
101 }
102 catch ( dunedaq::conffwk::Exception const & e )
103 {
104 failed();
105 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
106 }
107 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
108 {
109 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
110 ex.what() );
111 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
112 }
113
114}
bool undoable() const
Definition Command.cpp:563

Member Data Documentation

◆ this_current_neighbors

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

Definition at line 146 of file Command.hpp.

◆ this_relation

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

Definition at line 145 of file Command.hpp.

◆ this_target_neighbors

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

Definition at line 147 of file Command.hpp.


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