Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tesseract_environment::DefaultEnvironmentCache Class Reference

#include <environment_cache.h>

Inheritance diagram for tesseract_environment::DefaultEnvironmentCache:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

std::deque< std::unique_ptr< Environment > > cache_
 A vector of cached Tesseract objects. More...
 
int cache_env_revision_ { 0 }
 The environment revision number at the time the cache was populated. More...
 
std::shared_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< const Environmentenv_
 The tesseract_object used to create the cache. More...
 

Detailed Description

Definition at line 76 of file environment_cache.h.

Member Typedef Documentation

◆ ConstPtr

Definition at line 80 of file environment_cache.h.

◆ Ptr

Definition at line 79 of file environment_cache.h.

Constructor & Destructor Documentation

◆ DefaultEnvironmentCache()

tesseract_environment::DefaultEnvironmentCache::DefaultEnvironmentCache ( std::shared_ptr< const Environment env,
std::size_t  cache_size = 5 
)

Definition at line 36 of file environment_cache.cpp.

Member Function Documentation

◆ 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.

Definition at line 55 of file environment_cache.cpp.

◆ 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.

Definition at line 47 of file environment_cache.cpp.

◆ 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.

Definition at line 49 of file environment_cache.cpp.

◆ refreshCacheHelper()

void tesseract_environment::DefaultEnvironmentCache::refreshCacheHelper ( ) const
protected

This does not take a lock.

Definition at line 71 of file environment_cache.cpp.

◆ 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.

Definition at line 41 of file environment_cache.cpp.

Member Data Documentation

◆ cache_

std::deque<std::unique_ptr<Environment> > tesseract_environment::DefaultEnvironmentCache::cache_
mutableprotected

A vector of cached Tesseract objects.

Definition at line 116 of file environment_cache.h.

◆ cache_env_revision_

int tesseract_environment::DefaultEnvironmentCache::cache_env_revision_ { 0 }
mutableprotected

The environment revision number at the time the cache was populated.

Definition at line 113 of file environment_cache.h.

◆ cache_mutex_

std::shared_mutex tesseract_environment::DefaultEnvironmentCache::cache_mutex_
mutableprotected

The mutex used when reading and writing to cache_.

Definition at line 119 of file environment_cache.h.

◆ cache_size_

std::size_t tesseract_environment::DefaultEnvironmentCache::cache_size_ { 5 }
protected

The assigned cache size.

Definition at line 110 of file environment_cache.h.

◆ env_

std::shared_ptr<const Environment> tesseract_environment::DefaultEnvironmentCache::env_
protected

The tesseract_object used to create the cache.

Definition at line 107 of file environment_cache.h.


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


tesseract_environment
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:02:21