Overview     Modules     Class Hierarchy     Classes     Members  
tlp::TemplateFactory< ObjectFactory, ObjectType, Context > Class Template Reference

This template class takes 3 parameters : More...

#include <TemplateFactory.h>

Inheritance diagram for tlp::TemplateFactory< ObjectFactory, ObjectType, Context >:
Collaboration diagram for tlp::TemplateFactory< ObjectFactory, ObjectType, Context >:

List of all members.

Public Types

typedef std::map< std::string,
ObjectFactory * > 
ObjectCreator

Public Member Functions

 TemplateFactory ()
ObjectType * getPluginObject (const std::string &name, Context p)
 Constructs a plug-in.
Iterator< std::string > * availablePlugins ()
 Gets the list of plug-ins that registered themselves in this factory.
bool pluginExists (const std::string &pluginName)
 Checks if a given name is registered in this factory.
const ParameterDescriptionListgetPluginParameters (std::string name)
 Gets the whole parameters for the given plug-in.
const std::string & getPluginRelease (std::string name)
 Gets the release number of the given plug-in.
const std::list
< tlp::Dependency > & 
getPluginDependencies (std::string name)
 Gets the dependencies of a plug-in.
std::string getPluginsClassName ()
 Gets the class name for the plug-in's registered class. If the class is in the tlp namespace, the 'tlp::' prefix is removed.
void registerPlugin (ObjectFactory *objectFactory)
void removePlugin (const std::string &name)
 Removes a plug-in from this factory. This is usefull when a plug-in has unmet dependencies, or appears more than once.
Iterator< ObjectFactory * > * availablePluginObjects ()
- Public Member Functions inherited from tlp::TemplateFactoryInterface
virtual ~TemplateFactoryInterface ()

Public Attributes

ObjectCreator objMap
 Stores the factories that register into this TemplateFactory.
std::map< std::string,
ParameterDescriptionList
objParam
 Stores the parameters of each registered plug-in.
std::set< std::string > objNames
 Stores the list of registered plug-ins.
std::map< std::string,
std::list< tlp::Dependency > > 
objDeps
 Stores the dependencies of the registered plug-ins.
std::map< std::string,
std::string > 
objRels
 Stores the release version of the registered plug-ins.

Additional Inherited Members

- Static Public Member Functions inherited from tlp::TemplateFactoryInterface
static std::string standardizeName (const char *name)
 standardize a factory name
static void addFactory (TemplateFactoryInterface *factory, const std::string &name)
 Adds a factory to a static map of factories. This map is then used to list all the factories, and all the plug-ins for each factory.
static bool pluginExists (const std::string &factoryName, const std::string &pluginName)
 Checks if a plug-in exists in a specific factory. In debug mode, an assert checks the factory is registered in the factory map before accessing it.
- Static Public Attributes inherited from tlp::TemplateFactoryInterface
static TLP_SCOPE std::map
< std::string,
TemplateFactoryInterface * > * 
allFactories
static TLP_SCOPE PluginLoadercurrentLoader

Detailed Description

template<class ObjectFactory, class ObjectType, class Context>
class tlp::TemplateFactory< ObjectFactory, ObjectType, Context >

This template class takes 3 parameters :

  • The type of factory that it will list,
  • The type of object said factories build,
  • The type of object to pass as parameter to the objects when building them.

When constructed it registers itself into the factories map automatically.


Member Typedef Documentation

template<class ObjectFactory, class ObjectType, class Context>
typedef std::map< std::string , ObjectFactory * > tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::ObjectCreator

Constructor & Destructor Documentation

template<class ObjectFactory, class ObjectType, class Context>
tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::TemplateFactory ( )
inline

Member Function Documentation

template<class ObjectFactory, class ObjectType, class Context>
Iterator<ObjectFactory *>* tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::availablePluginObjects ( )
template<class ObjectFactory, class ObjectType, class Context>
Iterator<std::string>* tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::availablePlugins ( )
virtual

