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

#include <change_time.hpp>

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

Public Member Functions

 ChangeTime (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::ChangeTime< T >

Definition at line 32 of file change_time.hpp.

Constructor & Destructor Documentation

◆ ChangeTime()

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

Definition at line 49 of file change_time.hpp.

51 : onobject ( Object, parent ),
52 NewValue ( NewValueData ),
53 Attribute ( AttributeData ),
54 Success ( true )
55{
56 try
57 {
58 QStringList Data
60 OldValue = convert::to<T> ( Data );
61 }
62 catch ( dunedaq::conffwk::Exception const & )
63 {
64 }
65
66 setText (
67 QObject::tr ( "Attribute %1 of object %2 was updated." ).arg (
68 AttributeData.p_name.c_str() ).arg ( Object.UID().c_str() ) );
69}
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)
nlohmann::json Data
Definition Structs.hpp:24

Member Function Documentation

◆ redo()

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

Definition at line 98 of file change_time.hpp.

99{
100 try
101 {
102 if ( redoable() )
103 {
104 failed();
105
106 QStringList Data
108
109 OldValue = convert::to<T> ( Data );
110
112 toggle();
113 }
114 }
115 catch ( dunedaq::conffwk::Exception const & e )
116 {
117 Success = false;
118 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, e );
119 }
120 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
121 {
122 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
123 ex.what() );
124 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
125 }
126
127}
#define ERS_HERE
tref checkedref() const
Definition Command.cpp:513
void failed() const
Definition Command.cpp:536
bool redoable() const
Definition Command.cpp:563
#define FAIL(...)
void atime(inner::configobject::tref Object, dunedaq::conffwk::attribute_t const &AttributeData, T NewValueData, bool NotEmit=false)

◆ undo()

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

Definition at line 72 of file change_time.hpp.

73{
74 try
75 {
76 if ( undoable() )
77 {
78 failed();
80 toggle();
81 }
82 }
83 catch ( dunedaq::conffwk::Exception const & e )
84 {
85 Success = false;
86 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, e );
87 }
88 catch ( daq::dbe::config_object_retrieval_result_is_null const & ex )
89 {
90 FAIL ( "Operation did not complete because a lookup in the underlying database failed",
91 ex.what() );
92 throw daq::dbe::ObjectChangeWasNotSuccessful ( ERS_HERE, ex );
93 }
94
95}
bool undoable() const
Definition Command.cpp:558

Member Data Documentation

◆ Attribute

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

Definition at line 44 of file change_time.hpp.

◆ NewValue

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

Definition at line 43 of file change_time.hpp.

◆ OldValue

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

Definition at line 42 of file change_time.hpp.

◆ Success

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

Definition at line 45 of file change_time.hpp.


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