Nori  23
NoriObjectFactory Class Reference

Factory for Nori objects. More...

#include <object.h>

Public Types

typedef std::function< NoriObject *(const PropertyList &)> Constructor
 

Static Public Member Functions

static void registerClass (const std::string &name, const Constructor &constr)
 Register an object constructor with the object factory. More...
 
static NoriObjectcreateInstance (const std::string &name, const PropertyList &propList)
 Construct an instance from the class of the given name. More...
 
static void printRegisteredClasses ()
 

Detailed Description

Factory for Nori objects.

This utility class is part of a mini-RTTI framework and can instantiate arbitrary Nori objects by their name.

Definition at line 128 of file object.h.

Member Function Documentation

◆ createInstance()

static NoriObject* NoriObjectFactory::createInstance ( const std::string &  name,
const PropertyList propList 
)
inlinestatic

Construct an instance from the class of the given name.

Parameters
nameAn internal name that is associated with this class. This is the 'type' field found in the scene description XML files
propListA list of properties that will be passed to the constructor of the class.

Definition at line 158 of file object.h.

◆ registerClass()

void NoriObjectFactory::registerClass ( const std::string &  name,
const Constructor &  constr 
)
static

Register an object constructor with the object factory.

This function is called by the macro NORI_REGISTER_CLASS

Parameters
nameAn internal name that is associated with this class. This is the 'type' field found in the scene description XML files
constrA function pointer to an anonymous function that is able to call the constructor of the class.

Definition at line 25 of file object.cpp.


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