Used to create a cache of objects. More...
#include <clone_cache.h>
Public Member Functions | |
std::shared_ptr< CacheType > | clone () |
Gets a clone of original_. More... | |
CloneCache (std::shared_ptr< CacheType > original, const long &cache_size=5) | |
long | getCacheSize () const |
Get the set cache size. More... | |
long | getCurrentCacheSize () const |
Get the current size of the cache. More... | |
const std::shared_ptr< CacheType > & | operator-> () |
void | setCacheSize (long size) |
Set the cache size. More... | |
void | updateCache () |
If original_ has changed it will update or rebuild the cache of objects. More... | |
Public Attributes | |
const bool | supports_update |
Protected Member Functions | |
void | createClone () |
std::shared_ptr< CacheType > | getClone () const |
Protected Attributes | |
std::deque< std::shared_ptr< CacheType > > | cache_ |
A vector of cached objects. More... | |
std::mutex | cache_mutex_ |
The mutex used when reading and writing to cache_. More... | |
std::size_t | cache_size_ { 5 } |
The assigned cache size. More... | |
std::shared_ptr< CacheType > | original_ |
Used to create a cache of objects.
CacheType needs the following methods CacheType::Ptr clone() const; int getRevision() const; bool update(Const CacheType::ConstPtr&); // optional
Definition at line 51 of file clone_cache.h.
|
inline |
Definition at line 58 of file clone_cache.h.
|
inline |
Gets a clone of original_.
Definition at line 79 of file clone_cache.h.
|
inlineprotected |
Definition at line 195 of file clone_cache.h.
|
inline |
Get the set cache size.
Definition at line 139 of file clone_cache.h.
|
inlineprotected |
Definition at line 209 of file clone_cache.h.
|
inline |
Get the current size of the cache.
Definition at line 145 of file clone_cache.h.
|
inline |
Definition at line 73 of file clone_cache.h.
|
inline |
Set the cache size.
size | The size of the cache. |
Definition at line 126 of file clone_cache.h.
|
inline |
If original_ has changed it will update or rebuild the cache of objects.
Definition at line 152 of file clone_cache.h.
|
protected |
A vector of cached objects.
Definition at line 230 of file clone_cache.h.
|
mutableprotected |
The mutex used when reading and writing to cache_.
Definition at line 233 of file clone_cache.h.
|
protected |
The assigned cache size.
Definition at line 227 of file clone_cache.h.
|
protected |
Definition at line 224 of file clone_cache.h.
const bool tesseract_common::CloneCache< CacheType >::supports_update |
Definition at line 192 of file clone_cache.h.