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

#include <change_enum.hpp>

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

Public Member Functions

 ChangeEnum (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
bool Success

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::ChangeEnum< T >

Definition at line 37 of file change_enum.hpp.

Constructor & Destructor Documentation

◆ ChangeEnum()

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

Definition at line 52 of file change_enum.hpp.

59 , Success(true)
60{
61 try {
64 } catch (dunedaq::conffwk::Exception const& e) {
65 Q_UNUSED(e)
66 }
67
68 setText(
69 QObject::tr("Attribute %1 of object %2 was updated.").arg(AttributeData.p_name.c_str()).arg(Object.UID().c_str()));
70}
dunedaq::conffwk::attribute_t Attribute
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:403
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::ChangeEnum< T >::redo ( )

Definition at line 93 of file change_enum.hpp.

94{
95 try {
96 if (isvalid()) {
97 failed();
98
100
101 OldValue = convert::to<T>(Data, Attribute.p_int_format);
102
104
105 toggle();
106 }
107 } catch (dunedaq::conffwk::Exception const& e) {
108 Success = false;
111 FAIL("Operation did not complete because a lookup in the underlying database failed", ex.what());
113 }
114}
tref checkedref() const
Definition Command.cpp:412
bool isvalid() const
Definition Command.cpp:445
void failed() const
Definition Command.cpp:437
void anenum(inner::configobject::tref Object, dunedaq::conffwk::attribute_t const &AttributeData, T NewValueData, bool NotEmit=false)

◆ undo()

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

Definition at line 74 of file change_enum.hpp.

75{
76 try {
77 if (isvalid()) {
78 failed();
80 toggle();
81 }
82 } catch (dunedaq::conffwk::Exception const& e) {
83 Success = false;
86 FAIL("Operation did not complete because a lookup in the underlying database failed", ex.what());
88 }
89}

Member Data Documentation

◆ Attribute

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

Definition at line 47 of file change_enum.hpp.

◆ NewValue

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

Definition at line 46 of file change_enum.hpp.

◆ OldValue

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

Definition at line 45 of file change_enum.hpp.

◆ Success

template<typename T>
bool dbe::actions::ChangeEnum< T >::Success
private

Definition at line 48 of file change_enum.hpp.


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