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

T OldValue
T 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 38 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.

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

Member Function Documentation

◆ redo()

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

Definition at line 99 of file change_attribute.hpp.

100{
101 try {
102 if (redoable()) {
103 failed();
104
106
107 OldValue = convert::to<T>(Data, Attribute.p_int_format);
108
110 toggle();
111 }
112 } catch (dunedaq::conffwk::Exception const& e) {
113 failed();
116 FAIL("Operation did not complete because a lookup in the underlying database failed", ex.what());
118 }
119}
bool redoable() const
Definition Command.cpp:469
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 if (undoable()) {
84 failed();
86 toggle();
87 }
88 } catch (dunedaq::conffwk::Exception const& e) {
89 failed();
92 FAIL("Operation did not complete because a lookup in the underlying database failed", ex.what());
94 }
95}
bool undoable() const
Definition Command.cpp:463

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: