DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::actions::file::add Class Reference

#include <Command.hpp>

Inheritance diagram for dbe::actions::file::add:
[legend]
Collaboration diagram for dbe::actions::file::add:
[legend]

Public Member Functions

 add (std::string const &db_file, std::string const &include_file, QUuid const &src=0, QUndoCommand *parent=0)
void redo ()
void undo ()
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

std::string m_db_file
std::string m_include_file

Additional Inherited Members

Protected Member Functions inherited from dbe::actions::state
 state (QUndoCommand *parent=nullptr, QUuid const &uuid=0)

Detailed Description

Definition at line 174 of file Command.hpp.

Constructor & Destructor Documentation

◆ add()

dbe::actions::file::add::add ( std::string const & db_file,
std::string const & include_file,
QUuid const & src = 0,
QUndoCommand * parent = 0 )

Definition at line 118 of file Command.cpp.

121 : state ( parent, src ),
122 m_db_file ( db_file ),
123 m_include_file ( include_file )
124{
125 setText (
126 QObject::tr ( "Add Include File %1 to %2" ).arg (
127 QFileInfo ( QString ( m_include_file.c_str() ) ).fileName() ).arg (
128 QFileInfo ( QString ( m_db_file.c_str() ) ).fileName() ) );
129}
std::string m_include_file
Definition Command.hpp:184
state(QUndoCommand *parent=nullptr, QUuid const &uuid=0)
Definition Command.cpp:525

Member Function Documentation

◆ redo()

void dbe::actions::file::add::redo ( )

Definition at line 151 of file Command.cpp.

152{
153 try
154 {
155 if ( redoable() )
156 {
157 failed();
159 toggle();
160 }
161 }
162 catch ( dunedaq::conffwk::Exception const & e )
163 {
164 throw daq::dbe::DatabaseChangeNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
165 }
166}
#define ERS_HERE
void failed() const
Definition Command.cpp:541
bool redoable() const
Definition Command.cpp:568
static confaccessor & ref()
void addfile(std::string const &db, std::string const &fn)
std::string const parse(ers::Issue const &)

◆ undo()

void dbe::actions::file::add::undo ( )

Definition at line 133 of file Command.cpp.

134{
135 try
136 {
137 if ( undoable() )
138 {
140 }
141 }
142 catch ( dunedaq::conffwk::Exception const & e )
143 {
144 failed();
145 throw daq::dbe::DatabaseChangeNotSuccessful ( ERS_HERE, dbe::config::errors::parse ( e ) );
146 }
147}
bool undoable() const
Definition Command.cpp:563
void removefile(std::string const &db, std::string const &fn)

Member Data Documentation

◆ m_db_file

std::string dbe::actions::file::add::m_db_file
private

Definition at line 183 of file Command.hpp.

◆ m_include_file

std::string dbe::actions::file::add::m_include_file
private

Definition at line 184 of file Command.hpp.


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