ATLAS Offline Software
Loading...
Searching...
No Matches
RingerIOVarDepObj.h File Reference
Include dependency graph for RingerIOVarDepObj.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Ringer::RingerIOVarDepObj< CRTP >
 Objects that can be recorded/read into/from configuration files. More...

Namespaces

namespace  Ringer
 Namespace dedicated for Ringer utilities.

Macros

#define RINGER_IO_VARDEP_BASE(self)
 Create RingerIOVarDepObj base object prototype methods.
#define RINGER_IO_VARDEP_BASE_NOMEMBER(self)
 Same as RINGER_IO_VARDEP_BASE, but when class has no member.
#define RINGER_IO_VARDEP_OBJ(self, base)
 Add necessary information to RingerIOVarDepObj.

Macro Definition Documentation

◆ RINGER_IO_VARDEP_BASE

#define RINGER_IO_VARDEP_BASE ( self)
Value:
public: \
\
RINGER_DEFINE_PROCEDURE(self) \
\
static void read(self *newObj, \
TDirectory *configDir, \
unsigned version ); \
\
virtual void write(TDirectory *configDir, const char* idxStr = "") \
const override;
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)

Create RingerIOVarDepObj base object prototype methods.

Every time you create a class that use this mechanism, make sure to add it to "RingerSelectorTools/procedures/Types.h"

When you create a class that implements a RingerProcedure and it will be a writable object, then this object must have defined this macro and implement the read and write methods as:

file NewProcedure.h: /code class NewProcedure: virtual public IDiscriminator // or virtual public IPreProcessor // or virtual public IThreshold { // Given as example float m_var;

RINGER_IO_VARDEP_BASE( NewProcedure ) // ... }

RINGER_DEFINE_PROCTYPE_MEMBER_FCN( NewProcedure )

} // namespace Ringer /endcode

file NewProcedure.cxx /code namespace Ringer {

void NewProcedure::read(NewProcedure* newObj, TDirectory *configDir, unsigned version ) { IOHelperFcns::readVar( configDir, "var", newObj->m_var ); }

void NewProcedure::write(TDirectory *configDir) const { IOHelperFcns::writeVar(configDir, "var", m_var ); }

void NewProcedure::print(MSG::Level lvl) const { if ( !this->isStreamAvailable() ) { std::cerr << "Cannot print NewProcedure, stream unavailable" << std::endl; } if ( this->level() > lvl ) { return; } msg() << lvl << this->name() << " configuration:" << endmsg; msg() << lvl << "var:" << m_var << endmsg; }

} // namespace Ringer /endcode

If the procedure has no variable, it can use the RINGER_IO_VARDEP_BASE_NOMEMBER macro instead.

The previous structure will need also to implement the VariableDependency class, which will inherit from the RingerIOVarDepObj using the RINGER_IO_VARDEP_OBJ macro described next.

/code class NewProcedureVarDep : virtual public IDiscriminatorVarDep, public RingerIOVarDepObj<NewProcedureVarDep>, public NewProcedure { RINGER_IO_VARDEP_OBJ(NewProcedureVarDep, NewProcedure) // ... } /endcode

Definition at line 98 of file RingerIOVarDepObj.h.

98#define RINGER_IO_VARDEP_BASE(self) \
99 public: \
100 \
101 RINGER_DEFINE_PROCEDURE(self) \
102 \
103 static void read(self *newObj, \
104 TDirectory *configDir, \
105 unsigned version ); \
106 \
107 virtual void write(TDirectory *configDir, const char* idxStr = "") \
108 const override;

◆ RINGER_IO_VARDEP_BASE_NOMEMBER

#define RINGER_IO_VARDEP_BASE_NOMEMBER ( self)
Value:
public: \
\
RINGER_DEFINE_NOMEMBER_PROCEDURE(self) \
\
static void read(self *, \
TDirectory *, \
unsigned ) {;} \
\
virtual void write(TDirectory *, const char*) const \
override {;}

Same as RINGER_IO_VARDEP_BASE, but when class has no member.

Definition at line 113 of file RingerIOVarDepObj.h.

113#define RINGER_IO_VARDEP_BASE_NOMEMBER(self) \
114 public: \
115 \
116 RINGER_DEFINE_NOMEMBER_PROCEDURE(self) \
117 \
118 static void read(self *, \
119 TDirectory *, \
120 unsigned ) {;} \
121 \
122 virtual void write(TDirectory *, const char*) const \
123 override {;}

◆ RINGER_IO_VARDEP_OBJ

#define RINGER_IO_VARDEP_OBJ ( self,
base )

Add necessary information to RingerIOVarDepObj.

When declaring the new procedure variable dependent object, you will need to add this macro adding to add its base type where you used the RINGER_IO_VARDEP_BASE macro.

Definition at line 134 of file RingerIOVarDepObj.h.

134#define RINGER_IO_VARDEP_OBJ(self, base) \
135 \
136 public: \
137 typedef base base_t; \
138 \
139 template <typename T = const char*> \
140 static T procType() \
141 { \
142 return base::template procType<T>(); \
143 } \
144 \
145 virtual std::string name() const \
146 override final \
147 { \
148 return this->RingerIOVarDepObj<self>::name(); \
149 } \
150 \
151 void print(MSG::Level lvl) const \
152 override final \
153 { \
154 this->base_t::print(lvl); \
155 } \
156 \
157 virtual void write(TDirectory *baseDir, const char* idxStr = "") const \
158 override final \
159 { \
160 this->RingerIOVarDepObj<self>::write(baseDir, idxStr); \
161 } \
162 \
163 static self* read(TDirectory *configDir){ \
164 return RingerIOVarDepObj<self>::read(configDir); \
165 } \
166 \
167 typedef typename Ringer::template RingerProcedureType<base>:: \
168 baseInterface_t baseInterface_t; \
169 \
170 using baseInterface_t::procType;