Vault  4.1
Public Member Functions
VClassFactory Class Reference

VClassFactory is the abstract base class that you subclass to provide a method that instantiates a particular type of object. More...

#include <vclassregistry.h>

List of all members.

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).

Detailed Description

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.


Constructor & Destructor Documentation

V_STATIC_INIT_TRACE VClassFactory::VClassFactory ( const VString classID)

Constructs the factory.

Parameters:
classIDthe string that uniquely identifies the class

Definition at line 18 of file vclassregistry.cpp.


Member Function Documentation

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.

Returns:
the newly instantiated object
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.

Parameters:
classIDthe class ID to test
Returns:
true if this is the factory for that class ID

Definition at line 23 of file vclassregistry.cpp.

void VClassFactory::getClassID ( VString classID) const

Returns the class ID of this factory (useful for debugging).

Returns:
the class ID of this factory

Definition at line 27 of file vclassregistry.cpp.


The documentation for this class was generated from the following files:

Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.