Atlas-C++
|
Trait which handles allocation of instances of BaseObject. More...
#include <BaseObject.h>
Public Member Functions | |
Allocator () | |
Ctor. | |
~Allocator () | |
Dtor. | |
T * | getDefaultObjectInstance () |
Gets the default object instance, which acts as a prototype for all other instances in the system. More... | |
T * | alloc () |
Allocates a new instance to be used. More... | |
void | free (T *instance) |
Frees up an instance. More... | |
void | release () |
Deletes all pooled but unused instances. | |
Public Attributes | |
std::map< std::string, int32_t > | attr_flags_Data |
A map of attributes and their flags. | |
Protected Attributes | |
T | m_defaults_Data |
The default instance, acting as a prototype for all other instances. | |
T * | m_begin_Data |
The first available instance, not currently in use. More... | |
Trait which handles allocation of instances of BaseObject.
This class handles allocation and deallocation of templates BaseObject instances. Instead of creating and deleting BaseObjects as they are used we keep a small pool around, reusing old instances when needed.
This class is tightly coupled with both SmartPtr and BaseObject and rely on a couple of templated naming conventions. Any subclass of BaseObject should therefore keep a static instance of this in a field named "allocator".
|
inline |
Allocates a new instance to be used.
This will either reuse and existing instance or create a new, depending of whether there's a free unused instance available.
|
inline |
Frees up an instance.
This means that the instance will be returned to the pool, ready to be used again.
instance | The instance to free. |
|
inline |
Gets the default object instance, which acts as a prototype for all other instances in the system.
Any alterations made to the prototype instance will reflect on all other instances of the same class.
|
protected |
The first available instance, not currently in use.
If this is null, a new instance needs to be created.
Copyright 2000-2004 the respective authors.
This document can be licensed under the terms of the GNU Free Documentation License or the GNU General Public License and may be freely distributed under the terms given by one of these licenses.