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

#include <change_date.hpp>

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

Public Member Functions

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

Definition at line 32 of file change_date.hpp.

Constructor & Destructor Documentation

◆ ChangeDate()

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

Definition at line 49 of file change_date.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::ChangeDate< T >::redo ( )

Definition at line 97 of file change_date.hpp.

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

◆ undo()

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

Definition at line 72 of file change_date.hpp.

73{
74 try
75 {
76 if ( isvalid() )
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}

Member Data Documentation

◆ Attribute

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

Definition at line 44 of file change_date.hpp.

◆ NewValue

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

Definition at line 43 of file change_date.hpp.

◆ OldValue

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

Definition at line 42 of file change_date.hpp.

◆ Success

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

Definition at line 45 of file change_date.hpp.


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