Gets the list of plug-ins that registered themselves in this factory.

Returns:
:Iterator< std::string >* An iterator over the names of the plug-ins registered in this factory.

Implements tlp::TemplateFactoryInterface.

template<class ObjectFactory, class ObjectType, class Context>
const std::list<tlp::Dependency>& tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::getPluginDependencies ( std::string  name)
virtual

Gets the dependencies of a plug-in.

Parameters:
nameThe name of the plug-in to retrieve the dependencies of.
Returns:
:list< tlp::Dependency, std::allocator< tlp::Dependency > > The list of dependencies of the plug-in.

Implements tlp::TemplateFactoryInterface.

template<class ObjectFactory, class ObjectType, class Context>
ObjectType* tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::getPluginObject ( const std::string &  name,
Context  p 
)

Constructs a plug-in.

Parameters:
nameThe name of the plug-in to instantiate.
pThe context to give to the plug-in.
Returns:
ObjectType* The newly constructed plug-in.
template<class ObjectFactory, class ObjectType, class Context>
const ParameterDescriptionList& tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::getPluginParameters ( std::string  name)
virtual

Gets the whole parameters for the given plug-in.

Parameters:
nameThe name of the plug-in to retrieve the parameters of.
Returns:
:PluginParameters The whole parameters of the plug-in.

Implements tlp::TemplateFactoryInterface.

template<class ObjectFactory, class ObjectType, class Context>
const std::string& tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::getPluginRelease ( std::string  name)
virtual

Gets the release number of the given plug-in.

Parameters:
nameThe name of the plug-in to retrieve the version number of.
Returns:
:string The version number, ussually formatted as X[.Y], where X is the major, and Y the minor.

Implements tlp::TemplateFactoryInterface.

template<class ObjectFactory, class ObjectType, class Context>
std::string tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::getPluginsClassName ( )
virtual

Gets the class name for the plug-in's registered class. If the class is in the tlp namespace, the 'tlp::' prefix is removed.

Returns:
:string The class name of the plug-in.

Implements tlp::TemplateFactoryInterface.

template<class ObjectFactory, class ObjectType, class Context>
bool tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::pluginExists ( const std::string &  pluginName)
virtual

Checks if a given name is registered in this factory.

Parameters:
pluginNameThe name of the plug-in to look for.
Returns:
bool Whether there is a plug-in with the given name registered in this factory.

Implements tlp::TemplateFactoryInterface.

template<class ObjectFactory, class ObjectType, class Context>
void tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::registerPlugin ( ObjectFactory *  objectFactory)
template<class ObjectFactory, class ObjectType, class Context>
void tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::removePlugin ( const std::string &  name)
virtual

Removes a plug-in from this factory. This is usefull when a plug-in has unmet dependencies, or appears more than once.

Parameters:
nameThe name of the plug-in to remove.
Returns:
void

Implements tlp::TemplateFactoryInterface.


Member Data Documentation

template<class ObjectFactory, class ObjectType, class Context>
std::map<std::string, std::list<tlp::Dependency> > tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::objDeps

Stores the dependencies of the registered plug-ins.

template<class ObjectFactory, class ObjectType, class Context>
ObjectCreator tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::objMap

Stores the factories that register into this TemplateFactory.

template<class ObjectFactory, class ObjectType, class Context>
std::set<std::string> tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::objNames

Stores the list of registered plug-ins.

template<class ObjectFactory, class ObjectType, class Context>
std::map<std::string, ParameterDescriptionList> tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::objParam

Stores the parameters of each registered plug-in.

template<class ObjectFactory, class ObjectType, class Context>
std::map<std::string, std::string> tlp::TemplateFactory< ObjectFactory, ObjectType, Context >::objRels

Stores the release version of the registered plug-ins.



Tulip Software by LaBRI Visualization Team    2001 - 2012