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 130 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 17 of file Command.cpp.

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

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

85{
86 try
87 {
88 if ( undoable() )
89 {
90 failed();
94 toggle();
95 }
96 }
97 catch ( dunedaq::conffwk::Exception const & e )
98 {
99 failed();
100 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
101 }
102 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
103 {
104 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
105 ex.what() );
106 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
107 }
108
109}
bool undoable() const
Definition Command.cpp:558

Member Data Documentation

◆ this_current_neighbors

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

Definition at line 141 of file Command.hpp.

◆ this_relation

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

Definition at line 140 of file Command.hpp.

◆ this_target_neighbors

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

Definition at line 142 of file Command.hpp.


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