BasicDynamicClassFactory Class Reference

#include <BasicDynamicClassFactory.h>

Collaboration diagram for BasicDynamicClassFactory:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 BasicDynamicClassFactory ()
void * create ()
void destroy (void *x)
unsigned int getClassSize ()
 
Returns:
The current total size of the dynamic class.

unsigned int getNumNodes ()
 
Returns:
The current number of nodes in this dynamic class factory.

unsigned int getNumClasses ()
 
Returns:
The current number of existing instances of the dynamic class.


Protected Member Functions

void registerNode (BasicDynamicClassNodeBase *node)

Private Attributes

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

Friends

class BasicDynamicClassNodeBase


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.

Definition at line 63 of file BasicDynamicClassFactory.h.


Constructor & Destructor Documentation

BasicDynamicClassFactory::BasicDynamicClassFactory (  ) 

Definition at line 31 of file BasicDynamicClassFactory.cpp.


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.

Definition at line 35 of file BasicDynamicClassFactory.cpp.

References classSize, BasicArray< T >::getSize(), nodes, and numClasses.

Here is the call graph for this function:

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.

Definition at line 47 of file BasicDynamicClassFactory.cpp.

References numClasses.

unsigned int BasicDynamicClassFactory::getClassSize (  )  [inline]

Returns:
The current total size of the dynamic class.

Definition at line 91 of file BasicDynamicClassFactory.h.

References classSize.

unsigned int BasicDynamicClassFactory::getNumNodes (  )  [inline]

Returns:
The current number of nodes in this dynamic class factory.

Definition at line 94 of file BasicDynamicClassFactory.h.

References BasicArray< T >::getSize(), and nodes.

Here is the call graph for this function:

unsigned int BasicDynamicClassFactory::getNumClasses (  )  [inline]

Returns:
The current number of existing instances of the dynamic class.

Definition at line 97 of file BasicDynamicClassFactory.h.

References numClasses.

void BasicDynamicClassFactory::registerNode ( BasicDynamicClassNodeBase node  )  [protected]

This function is only callable by BasicDynamicClassNodeBase. See BasicDynamicClassNodeBase::registerNode().

Definition at line 52 of file BasicDynamicClassFactory.cpp.

References classSize, BasicDynamicClassNodeBase::getSize(), nodes, BasicArray< T >::put(), and BasicDynamicClassNodeBase::setOffset().

Referenced by BasicDynamicClassNodeBase::registerNode().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class BasicDynamicClassNodeBase [friend]

Definition at line 106 of file BasicDynamicClassFactory.h.


Member Data Documentation

unsigned int BasicDynamicClassFactory::classSize [private]

Definition at line 64 of file BasicDynamicClassFactory.h.

Referenced by create(), getClassSize(), and registerNode().

unsigned int BasicDynamicClassFactory::numClasses [private]

Definition at line 65 of file BasicDynamicClassFactory.h.

Referenced by create(), destroy(), and getNumClasses().

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

Definition at line 67 of file BasicDynamicClassFactory.h.

Referenced by create(), getNumNodes(), and registerNode().


The documentation for this class was generated from the following files:
Generated on Thu Feb 21 14:38:16 2008 for CompuCell3D by  doxygen 1.5.3