20 #if !defined(__MITSUBA_CORE_CLASS_H_)
21 #define __MITSUBA_CORE_CLASS_H_
59 Class(
const std::string &name,
bool abstract,
const std::string &superClassName,
60 void *instPtr = NULL,
void *unSerPtr = NULL);
63 inline const std::string &
getName()
const {
return m_name; }
83 bool derivesFrom(
const Class *theClass)
const;
86 static const Class *forName(
const std::string &name);
91 static const Class *forName(
const char *name);
96 Object *unserialize(Stream *stream = NULL, InstanceManager *manager = NULL)
const;
99 Object *instantiate()
const;
107 static void staticInitialization();
110 static void staticShutdown();
115 static void initializeOnce(
Class *theClass);
120 std::string m_superClassName;
121 void *m_instPtr, *m_unSerPtr;
122 static bool m_isInitialized;
134 #define MTS_CLASS(x) x::m_theClass
158 #define MTS_DECLARE_CLASS() \
159 virtual const Class *getClass() const; \
161 static Class *m_theClass;
180 #define MTS_IMPLEMENT_CLASS(name, abstract, super) \
181 Class *name::m_theClass = new Class(#name, abstract, #super); \
182 const Class *name::getClass() const { \
198 #define MTS_IMPLEMENT_CLASS_I(name, abstract, super) \
199 Object *__##name ##_inst() { \
202 Class *name::m_theClass = new Class(#name, abstract, #super, (void *) &__##name ##_inst, NULL); \
203 const Class *name::getClass() const { \
219 #define MTS_IMPLEMENT_CLASS_S(name, abstract, super) \
220 Object *__##name ##_unSer(Stream *stream, InstanceManager *manager) { \
221 return new name(stream, manager); \
223 Class *name::m_theClass = new Class(#name, abstract, #super, NULL, (void *) &__##name ##_unSer); \
224 const Class *name::getClass() const { \
241 #define MTS_IMPLEMENT_CLASS_IS(name, abstract, super) \
242 Object *__##name ##_unSer(Stream *stream, InstanceManager *manager) { \
243 return new name(stream, manager); \
245 Object *__##name ##_inst() { \
248 Class *name::m_theClass = new Class(#name, abstract, #super, (void *) &__##name ##_inst, (void *) &__##name ##_unSer); \
249 const Class *name::getClass() const { \
const Class * getSuperClass() const
Return the Class object associated with the parent class of NULL if it does not have one...
Definition: class.h:80
bool isAbstract() const
Return whether or not the class represented by this Class object contains pure virtual methods...
Definition: class.h:69
const std::string & getName() const
Return the name of the represented class.
Definition: class.h:63
#define MTS_EXPORT_CORE
Definition: getopt.h:29
static bool rttiIsInitialized()
Check if the RTTI layer has been initialized.
Definition: class.h:102
bool isInstantiable() const
Does the class support instantiation over RTTI?
Definition: class.h:72
bool isSerializable() const
Does the class support serialization?
Definition: class.h:75
Stores meta-information about Object instances.
Definition: class.h:43
Parent of all Mitsuba classes.
Definition: object.h:38