cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy > Class Template Reference

A Pool is a container for pooled objects. More...

#include <cxxtools/pool.h>

Inheritance diagram for cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >:
cxxtools::NonCopyable

Classes

class  Ptr

Public Member Functions

 Pool (unsigned maxSpare_=0, CreatorType creator_=CreatorType())
 Pool (CreatorType creator_)
 ~Pool ()
Ptr get ()
void drop (unsigned keep=0)
unsigned getMaximumSize () const
unsigned size () const
unsigned getCurrentSize () const
void setMaximumSize (unsigned s)
CreatorType & getCreator ()
const CreatorType & getCreator () const

Additional Inherited Members

- Private Member Functions inherited from cxxtools::NonCopyable
 NonCopyable ()

Detailed Description

template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
class cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >

A Pool is a container for pooled objects.

It maintains a list of object instances which are not in use. If a program needs an instance, it can request one with the get-method. The pool returns a smart pointer to an instance. When the pointer is released, the instance is put back into the pool or dropped if the pool already has the maximum number of instances.

Constructor & Destructor Documentation

template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::Pool ( unsigned  maxSpare_ = 0,
CreatorType  creator_ = CreatorType() 
)
inlineexplicit
template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::Pool ( CreatorType  creator_)
inlineexplicit
template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::~Pool ( )
inline

Member Function Documentation

template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
void cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::drop ( unsigned  keep = 0)
inline
template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
Ptr cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::get ( )
inline
template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
CreatorType& cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::getCreator ( )
inline
template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
const CreatorType& cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::getCreator ( ) const
inline
template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
unsigned cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::getCurrentSize ( ) const
inline
template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
unsigned cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::getMaximumSize ( ) const
inline
template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
void cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::setMaximumSize ( unsigned  s)
inline
template<typename ObjectType, typename CreatorType = DefaultCreator<ObjectType>, template< class > class OwnershipPolicy = RefLinked, template< class > class DestroyPolicy = DeletePolicy>
unsigned cxxtools::Pool< ObjectType, CreatorType, OwnershipPolicy, DestroyPolicy >::size ( ) const
inline

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