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

The plugin manager is responsible for resolving and loading external plugins. More...

#include <mitsuba/core/plugin.h>

+ Inheritance diagram for mitsuba::PluginManager:

Public Member Functions

void ensurePluginLoaded (const std::string &name)
 Ensure that a plugin is loaded and ready. More...
 
std::vector< std::string > getLoadedPlugins () const
 Return the list of loaded plugins. More...
 
ConfigurableObjectcreateObject (const Class *classType, const Properties &props)
 Instantiate a plugin, verify its type, and return the newly created instance. More...
 
ConfigurableObjectcreateObject (const Properties &props)
 Instantiate a plugin and return the new instance (without verifying its type). More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const
 Return a human-readable string representation of the object's contents. More...
 

Static Public Member Functions

static PluginManagergetInstance ()
 Return the global plugin manager. More...
 
static void staticInitialization ()
 Initializes the global plugin manager instance. More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 
- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

 PluginManager ()
 
 ~PluginManager ()
 Destruct and unload all plugins. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Detailed Description

The plugin manager is responsible for resolving and loading external plugins.

Ordinarily, this class will be used by making repeated calls to the createObject() methods. The generated instances are then assembled into a final object graph, such as a scene. One such examples is the SceneHandler class, which parses an XML scene file by esentially translating the XML elements into calls to createObject().

Since this kind of construction method can be tiresome when dynamically building scenes from Python, this class has an additional Python-only method create(), which works as follows:

from mitsuba.core import *
pmgr = PluginManager.getInstance()
camera = pmgr.create({
"type" : "perspective",
"toWorld" : Transform.lookAt(
Point(0, 0, -10),
Point(0, 0, 0),
Vector(0, 1, 0)
),
"film" : {
"type" : "ldrfilm",
"width" : 1920,
"height" : 1080
}
})

The above snippet constructs a Camera instance from a plugin named perspective.so/dll/dylib and adds a child object named film, which is a Film instance loaded from the plugin ldrfilm.so/dll/dylib. By the time the function returns, the object hierarchy has already been assembled, and the ConfigurableObject::configure() methods of every object has been called.

Constructor & Destructor Documentation

mitsuba::PluginManager::PluginManager ( )
protected
mitsuba::PluginManager::~PluginManager ( )
protected

Destruct and unload all plugins.

Member Function Documentation

ConfigurableObject* mitsuba::PluginManager::createObject ( const Class classType,
const Properties props 
)

Instantiate a plugin, verify its type, and return the newly created instance.

Parameters
classTypeExpected type of the plugin. An exception will be thrown if it turns out not to derive from this class.
propsA Properties instance containing all information required to find and construct the plugin.
ConfigurableObject* mitsuba::PluginManager::createObject ( const Properties props)

Instantiate a plugin and return the new instance (without verifying its type).

Parameters
propsA Properties instance containing all information required to find and construct the plugin.
void mitsuba::PluginManager::ensurePluginLoaded ( const std::string &  name)

Ensure that a plugin is loaded and ready.

virtual const Class* mitsuba::PluginManager::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

static PluginManager* mitsuba::PluginManager::getInstance ( )
inlinestatic

Return the global plugin manager.

std::vector<std::string> mitsuba::PluginManager::getLoadedPlugins ( ) const

Return the list of loaded plugins.

static void mitsuba::PluginManager::staticInitialization ( )
static

Initializes the global plugin manager instance.

static void mitsuba::PluginManager::staticShutdown ( )
static

Free the memory taken by staticInitialization()

Member Data Documentation

Class* mitsuba::PluginManager::m_theClass
static

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