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 34 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 51 of file change_enum.hpp.

53 : onobject ( Object, parent ),
56 Success ( true )
57{
58 try
59 {
63 }
64 catch ( dunedaq::conffwk::Exception const & e )
65 {
66 Q_UNUSED ( e )
67 }
68
69 setText (
70 QObject::tr ( "Attribute %1 of object %2 was updated." ).arg (
71 AttributeData.p_name.c_str() ).arg ( Object.UID().c_str() ) );
72}
dunedaq::conffwk::attribute_t Attribute
onobject(tref obj, QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:505
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 101 of file change_enum.hpp.

102{
103 try
104 {
105 if ( isvalid() )
106 {
107 failed();
108
111
112 OldValue = convert::to<T> ( Data, Attribute.p_int_format );
113
115
116 toggle();
117 }
118 }
119 catch ( dunedaq::conffwk::Exception const & e )
120 {
121 Success = false;
123 }
125 {
126 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
127 ex.what() );
129 }
130
131}
tref checkedref() const
Definition Command.cpp:513
bool isvalid() const
Definition Command.cpp:543
void failed() const
Definition Command.cpp:536
#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 75 of file change_enum.hpp.

76{
77 try
78 {
79 if ( isvalid() )
80 {
81 failed();
83 toggle();
84 }
85 }
86 catch ( dunedaq::conffwk::Exception const & e )
87 {
88 Success = false;
90 }
92 {
93 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
94 ex.what() );
96 }
97
98}

Member Data Documentation

◆ Attribute

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

Definition at line 46 of file change_enum.hpp.

◆ NewValue

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

Definition at line 45 of file change_enum.hpp.

◆ OldValue

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

Definition at line 44 of file change_enum.hpp.

◆ Success

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

Definition at line 47 of file change_enum.hpp.


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