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 40 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 55 of file change_attribute.hpp.

57 : onobject ( Object, parent ),
60{
61 try
62 {
63 failed();
66 OldValue = convert::to<T> ( Data, Attribute.p_int_format );
67 toggle();
68 }
69 catch ( dunedaq::conffwk::Exception const & )
70 {
71 }
73 {
74 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
75 ex.what() );
77 }
78
79 setText (
80 QObject::tr ( "Attribute %1 of object %2 was updated." ).arg (
81 AttributeData.p_name.c_str() ).arg ( Object.UID().c_str() ) );
82}
dunedaq::conffwk::attribute_t Attribute
tref checkedref() const
Definition Command.cpp:518
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:510
void failed() const
Definition Command.cpp:541
static T list(dbe::inner::configobject::tref obj, dunedaq::conffwk::attribute_t const &attr)
#define FAIL(...)
T to(QStringList const &DataList)

Member Function Documentation

◆ redo()

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

Definition at line 111 of file change_attribute.hpp.

112{
113 try
114 {
115 if ( redoable() )
116 {
117 failed();
118
121
122 OldValue = convert::to<T> ( Data, Attribute.p_int_format );
123
125 toggle();
126 }
127 }
128 catch ( dunedaq::conffwk::Exception const & e )
129 {
130 failed();
132 }
134 {
135 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
136 ex.what() );
138 }
139
140}
bool redoable() const
Definition Command.cpp:568
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 85 of file change_attribute.hpp.

86{
87 try
88 {
89 if ( undoable() )
90 {
91 failed();
93 toggle();
94 }
95 }
96 catch ( dunedaq::conffwk::Exception const & e )
97 {
98 failed();
100 }
102 {
103 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
104 ex.what() );
106 }
107
108}
bool undoable() const
Definition Command.cpp:563

Member Data Documentation

◆ Attribute

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

Definition at line 51 of file change_attribute.hpp.

◆ NewValue

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

Definition at line 50 of file change_attribute.hpp.

◆ OldValue

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

Definition at line 49 of file change_attribute.hpp.


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