Tesseract 0.28.4
Loading...
Searching...
No Matches
tesseract::environment::DefaultEnvironmentCache Class Reference
Inheritance diagram for tesseract::environment::DefaultEnvironmentCache:

Public Types

using Ptr = std::shared_ptr<DefaultEnvironmentCache>
using ConstPtr = std::shared_ptr<const DefaultEnvironmentCache>
Public Types inherited from tesseract::environment::EnvironmentCache
using Ptr = std::shared_ptr<EnvironmentCache>
using ConstPtr = std::shared_ptr<const EnvironmentCache>
using UPtr = std::unique_ptr<EnvironmentCache>
using ConstUPtr = std::unique_ptr<const EnvironmentCache>

Public Member Functions

 DefaultEnvironmentCache (std::shared_ptr< const Environment > env, std::size_t cache_size=5)
void setCacheSize (long size) override final
 Set the cache size used to hold tesseract objects for motion planning.
long getCacheSize () const override final
 Get the cache size used to hold tesseract objects for motion planning.
void refreshCache () const override final
 If the environment has changed it will rebuild the cache of tesseract objects.
std::unique_ptr< Environment > getCachedEnvironment () const override final
 This will pop an Environment object from the queue.
Public Member Functions inherited from tesseract::environment::EnvironmentCache
 EnvironmentCache (const EnvironmentCache &)=delete
EnvironmentCache & operator= (const EnvironmentCache &)=delete
 EnvironmentCache (EnvironmentCache &&)=delete
EnvironmentCache & operator= (EnvironmentCache &&)=delete

Protected Member Functions

void refreshCacheHelper () const
 This does not take a lock.

Protected Attributes

std::shared_ptr< const Environment > env_
 The tesseract_object used to create the cache.
std::size_t cache_size_ { 5 }
 The assigned cache size.
int cache_env_revision_ { 0 }
 The environment revision number at the time the cache was populated.
std::deque< std::unique_ptr< Environment > > cache_
 A vector of cached Tesseract objects.
std::shared_mutex cache_mutex_
 The mutex used when reading and writing to cache_.

Member Function Documentation

◆ setCacheSize()

void tesseract::environment::DefaultEnvironmentCache::setCacheSize ( long size)
finaloverridevirtual

Set the cache size used to hold tesseract objects for motion planning.

Parameters
sizeThe size of the cache.

Implements tesseract::environment::EnvironmentCache.

◆ getCacheSize()

long tesseract::environment::DefaultEnvironmentCache::getCacheSize ( ) const
finaloverridevirtual

Get the cache size used to hold tesseract objects for motion planning.

Returns
The size of the cache.

Implements tesseract::environment::EnvironmentCache.

◆ refreshCache()

void tesseract::environment::DefaultEnvironmentCache::refreshCache ( ) const
finaloverridevirtual

If the environment has changed it will rebuild the cache of tesseract objects.

Implements tesseract::environment::EnvironmentCache.

◆ getCachedEnvironment()

std::unique_ptr< Environment > tesseract::environment::DefaultEnvironmentCache::getCachedEnvironment ( ) const
finaloverridevirtual

This will pop an Environment object from the queue.

This will first call refreshCache to ensure it has an updated tesseract then proceed

Implements tesseract::environment::EnvironmentCache.