|
latest version v1.9 - last update 24 Nov 2005 |
|
#include <ltiObjectFactory.h>
Inheritance diagram for lti::objectFactory< T >:


Public Member Functions | |
| objectFactory (const char **names, const T *const *objs) | |
| objectFactory (const T *const *objs) | |
| virtual | ~objectFactory () |
| virtual const char * | getTypeName () const |
| virtual T * | newInstance (const char *name) const |
| virtual T * | newInstance (const std::string &name) const |
The instantiation of this class will fail if the template argument T is not a class which defines the clone() method. Usually, you will use an instance of this class as a class variable (C jargon: static class member). This class is thread-safe.
Please note that the C-type lists used in the constructor must be null-terminated.
|
||||||||||||||||
|
Constructor.
Creates an object factory which is able to handle the types whose names and prototypes are given in these two tables. const char* names[]={ "object1", "object2", "object3", 0 }; const obj_type* prototypes[] = { new object1(), new object2(), new object3(), 0 }; objectFactor<obj_type> t(names,prototypes);
|
|
||||||||||
|
Constructor. Creates an object factory which is able to handle the types whose prototypes are given in this table. The parameter is a null-terminated array of pointers. The names of the prototypes are determined via the className functor. Example:
const obj_type* prototypes[] = { new object1(), new object2(), new object3(), 0 }; objectFactor<obj_type> t(prototypes);
|
|
|||||||||
|
Destructor.
|
|
|||||||||
|
returns the name of this type ("objectFactory")
Reimplemented from lti::object. |
|
||||||||||
|
Creates a new instance of the class whose name is given as parameter, if this class is known to the factory. Otherwise, it returns null.
|
|
||||||||||
|
Creates a new instance of the class whose name is given as parameter, if this class is known to the factory. Otherwise, it returns null.
|