The plugin manager is responsible for resolving and loading external plugins. More...
#include <mitsuba/core/plugin.h>
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... | |
ConfigurableObject * | createObject (const Class *classType, const Properties &props) |
Instantiate a plugin, verify its type, and return the newly created instance. More... | |
ConfigurableObject * | createObject (const Properties &props) |
Instantiate a plugin and return the new instance (without verifying its type). More... | |
virtual const Class * | getClass () 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 PluginManager * | getInstance () |
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 Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_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... | |
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:
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.
|
protected |
|
protected |
Destruct and unload all plugins.
ConfigurableObject* mitsuba::PluginManager::createObject | ( | const Class * | classType, |
const Properties & | props | ||
) |
Instantiate a plugin, verify its type, and return the newly created instance.
classType | Expected type of the plugin. An exception will be thrown if it turns out not to derive from this class. |
props | A 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).
props | A 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 |
Retrieve this object's class.
Reimplemented from Object.
|
inlinestatic |
Return the global plugin manager.
std::vector<std::string> mitsuba::PluginManager::getLoadedPlugins | ( | ) | const |
Return the list of loaded plugins.
|
static |
Initializes the global plugin manager instance.
|
static |
Free the memory taken by staticInitialization()
|
static |