#include <iopcClassFactory.h>
Public Member Functions | |
~IopcClassFactory () | |
void | addClass (const char *className, IopcPersistentObject *(*createInstance)(), RefBase *(*createReference)()) |
int | getClass (const char *className, IopcPersistentObject *(*&createInstance)(), RefBase *(*&createReference)()) |
Protected Attributes | |
void * | classFactoryMap |
These functions are static, their names are iopcCreateInstance()
and iopcCreateReference()
and their implementation is generated by IOPC SP.
Class IopcClassFactory has only one instance - iopcClassFactory.
This class doesn't have constructor and doesn't contain any attributes with constructors, so it is possible to call addClass() from constructors of other global objects (space for the class is allocated before any constructor is executed) and initialize the only class's attribute in the first addClass() call. This is done because it is not guaranteed in which order constructors of global objects from different modules will be executed.
The objects from whose constructors is addClass() called are instances of template IopcClassRegistrar.
|
Destructor. Destroys classFactoryMap.
|
|
Adds information about a class to the container. If called for the first time, allocates a map of type ClassFactoryMap and puts its address into classFactoryMap. First call is distingushed from the value of classFactoryMap - because the only instance of this class is global, in the first call value of this attribute must be NULL. Always adds information from its parameters to the map.
|
|
Finds class specified by Used by IopcClassObjectImpl::createInstance() and IopcClassObjectImpl::createReference().
|
|
Map - key = class name, value = pointers to The map must be created dynamically when addClass() is called for the first time (because IopcClassFactory's constructor can be called later - order of global object constructor calls is linker dependent). We know that memory for each global object is zero filled before any constructor call, so we can find out, whether addClass() is called for the first time or not.
Variable is declared as pointer to void because I don't want to include anything from STL in headers that are included into |