Bayeux  3.4.1
Core Foundation library for SuperNEMO
Classes | Namespaces | Macros | Functions
caster_utils.h File Reference
#include <iostream>
#include <typeinfo>
#include <memory>

Go to the source code of this file.

Classes

struct  datatools::i_caster< From, ToBase >
 Templatized abstract interface class with a cast method using covariant return types . More...
 
struct  datatools::caster< From, ToBase, ToDaughter >
 Templatized concrete caster class for casting pointers from a covariant class hierarchy to some other type. More...
 

Namespaces

 datatools
 The Bayeux/datatools library top-level namespace.
 

Macros

#define DATATOOLS_CASTER_DECLARATION(From, ToBase, ToDaughter, CasterId, CasterGetter)
 Macro to declare a caster class. More...
 
#define DATATOOLS_CASTER_IMPLEMENTATION(From, ToBase, ToDaughter, CasterId, CasterGetter)
 Macro to implement a caster class. More...
 

Functions

virtual ToBase * cast (From *)=0
 
template<class Base , class Derived >
bool datatools::is_covariant (const Base &b_)
 

Macro Definition Documentation

◆ DATATOOLS_CASTER_DECLARATION

#define DATATOOLS_CASTER_DECLARATION (   From,
  ToBase,
  ToDaughter,
  CasterId,
  CasterGetter 
)
Value:
private: \
static std::unique_ptr<datatools::caster<From,ToBase,ToDaughter> > CasterId; \
public: \
virtual datatools::i_caster<From,ToBase>* CasterGetter() const; \
Templatized abstract interface class with a cast method using covariant return types .
Definition: caster_utils.h:47

Macro to declare a caster class.

◆ DATATOOLS_CASTER_IMPLEMENTATION

#define DATATOOLS_CASTER_IMPLEMENTATION (   From,
  ToBase,
  ToDaughter,
  CasterId,
  CasterGetter 
)
Value:
std::unique_ptr<datatools::caster<From,ToBase,ToDaughter> > ToDaughter::CasterId; \
datatools::i_caster<From,ToBase>* ToDaughter::CasterGetter() const { \
if (ToDaughter::CasterId.get() == 0) { \
ToDaughter::CasterId.reset(new datatools::caster<From,ToBase,ToDaughter>); \
} \
return ToDaughter::CasterId.get(); \
} \
Templatized concrete caster class for casting pointers from a covariant class hierarchy to some other...
Definition: caster_utils.h:56

Macro to implement a caster class.

Function Documentation

◆ cast()

virtual ToBase* caster::cast ( From *  )
pure virtual