Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

BasicDynamicClassFactory Class Reference

Manages dynamic class aggregation. More...

#include <BasicDynamicClassFactory.h>

Collaboration diagram for BasicDynamicClassFactory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BasicDynamicClassFactory ()
void * create ()
 This function will allocate one contiguous block of memory the size of the sum of the sizes of the registered class nodes.
void destroy (void *x)
 Deallocate a dynamic class.
unsigned int getClassSize ()
 The current total size of the dynamic class.
unsigned int getNumNodes ()
 The current number of nodes in this dynamic class factory.
unsigned int getNumClasses ()
 The current number of existing instances of the dynamic class.

Protected Member Functions

void registerNode (BasicDynamicClassNodeBase *node)
 This function is only callable by BasicDynamicClassNodeBase.

Private Attributes

unsigned int classSize
unsigned int numClasses
BasicArray< BasicDynamicClassNodeBase * > nodes

Detailed Description

Manages dynamic class aggregation.

BasicDynamicClassNode(s) can be be registered with an instance of a BasicDynamicClassFactory to create type safe dynamically aggregated classes.

Pros:

Cons:

Don't use this class unless you know why and how to use it.

See also this similar class BasicClassGroupFactory.


Constructor & Destructor Documentation

BasicDynamicClassFactory::BasicDynamicClassFactory  ) 
 


Member Function Documentation

void * BasicDynamicClassFactory::create  ) 
 

This function will allocate one contiguous block of memory the size of the sum of the sizes of the registered class nodes.

If the registered class nodes have overridden the BasicDynamicClassNode::init() function it will be called first. WARNING the constructors of the dynamic class nodes are NOT called.

Returns:
A new instance of the dynamic class.

void BasicDynamicClassFactory::destroy void *  x  ) 
 

Deallocate a dynamic class.

WARNING the destructors are NOT called.

Parameters:
x A pointer the the dynamic class do be destroyed.

unsigned int BasicDynamicClassFactory::getClassSize  )  [inline]
 

The current total size of the dynamic class.

unsigned int BasicDynamicClassFactory::getNumClasses  )  [inline]
 

The current number of existing instances of the dynamic class.

unsigned int BasicDynamicClassFactory::getNumNodes  )  [inline]
 

The current number of nodes in this dynamic class factory.

void BasicDynamicClassFactory::registerNode BasicDynamicClassNodeBase node  )  [protected]
 

This function is only callable by BasicDynamicClassNodeBase.

See BasicDynamicClassNodeBase::registerNode().


Member Data Documentation

unsigned int BasicDynamicClassFactory::classSize [private]
 

BasicArray<BasicDynamicClassNodeBase *> BasicDynamicClassFactory::nodes [private]
 

unsigned int BasicDynamicClassFactory::numClasses [private]
 


The documentation for this class was generated from the following files:
Generated on Thu Sep 16 16:17:23 2004 for nostdinc by doxygen 1.3.8