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

OldValue
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 39 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 56 of file change_enum.hpp.

58 : onobject ( Object, parent ),
61 Success ( true )
62{
63 try
64 {
68 }
69 catch ( dunedaq::conffwk::Exception const & e )
70 {
71 Q_UNUSED ( e )
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}
dunedaq::conffwk::attribute_t Attribute
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:510
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 106 of file change_enum.hpp.

107{
108 try
109 {
110 if ( isvalid() )
111 {
112 failed();
113
116
117 OldValue = convert::to<T> ( Data, Attribute.p_int_format );
118
120
121 toggle();
122 }
123 }
124 catch ( dunedaq::conffwk::Exception const & e )
125 {
126 Success = false;
128 }
130 {
131 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
132 ex.what() );
134 }
135
136}
tref checkedref() const
Definition Command.cpp:518
bool isvalid() const
Definition Command.cpp:548
void failed() const
Definition Command.cpp:541
#define FAIL(...)
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 80 of file change_enum.hpp.

81{
82 try
83 {
84 if ( isvalid() )
85 {
86 failed();
88 toggle();
89 }
90 }
91 catch ( dunedaq::conffwk::Exception const & e )
92 {
93 Success = false;
95 }
97 {
98 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
99 ex.what() );
101 }
102
103}

Member Data Documentation

◆ Attribute

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

Definition at line 51 of file change_enum.hpp.

◆ NewValue

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

Definition at line 50 of file change_enum.hpp.

◆ OldValue

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

Definition at line 49 of file change_enum.hpp.

◆ Success

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

Definition at line 52 of file change_enum.hpp.


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