public

Inheritance Graph

graph BT
	ObjectPool
	click ObjectPool "classUtil_1_1ObjectPool"

Description

Generic object pool for objects.

The pool template can be instaniated to generate different kinds of pools. The generated pool generates and pools objects of typeObjectType. It hashes the parameters used to create an object and stores it in a map. If an object with the same hash already exists, it is returned instead of creating a new one.

Parameters

ObjectType
Base type for all objects that are generated by the factory
IdentifierType
Type of the identifier that specifies which object pool to call
FallbackPolicy
Template with a functiononUnknownType()that handles the case that the requested object type was not found

Classes

   
struct Util::ObjectPool::Pool

Public Types

   
   
typedef FallbackPolicy< ObjectType, IdentifierType > fallbackPolicy_t

Public Attributes

   
   
fallbackPolicy_t fallbackPolicy

Public Functions

   
   
  ObjectPool()
   
  ObjectPool( fallbackPolicy_t policy)
   
  ~ObjectPool()
   
void registerType(const IdentifierType & id, ObjectCreator creator)
   
void unregisterType(const IdentifierType & id)
   
bool hasType(const IdentifierType & id)
   
ObjectType create(const IdentifierType & id)
   
void free(const IdentifierType & id, const ObjectType & obj)
   
void reset()

Documentation

typedef
Util::ObjectPool::fallbackPolicy_t

public
 
 
typedef FallbackPolicy< ObjectType, IdentifierType > fallbackPolicy_t

Defined in Util/Factory/ObjectPool.h:50


variable
Util::ObjectPool::fallbackPolicy

public
 
 
fallbackPolicy_t fallbackPolicy

Defined in Util/Factory/ObjectPool.h:51


function
Util::ObjectPool::ObjectPool

public inline
   
   
ObjectPool( )

Defined in Util/Factory/ObjectPool.h:52


function
Util::ObjectPool::ObjectPool

public inline
     
     
ObjectPool( fallbackPolicy_t policy )

Defined in Util/Factory/ObjectPool.h:53


function
Util::ObjectPool::~ObjectPool

public
   
   
~ObjectPool( )

Defined in Util/Factory/ObjectPool.h:54


function
Util::ObjectPool::registerType

public inline
     
     
void registerType( const IdentifierType & id,
  ObjectCreator creator
)    

Defined in Util/Factory/ObjectPool.h:56


function
Util::ObjectPool::unregisterType

public inline
     
     
void unregisterType( const IdentifierType & id )

Defined in Util/Factory/ObjectPool.h:63


function
Util::ObjectPool::hasType

public inline
     
     
bool hasType( const IdentifierType & id )

Defined in Util/Factory/ObjectPool.h:67


function
Util::ObjectPool::create

public inline
     
     
ObjectType create( const IdentifierType & id )

Defined in Util/Factory/ObjectPool.h:71


function
Util::ObjectPool::free

public inline
     
     
void free( const IdentifierType & id,
  const ObjectType & obj
)    

Defined in Util/Factory/ObjectPool.h:82


function
Util::ObjectPool::reset

public inline
   
   
void reset( )

Defined in Util/Factory/ObjectPool.h:88