35 #ifndef IECORE_COMPUTATIONCACHE_H
36 #define IECORE_COMPUTATIONCACHE_H
38 #include "boost/function.hpp"
40 #include "IECore/LRUCache.h"
41 #include "IECore/ObjectPool.h"
49 template<
typename T >
55 typedef boost::function<IECore::ConstObjectPtr ( const T & )> ComputeFn;
56 typedef boost::function<IECore::MurmurHash ( const T & )> HashFn;
73 void erase(
const T &args );
96 ConstObjectPtr
get(
const T &args,
MissingBehaviour missingBehaviour = ComputeIfMissing );
99 void set(
const T &args,
const Object *obj, StoreMode storeMode );
106 ComputeFn m_computeFn;
112 ObjectPoolPtr m_objectPool;
120 #include "IECore/ComputationCache.inl"
122 #endif // IECORE_COMPUTATIONCACHE_H
size_t getMaxComputations() const
Returns the maximum number of stored computations in the cache.
void clear()
Removes all the stored computation information from the cache.
Definition: ObjectPool.h:60
ObjectPool * objectPool() const
Returns the ObjectPool object used by this computation cache.
void setMaxComputations(size_t maxComputations)
Defines the maximum number of stored computations allowed in the cache. May trigger deallocation...
void set(const T &args, const Object *obj, StoreMode storeMode)
Registers the result of a computation explicitly.
Definition: MurmurHash.h:64
Definition: ComputationCache.h:50
StoreMode
Enum used to specify how to store the pointer passed to the store() function.
Definition: ObjectPool.h:92
ComputationCache(ComputeFn computeFn, HashFn hashFn, size_t maxResults=10000, ObjectPoolPtr objectPool=ObjectPool::defaultObjectPool())
static ObjectPool * defaultObjectPool()
MissingBehaviour
Enum used to specify behavior when retrieving computation results from the cache. ...
Definition: ComputationCache.h:85
Definition: RefCounted.h:124
size_t cachedComputations() const
Returns the number of stored computations.
This namespace contains all components of the core library.
Definition: AddSmoothSkinningInfluencesOp.h:43
void erase(const T &args)
Removes stored information about a specific computation result.