public

Inheritance Graph

graph BT
	ObjectCache
	click ObjectCache "classUtil_1_1ObjectCache"

Description

Generic object cache for objects allowing lambdas with variable number of arguments as cache functions.

The cache template can be instaniated to generate different kinds of caches. The generated cache generates and caches 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 cache to call
FallbackPolicy
Template with a functiononUnknownType()that handles the case that the requested object type was not found

Classes

   
struct Util::ObjectCache::Cache

Public Types

   
   
typedef FallbackPolicy< ObjectType, IdentifierType > fallbackPolicy_t

Public Attributes

   
   
fallbackPolicy_t fallbackPolicy

Public Functions

   
   
  ObjectCache()
   
  ObjectCache( fallbackPolicy_t policy)
   
  ~ObjectCache()
template< typename ObjectCreator >  
void registerType(const IdentifierType & id, ObjectCreator creator)
   
void unregisterType(const IdentifierType & id)
   
bool hasType(const IdentifierType & id)
template< typename… Args >  
ObjectType create(const IdentifierType & id, Args… args)
   
void release(const IdentifierType & id, size_t hash)
   
void reset()

Documentation

typedef
Util::ObjectCache::fallbackPolicy_t

public
 
 
typedef FallbackPolicy< ObjectType, IdentifierType > fallbackPolicy_t

Defined in Util/Factory/ObjectCache.h:48


variable
Util::ObjectCache::fallbackPolicy

public
 
 
fallbackPolicy_t fallbackPolicy

Defined in Util/Factory/ObjectCache.h:49


function
Util::ObjectCache::ObjectCache

public inline
   
   
ObjectCache( )

Defined in Util/Factory/ObjectCache.h:50


function
Util::ObjectCache::ObjectCache

public inline
     
     
ObjectCache( fallbackPolicy_t policy )

Defined in Util/Factory/ObjectCache.h:52


function
Util::ObjectCache::~ObjectCache

public inline
   
   
~ObjectCache( )

Defined in Util/Factory/ObjectCache.h:54


function
Util::ObjectCache::registerType

public inline
     
template< typename ObjectCreator >    
void registerType( const IdentifierType & id,
  ObjectCreator creator
)    

Defined in Util/Factory/ObjectCache.h:60


function
Util::ObjectCache::unregisterType

public inline
     
     
void unregisterType( const IdentifierType & id )

Defined in Util/Factory/ObjectCache.h:70


function
Util::ObjectCache::hasType

public inline
     
     
bool hasType( const IdentifierType & id )

Defined in Util/Factory/ObjectCache.h:77


function
Util::ObjectCache::create

public inline
     
template< typename… Args >    
ObjectType create( const IdentifierType & id,
  Args… args
)    

Defined in Util/Factory/ObjectCache.h:82


function
Util::ObjectCache::release

public inline
     
     
void release( const IdentifierType & id,
  size_t hash
)    

Defined in Util/Factory/ObjectCache.h:103


function
Util::ObjectCache::reset

public inline
   
   
void reset( )

Defined in Util/Factory/ObjectCache.h:110