PluginFactory< _ParentType, _SigType, _SlotType > Class Template Reference

#include <pluginfactory.h>

List of all members.

Public Member Functions

_ParentType * create (std::string type, xmlNode *node)
_ParentType * create (std::string type, std::map< std::string, std::string > attributes)
bool registerPlugin (std::string type, _SlotType createFunction)

Static Public Member Functions

static PluginFactory< _ParentType,
_SigType, _SlotType > * 
get_instance ()

Protected Attributes

std::map< std::string, _SigType > m_createFunctions
 Map of function pointers to methods for creating materials.


Detailed Description

template<class _ParentType, class _SigType, class _SlotType>
class PluginFactory< _ParentType, _SigType, _SlotType >

PluginFactory allows plugins to register themselves so that the parser can later create materials generically.

Definition at line 52 of file pluginfactory.h.


Member Function Documentation

template<class _ParentType, class _SigType, class _SlotType>
_ParentType* PluginFactory< _ParentType, _SigType, _SlotType >::create ( std::string  type,
xmlNode *  node 
) [inline]

Definition at line 81 of file pluginfactory.h.

References log_warn, and PluginFactory< _ParentType, _SigType, _SlotType >::m_createFunctions.

template<class _ParentType, class _SigType, class _SlotType>
_ParentType* PluginFactory< _ParentType, _SigType, _SlotType >::create ( std::string  type,
std::map< std::string, std::string >  attributes 
) [inline]

Creates a Material object based on the type and the passed in parameters

Parameters:
type String that the material type registered under
attributes Attributes used to build materials
Returns:
An initialized Material object
Deprecated:
Todo:
Remove this in favor of the create() fucntion that accepts the xmlNode

Definition at line 69 of file pluginfactory.h.

References log_warn, and PluginFactory< _ParentType, _SigType, _SlotType >::m_createFunctions.

template<class _ParentType, class _SigType, class _SlotType>
static PluginFactory<_ParentType, _SigType, _SlotType>* PluginFactory< _ParentType, _SigType, _SlotType >::get_instance (  )  [inline, static]

Return an instance of PluginFactory.

Returns:
instance of PluginFactory

Definition at line 116 of file pluginfactory.h.

References log_debug.

Referenced by SceneParser::parse_bumpmaps(), SceneParser::parse_light_sources(), SceneParser::parse_materials(), SceneParser::parse_objects(), SolidMaterial::SolidMaterialStaticInit::SolidMaterialStaticInit(), Sphere::StaticInit::StaticInit(), RippleBumpMap::StaticInit::StaticInit(), Polygon::StaticInit::StaticInit(), Plane::StaticInit::StaticInit(), NoiseMaterial::StaticInit::StaticInit(), MarbleMaterial::StaticInit::StaticInit(), ImageMap::StaticInit::StaticInit(), ConcentricBumpMap::StaticInit::StaticInit(), and CheckeredMaterial::StaticInit::StaticInit().

Here is the caller graph for this function:

template<class _ParentType, class _SigType, class _SlotType>
bool PluginFactory< _ParentType, _SigType, _SlotType >::registerPlugin ( std::string  type,
_SlotType  createFunction 
) [inline]

Registers the function to create materials of the given type.

Parameters:
type String that identifies the material type
createFunction Signal handler to create materials of the given type.
Returns:
True if successful. Will return false if a material has previously registered under the type name. The first to register will always win, and a warning will be logged that another attempt was made to register.

Definition at line 101 of file pluginfactory.h.

References log_debug, log_warn, and PluginFactory< _ParentType, _SigType, _SlotType >::m_createFunctions.


Member Data Documentation

template<class _ParentType, class _SigType, class _SlotType>
std::map<std::string, _SigType> PluginFactory< _ParentType, _SigType, _SlotType >::m_createFunctions [protected]

Map of function pointers to methods for creating materials.

Definition at line 56 of file pluginfactory.h.

Referenced by PluginFactory< _ParentType, _SigType, _SlotType >::create(), and PluginFactory< _ParentType, _SigType, _SlotType >::registerPlugin().


The documentation for this class was generated from the following file:
Generated on Tue Oct 30 22:12:23 2007 for mbrt by  doxygen 1.5.2