MIRA
Classes | Macros | Typedefs | Functions
Class Factory Module


For detailed information see Class Factory. More...

Collaboration diagram for Class Factory Module:

Classes

class  Class
 Class object which supports some kind of class reflection. More...
 
class  ClassProxy
 The class proxy assures that the pointer to the class object is always valid. More...
 
class  ClassFactory
 What should i say, the class factory. More...
 
class  LibraryRegistry
 A registry for shared libraries. More...
 
class  NullClass
 Marker class for marking an invalid "null" class. More...
 
class  Object
 The object class acts as a generic base class for classes which should be used with the classFactory. More...
 
class  TClass< CLASS >
 The TClass object is the implementation of the class class for classes which are available since the corresponding library is loaded. More...
 

Macros

#define MIRA_NAMEDOBJECT(classIdentifier, className)
 Use this MACRO if you don't like the factory to automatically extract the class name from the given identifier. More...
 
#define MIRA_OBJECT(classIdentifier)
 Use this MACRO if you like the factory to automatically extract the class name from the given identifier. More...
 
#define MIRA_META_OBJECT(classIdentifier, MetaInfo)
 Use this MACRO instead of MIRA_OBJECT if you like to add meta information to your class. More...
 
#define MIRA_CLASS_REGISTER(Class, ...)
 Use this macro to register your class at the ClassFactory. More...
 

Typedefs

typedef int TypeId
 The type of the integral TypeId, that can be retrieved by typeId<T>() More...
 

Functions

template<typename T >
TypeId typeId ()
 Generates unique IDs for different types. More...
 

Detailed Description


For detailed information see Class Factory.

Macro Definition Documentation

◆ MIRA_NAMEDOBJECT

#define MIRA_NAMEDOBJECT (   classIdentifier,
  className 
)
Value:
MIRA_OBJECT_BASE( MIRA_PPARAM( classIdentifier ) ) \
\ \
static mira::TClass<classIdentifier>& _CLASS() { \
return _staticClassObject( mira::typeName<classIdentifier>(), \
#className, true ); \
} \
private: \ \
static void addMetaInfo( std::map<std::string, std::string>& metaMap ) \
{ \
/* No meta info given -> do nothing */ \
}
#define MIRA_PPARAM(...)
Preprocessor workaround to handle single parameters that contain a comma.
Definition: PParam.h:61
The TClass object is the implementation of the class class for classes which are available since the ...
Definition: TClass.h:75

Use this MACRO if you don't like the factory to automatically extract the class name from the given identifier.

You have to pass Identifier and Class name separated by comma.

◆ MIRA_OBJECT

#define MIRA_OBJECT (   classIdentifier)
Value:
MIRA_OBJECT_BASE( MIRA_PPARAM( classIdentifier ) ) \
\ \
static mira::TClass<classIdentifier>& _CLASS() { \
return _staticClassObject( mira::typeName<classIdentifier>(), \
mira::typeName<classIdentifier>() ), true ); \
} \
private: \ \
static void addMetaInfo( std::map<std::string, std::string>& metaMap ) \
{ \
/* No meta info given -> do nothing */ \
}
#define MIRA_PPARAM(...)
Preprocessor workaround to handle single parameters that contain a comma.
Definition: PParam.h:61
std::string mira_stripNameFromIdentifier(std::string const &identifier)
Auxiliary function to extract the class name from the given identifier.
Definition: FactoryMacros.h:88
The TClass object is the implementation of the class class for classes which are available since the ...
Definition: TClass.h:75

Use this MACRO if you like the factory to automatically extract the class name from the given identifier.

You cannot add meta information to your class with this MACRO. If you like to do so, use MIRA_META_OBJECT instead.

Examples:
tutorials/FloatProducer.C, tutorials/MeanCalculator.C, and tutorials/MeanCalculatorWithProperties.C.

◆ MIRA_META_OBJECT

#define MIRA_META_OBJECT (   classIdentifier,
  MetaInfo 
)
Value:
MIRA_OBJECT_BASE( MIRA_PPARAM( classIdentifier ) ) \
\ \
static mira::TClass<classIdentifier>& _CLASS() { \
return _staticClassObject( mira::typeName<classIdentifier>(), \
mira::typeName<classIdentifier>() ), true ); \
} \
private: \ \
static void addMetaInfo( std::map<std::string, std::string>& metaMap ) \
{ \
/* append given meta information to the map */ \
boost::assign::insert( metaMap ) MetaInfo; \
}
#define MIRA_PPARAM(...)
Preprocessor workaround to handle single parameters that contain a comma.
Definition: PParam.h:61
std::string mira_stripNameFromIdentifier(std::string const &identifier)
Auxiliary function to extract the class name from the given identifier.
Definition: FactoryMacros.h:88
The TClass object is the implementation of the class class for classes which are available since the ...
Definition: TClass.h:75

Use this MACRO instead of MIRA_OBJECT if you like to add meta information to your class.

You have to pass the class identifier and a list of meta information enclosed in brackets. Example: MIRA_META_OBJECT( ClassIdentifer, ("MetaKey1","MetaValue1")("MetaKey2","MetaValue2") );

Examples:
tutorials/Point2Visualization.C, tutorials/Point3BasicVisualization.C, and tutorials/Point3Visualization.C.

◆ MIRA_CLASS_REGISTER

#define MIRA_CLASS_REGISTER (   Class,
  ... 
)
Value:
/* generate error message if macro is not used in global namespace */ \
template <> int \
________________________________PLEASE_USE_THE__MIRA_CLASS_REGISTER__MACRO_IN_GLOBAL_NAMESPACE_ONLY________________________________ \
<Class>::FOR_CLASS() { return 0; } \
MIRA_REGISTRAR( MIRA_PPARAM( mira::FactoryRegisterClass<Class, __VA_ARGS__> ) ) \
mira::TClass<Class>& Class::_staticClassObject(std::string const& identifier, \
std::string const& name, \
bool libLoaded) { \
static mira::TClass<Class> sClass(identifier, name, libLoaded); \
return sClass; \
}
#define MIRA_PPARAM(...)
Preprocessor workaround to handle single parameters that contain a comma.
Definition: PParam.h:61
The TClass object is the implementation of the class class for classes which are available since the ...
Definition: TClass.h:75

Use this macro to register your class at the ClassFactory.

Pass your Class and the parent Class. Use the macro several times if your class do have more than one parent.

Typedef Documentation

◆ TypeId

typedef int TypeId

The type of the integral TypeId, that can be retrieved by typeId<T>()

Function Documentation

◆ typeId()

TypeId mira::typeId ( )

Generates unique IDs for different types.

However, the IDs may change with any start of the application. Therefore, they only can be used for within one process, e.g. for checking if two types are identical, storing type information, etc.