DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::actions::ChangeAttribute< T > Class Template Reference

#include <change_attribute.hpp>

Inheritance diagram for dbe::actions::ChangeAttribute< T >:
[legend]
Collaboration diagram for dbe::actions::ChangeAttribute< T >:
[legend]

Public Member Functions

 ChangeAttribute (tref Object, dunedaq::conffwk::attribute_t AttributeData, T NewValueData, QUndoCommand *parent=nullptr)
 
void undo ()
 
void redo ()
 
- 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

OldValue
 
NewValue
 
dunedaq::conffwk::attribute_t Attribute
 

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

template<typename T>
class dbe::actions::ChangeAttribute< T >

Definition at line 35 of file change_attribute.hpp.

Constructor & Destructor Documentation

◆ ChangeAttribute()

template<typename T >
dbe::actions::ChangeAttribute< T >::ChangeAttribute ( tref Object,
dunedaq::conffwk::attribute_t AttributeData,
T NewValueData,
QUndoCommand * parent = nullptr )

Definition at line 50 of file change_attribute.hpp.

52 : onobject ( Object, parent ),
53 NewValue ( NewValueData ),
54 Attribute ( AttributeData )
55{
56 try
57 {
58 failed();
59 QStringList Data
62 toggle();
63 }
64 catch ( dunedaq::conffwk::Exception const & )
65 {
66 }
67 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
68 {
69 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
70 ex.what() );
71 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
72 }
73
74 setText (
75 QObject::tr ( "Attribute %1 of object %2 was updated." ).arg (
76 AttributeData.p_name.c_str() ).arg ( Object.UID().c_str() ) );
77}
#define ERS_HERE
dunedaq::conffwk::attribute_t Attribute
tref checkedref() const
Definition Command.cpp:513
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:505
void failed() const
Definition Command.cpp:536
static T list(dbe::inner::configobject::tref obj, dunedaq::conffwk::attribute_t const &attr)
#define FAIL(...)
T to(QStringList const &DataList)
nlohmann::json Data
Definition Structs.hpp:24

Member Function Documentation

◆ redo()

template<typename T >
void dbe::actions::ChangeAttribute< T >::redo ( )

Definition at line 106 of file change_attribute.hpp.

107{
108 try
109 {
110 if ( redoable() )
111 {
112 failed();
113
114 QStringList Data
116
118
120 toggle();
121 }
122 }
123 catch ( dunedaq::conffwk::Exception const & e )
124 {
125 failed();
126 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, e );
127 }
128 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
129 {
130 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
131 ex.what() );
132 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
133 }
134
135}
bool redoable() const
Definition Command.cpp:563
void attribute(inner::configobject::tref Object, dunedaq::conffwk::attribute_t const &AttributeData, T NewValueData, bool NotEmit=false)

◆ undo()

template<typename T >
void dbe::actions::ChangeAttribute< T >::undo ( )

Definition at line 80 of file change_attribute.hpp.

81{
82 try
83 {
84 if ( undoable() )
85 {
86 failed();
88 toggle();
89 }
90 }
91 catch ( dunedaq::conffwk::Exception const & e )
92 {
93 failed();
94 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, e );
95 }
96 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
97 {
98 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
99 ex.what() );
100 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
101 }
102
103}
bool undoable() const
Definition Command.cpp:558

Member Data Documentation

◆ Attribute

template<typename T >
dunedaq::conffwk::attribute_t dbe::actions::ChangeAttribute< T >::Attribute
private

Definition at line 46 of file change_attribute.hpp.

◆ NewValue

template<typename T >
T dbe::actions::ChangeAttribute< T >::NewValue
private

Definition at line 45 of file change_attribute.hpp.

◆ OldValue

template<typename T >
T dbe::actions::ChangeAttribute< T >::OldValue
private

Definition at line 44 of file change_attribute.hpp.


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