# BasicClassGroupFactory Class Reference

Manages (de)allocation of groups of classes in a type safe manner. More...

`#include <BasicClassGroupFactory.h>`

Inheritance diagram for BasicClassGroupFactory:

[legend]
Collaboration diagram for BasicClassGroupFactory:

[legend]
List of all members.

## Public Member Functions

virtual | ~BasicClassGroupFactory ()
void | registerClass (BasicClassAccessorBase *accessor)
| Register a new class with the group.
virtual BasicClassGroup * | create ()
| The constructors of each of the classes in the group will be called in the order they where registered with the factory.
virtual void | destroy (BasicClassGroup *group)
| The destructors of each of the classes in the group will be called in the order they were registered with the factory.

## Private Attributes

BasicArray< BasicClassFactoryBase< void > * > | classFactories

## Detailed Description

Manages (de)allocation of groups of classes in a type safe manner.

Pros:

- Classes can be dynamically added to the group after compile time.
- Unlike BasicDynamicClassFactory constructors and destructors are called.
- Unlike BasicDynamicClassFactory virtual classes are ok.

Cons:

- Used more memory than BasicDynamicClassFactory because a list of pointers to the classes is kept in each BasicClassGroup.
- If you want to use a constructor with arguments you must override both BasicClassFactory::create() and BasicClassAccessor::createClassFactory() with your own implementations.

See also BasicDynamicClassFactory.

## Constructor & Destructor Documentation

BasicClassGroupFactory::~BasicClassGroupFactory | ( |  | ) | `[virtual]`

## Member Function Documentation

BasicClassGroup * BasicClassGroupFactory::create | ( |  | ) | `[virtual]`

The constructors of each of the classes in the group will be called in the order they where registered with the factory.

Returns:
  A new instance of the class group.

Implements BasicClassFactoryBase< BasicClassGroup >.

void BasicClassGroupFactory::destroy | ( | BasicClassGroup * | group | ) | `[virtual]`

The destructors of each of the classes in the group will be called in the order they were registered with the factory.

Parameters:

  | group | The class group to be deallocated.

Implements BasicClassFactoryBase< BasicClassGroup >.

void BasicClassGroupFactory::registerClass | ( | BasicClassAccessorBase * | accessor | ) |

Register a new class with the group.

BasicClassAccessor::createClassFactory() is called to get an instance of the class factory. BasicClassGroupFactory will deallocate this factory when it is destructed.

Parameters:

  | accessor | The accessor for the class.

## Member Data Documentation

BasicArray<BasicClassFactoryBase<void> *> BasicClassGroupFactory::classFactories `[private]`

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

- BasicClassGroupFactory.h
- BasicClassGroupFactory.cpp