Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
tesseract_common::CloneCache< CacheType > Class Template Reference

Used to create a cache of objects. More...

#include <clone_cache.h>

Collaboration diagram for tesseract_common::CloneCache< CacheType >:
Collaboration graph
[legend]

Public Member Functions

 CloneCache (std::shared_ptr< CacheType > original, const long &cache_size=5)
 
const std::shared_ptr< CacheType > & operator-> ()
 
std::shared_ptr< CacheType > clone ()
 Gets a clone of original_. More...
 
void setCacheSize (long size)
 Set the cache size. More...
 
long getCacheSize () const
 Get the set cache size. More...
 
long getCurrentCacheSize () const
 Get the current size of the cache. 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::shared_ptr< CacheType > original_
 
std::size_t cache_size_ { 5 }
 The assigned cache size. More...
 
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...
 

Detailed Description

template<typename CacheType>
class tesseract_common::CloneCache< CacheType >

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

Constructor & Destructor Documentation

◆ CloneCache()

template<typename CacheType >
tesseract_common::CloneCache< CacheType >::CloneCache ( std::shared_ptr< CacheType >  original,
const long &  cache_size = 5 
)
inline

Member Function Documentation

◆ clone()

template<typename CacheType >
std::shared_ptr< CacheType > tesseract_common::CloneCache< CacheType >::clone ( )
inline

Gets a clone of original_.

Returns
A shared_ptr to a new clone of original_

◆ createClone()

template<typename CacheType >
void tesseract_common::CloneCache< CacheType >::createClone ( )
inlineprotected

◆ getCacheSize()

template<typename CacheType >
long tesseract_common::CloneCache< CacheType >::getCacheSize ( ) const
inline

Get the set cache size.

Returns
The set size of the cache.

◆ getClone()

template<typename CacheType >
std::shared_ptr< CacheType > tesseract_common::CloneCache< CacheType >::getClone ( ) const
inlineprotected

◆ getCurrentCacheSize()

template<typename CacheType >
long tesseract_common::CloneCache< CacheType >::getCurrentCacheSize ( ) const
inline

Get the current size of the cache.

Returns
The current size fo the cache

◆ operator->()

template<typename CacheType >
const std::shared_ptr< CacheType > & tesseract_common::CloneCache< CacheType >::operator-> ( )
inline

◆ setCacheSize()

template<typename CacheType >
void tesseract_common::CloneCache< CacheType >::setCacheSize ( long  size)
inline

Set the cache size.

Parameters
sizeThe size of the cache.

◆ updateCache()

template<typename CacheType >
void tesseract_common::CloneCache< CacheType >::updateCache ( )
inline

If original_ has changed it will update or rebuild the cache of objects.

Member Data Documentation

◆ cache_

template<typename CacheType >
std::deque<std::shared_ptr<CacheType> > tesseract_common::CloneCache< CacheType >::cache_
protected

A vector of cached objects.

◆ cache_mutex_

template<typename CacheType >
std::mutex tesseract_common::CloneCache< CacheType >::cache_mutex_
mutableprotected

The mutex used when reading and writing to cache_.

◆ cache_size_

template<typename CacheType >
std::size_t tesseract_common::CloneCache< CacheType >::cache_size_ { 5 }
protected

The assigned cache size.

◆ original_

template<typename CacheType >
std::shared_ptr<CacheType> tesseract_common::CloneCache< CacheType >::original_
protected

◆ supports_update

template<typename CacheType >
const bool tesseract_common::CloneCache< CacheType >::supports_update

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