Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Class Class Reference

Stores meta-information about Object instances. More...

#include <mitsuba/mitsuba.h>

Public Member Functions

 Class (const std::string &name, bool abstract, const std::string &superClassName, void *instPtr=NULL, void *unSerPtr=NULL)
 Construct a new class descriptor. More...
 
const std::string & getName () const
 Return the name of the represented class. More...
 
bool isAbstract () const
 Return whether or not the class represented by this Class object contains pure virtual methods. More...
 
bool isInstantiable () const
 Does the class support instantiation over RTTI? More...
 
bool isSerializable () const
 Does the class support serialization? More...
 
const ClassgetSuperClass () const
 Return the Class object associated with the parent class of NULL if it does not have one. More...
 
bool derivesFrom (const Class *theClass) const
 Check whether this class derives from theClass. More...
 
Objectunserialize (Stream *stream=NULL, InstanceManager *manager=NULL) const
 Unserialize an instance of the class (if this is supported). More...
 
Objectinstantiate () const
 Generate an instance of this class (if this is supported) More...
 

Static Public Member Functions

static const ClassforName (const std::string &name)
 Look up a class by its name. More...
 
static const ClassforName (const char *name)
 Look up a class by its name. Avoids allocating heap space by taking a character array as parameter. More...
 
static bool rttiIsInitialized ()
 Check if the RTTI layer has been initialized. More...
 
static void staticInitialization ()
 Initializes the built-in RTTI and creates a list of all compiled classes. More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Detailed Description

Stores meta-information about Object instances.

This class provides a thin layer of RTTI (run-time type information), which is useful for doing things like:

  • Checking if an object derives from a certain class
  • Determining the parent of a class at runtime
  • Instantiating a class by name
  • Unserializing a class from a binary data stream
See Also
ref, Object

Constructor & Destructor Documentation

Class::Class ( const std::string &  name,
bool  abstract,
const std::string &  superClassName,
void *  instPtr = NULL,
void *  unSerPtr = NULL 
)

Construct a new class descriptor.

This method should never be called manually. Instead, use one of the MTS_IMPLEMENT_CLASS, MTS_IMPLEMENT_CLASS_S, MTS_IMPLEMENT_CLASS_I or MTS_IMPLEMENT_CLASS_IS macros to automatically do this for you.

Parameters
nameName of the class
abstracttrue if the class contains pure virtual methods
superClassNameName of the parent class
instPtrPointer to an instantiation function
unSerPtrPointer to an unserialization function

Member Function Documentation

bool Class::derivesFrom ( const Class theClass) const

Check whether this class derives from theClass.

static const Class* Class::forName ( const std::string &  name)
static

Look up a class by its name.

static const Class* Class::forName ( const char *  name)
static

Look up a class by its name. Avoids allocating heap space by taking a character array as parameter.

const std::string& Class::getName ( ) const
inline

Return the name of the represented class.

const Class* Class::getSuperClass ( ) const
inline

Return the Class object associated with the parent class of NULL if it does not have one.

Object* Class::instantiate ( ) const

Generate an instance of this class (if this is supported)

bool Class::isAbstract ( ) const
inline

Return whether or not the class represented by this Class object contains pure virtual methods.

bool Class::isInstantiable ( ) const
inline

Does the class support instantiation over RTTI?

bool Class::isSerializable ( ) const
inline

Does the class support serialization?

static bool Class::rttiIsInitialized ( )
inlinestatic

Check if the RTTI layer has been initialized.

static void Class::staticInitialization ( )
static

Initializes the built-in RTTI and creates a list of all compiled classes.

static void Class::staticShutdown ( )
static

Free the memory taken by staticInitialization()

Object* Class::unserialize ( Stream *  stream = NULL,
InstanceManager *  manager = NULL 
) const

Unserialize an instance of the class (if this is supported).


The documentation for this class was generated from the following file: