![]() |
Vault
4.1
|
VClassFactory is the abstract base class that you subclass to provide a method that instantiates a particular type of object. More...
#include <vclassregistry.h>
Public Member Functions | |
VClassFactory (const VString &classID) | |
Constructs the factory. | |
virtual | ~VClassFactory () |
Destructor. | |
virtual void * | instantiateObject () const =0 |
Pure virtual method (must be overridden) that instantiates and returns an object of the appropriate type for this factory. | |
bool | matchesClassID (const VString &classID) const |
Tests to see if this factory is the one that knows how to instantiate a particular class ID. | |
void | getClassID (VString &classID) const |
Returns the class ID of this factory (useful for debugging). |
VClassFactory is the abstract base class that you subclass to provide a method that instantiates a particular type of object.
You need only provide an override of the pure virtual function instaniateObject(). However, it is useful to use the example of the FooFactory class above as the simplest way to get the factory registered automatically with a VClassRegistry at static initialization time.
Definition at line 167 of file vclassregistry.h.
V_STATIC_INIT_TRACE VClassFactory::VClassFactory | ( | const VString & | classID | ) |
Constructs the factory.
classID | the string that uniquely identifies the class |
Definition at line 18 of file vclassregistry.cpp.
virtual void* VClassFactory::instantiateObject | ( | ) | const [pure virtual] |
Pure virtual method (must be overridden) that instantiates and returns an object of the appropriate type for this factory.
bool VClassFactory::matchesClassID | ( | const VString & | classID | ) | const |
Tests to see if this factory is the one that knows how to instantiate a particular class ID.
classID | the class ID to test |
Definition at line 23 of file vclassregistry.cpp.
void VClassFactory::getClassID | ( | VString & | classID | ) | const |
Returns the class ID of this factory (useful for debugging).
Definition at line 27 of file vclassregistry.cpp.