Loki::CachedFactory< AbstractProduct, IdentifierType, CreatorParmTList, EncapsulationPolicy, CreationPolicy, EvictionPolicy, StatisticPolicy, FactoryErrorPolicy, ObjVector > Class Template Reference
[Cached Factory]

Factory with caching support. More...

#include <CachedFactory.h>

Collaboration diagram for Loki::CachedFactory< AbstractProduct, IdentifierType, CreatorParmTList, EncapsulationPolicy, CreationPolicy, EvictionPolicy, StatisticPolicy, FactoryErrorPolicy, ObjVector >:

[legend]
List of all members.

Public Types

typedef NP::ProductReturn ProductReturn

Public Member Functions

 CachedFactory ()
 ~CachedFactory ()
bool Register (const IdentifierType &id, ProductCreator creator)
template<class PtrObj, typename CreaFn>
bool Register (const IdentifierType &id, const PtrObj &p, CreaFn fn)
bool Unregister (const IdentifierType &id)
std::vector< IdentifierType > & RegisteredIds ()
 Return the registered ID in this Factory.
ProductReturn CreateObject (const IdentifierType &id)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, Parm12 p12)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, Parm12 p12, Parm13 p13)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14)
ProductReturn CreateObject (const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8, Parm9 p9, Parm10 p10, Parm11 p11, Parm12 p12, Parm13 p13, Parm14 p14, Parm15 p15)
void ReleaseObject (ProductReturn &object)
 Use this function to release the object.
void displayCacheType ()
 display the cache configuration

Protected Member Functions

virtual void remove (AbstractProduct *const pProduct)

Detailed Description

template<class AbstractProduct, typename IdentifierType, typename CreatorParmTList = NullType, template< class > class EncapsulationPolicy = SimplePointer, class CreationPolicy = AlwaysCreate, template< typename, typename > class EvictionPolicy = EvictRandom, class StatisticPolicy = NoStatisticPolicy, template< typename, class > class FactoryErrorPolicy = DefaultFactoryError, class ObjVector = std::vector<AbstractProduct*>>
class Loki::CachedFactory< AbstractProduct, IdentifierType, CreatorParmTList, EncapsulationPolicy, CreationPolicy, EvictionPolicy, StatisticPolicy, FactoryErrorPolicy, ObjVector >

Factory with caching support.

This class acts as a Factory (it creates objects) but also keeps the already created objects to prevent long constructions time.

Note this implementation do not retain ownership.

Definition at line 660 of file CachedFactory.h.


Member Function Documentation

template<class AbstractProduct, typename IdentifierType, typename CreatorParmTList = NullType, template< class > class EncapsulationPolicy = SimplePointer, class CreationPolicy = AlwaysCreate, template< typename, typename > class EvictionPolicy = EvictRandom, class StatisticPolicy = NoStatisticPolicy, template< typename, class > class FactoryErrorPolicy = DefaultFactoryError, class ObjVector = std::vector<AbstractProduct*>>
void Loki::CachedFactory< AbstractProduct, IdentifierType, CreatorParmTList, EncapsulationPolicy, CreationPolicy, EvictionPolicy, StatisticPolicy, FactoryErrorPolicy, ObjVector >::ReleaseObject ( ProductReturn object  )  [inline]

Use this function to release the object.

if execution brakes in this function then you tried to release an object that wasn't provided by this Cache ... which is bad :-)

Definition at line 1140 of file CachedFactory.h.


The documentation for this class was generated from the following file:
Generated on Sun Feb 25 16:52:35 2007 for Loki by  doxygen 1.5.1-p1