Go to the documentation of this file.
26 #ifndef TESSERACT_ENVIRONMENT_ENVIRONMENT_CACHE_H
27 #define TESSERACT_ENVIRONMENT_ENVIRONMENT_CACHE_H
33 #include <shared_mutex>
42 using Ptr = std::shared_ptr<EnvironmentCache>;
43 using ConstPtr = std::shared_ptr<const EnvironmentCache>;
44 using UPtr = std::unique_ptr<EnvironmentCache>;
45 using ConstUPtr = std::unique_ptr<const EnvironmentCache>;
79 using Ptr = std::shared_ptr<DefaultEnvironmentCache>;
80 using ConstPtr = std::shared_ptr<const DefaultEnvironmentCache>;
116 mutable std::deque<std::unique_ptr<Environment>>
cache_;
126 #endif // TESSERACT_ENVIRONMENT_ENVIRONMENT_CACHE_H
virtual void refreshCache() const =0
If the environment has changed it will rebuild the cache of tesseract objects.
virtual long getCacheSize() const =0
Get the cache size used to hold tesseract objects for motion planning.
std::shared_ptr< const Environment > env_
The tesseract_object used to create the cache.
long getCacheSize() const override final
Get the cache size used to hold tesseract objects for motion planning.
DefaultEnvironmentCache(std::shared_ptr< const Environment > env, std::size_t cache_size=5)
std::unique_ptr< EnvironmentCache > UPtr
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
void refreshCache() const override final
If the environment has changed it will rebuild the cache of tesseract objects.
virtual void setCacheSize(long size)=0
Set the cache size used to hold tesseract objects for motion planning.
std::unique_ptr< const EnvironmentCache > ConstUPtr
void refreshCacheHelper() const
This does not take a lock.
virtual std::unique_ptr< Environment > getCachedEnvironment() const =0
This will pop an Environment object from the queue.
std::size_t cache_size_
The assigned cache size.
std::deque< std::unique_ptr< Environment > > cache_
A vector of cached Tesseract objects.
virtual ~EnvironmentCache()=default
int cache_env_revision_
The environment revision number at the time the cache was populated.
std::shared_ptr< EnvironmentCache > Ptr
std::unique_ptr< Environment > getCachedEnvironment() const override final
This will pop an Environment object from the queue.
EnvironmentCache()=default
std::shared_ptr< const EnvironmentCache > ConstPtr
void setCacheSize(long size) override final
Set the cache size used to hold tesseract objects for motion planning.
std::shared_mutex cache_mutex_
The mutex used when reading and writing to cache_.
EnvironmentCache & operator=(const EnvironmentCache &)=delete