ATLAS Offline Software
|
#include <string>
#include <TFile.h>
#include "RingerSelectorTools/RingerSelectorToolsDefs.h"
#include "RingerSelectorTools/procedures/IRingerProcedure.h"
#include "RingerSelectorTools/tools/VariableDependency.h"
#include "RingerIOVarDepObj.icc"
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 | |
Ringer | |
Namespace dedicated for Ringer utilities. | |
Macros | |
#define | RINGER_IO_VARDEP_BASE(self) |
Create RingerIOVarDepObj base object prototype methods. More... | |
#define | RINGER_IO_VARDEP_BASE_NOMEMBER(self) |
Same as RINGER_IO_VARDEP_BASE, but when class has no member. More... | |
#define | RINGER_IO_VARDEP_OBJ(self, base) |
Add necessary information to RingerIOVarDepObj. More... | |
#define RINGER_IO_VARDEP_BASE | ( | self | ) |
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 99 of file RingerIOVarDepObj.h.
#define RINGER_IO_VARDEP_BASE_NOMEMBER | ( | self | ) |
Same as RINGER_IO_VARDEP_BASE, but when class has no member.
Definition at line 114 of file RingerIOVarDepObj.h.
#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 135 of file RingerIOVarDepObj.h.