bullet_collision_shape_cache.h
Go to the documentation of this file.
1 
27 #ifndef TESSERACT_COLLISION_BULLET_COLLISION_SHAPE_CACHE_H
28 #define TESSERACT_COLLISION_BULLET_COLLISION_SHAPE_CACHE_H
29 
30 #include <map>
31 #include <memory>
32 #include <vector>
33 #include <mutex>
34 
37 #include <BulletCollision/CollisionShapes/btCollisionShape.h>
38 #include <boost/uuid/uuid.hpp>
40 
41 #include <tesseract_geometry/fwd.h>
42 
44 {
46 {
47  BulletCollisionShape() = default;
48  BulletCollisionShape(std::shared_ptr<btCollisionShape> top_level_);
49 
50  std::shared_ptr<btCollisionShape> top_level;
51  std::vector<std::shared_ptr<btCollisionShape>> children;
52 };
53 
55 {
56 public:
62  static void insert(const std::shared_ptr<const tesseract_geometry::Geometry>& key,
63  const std::shared_ptr<BulletCollisionShape>& value);
64 
70  static std::shared_ptr<BulletCollisionShape> get(const std::shared_ptr<const tesseract_geometry::Geometry>& key);
71 
73  static void prune();
74 
75 private:
77  static std::map<boost::uuids::uuid, std::weak_ptr<BulletCollisionShape>> cache_; // NOLINT
79  static std::mutex mutex_; // NOLINT
80 };
81 } // namespace tesseract_collision::tesseract_collision_bullet
82 
83 #endif // TESSERACT_COLLISION_BULLET_COLLISION_SHAPE_CACHE_H
tesseract_collision::tesseract_collision_bullet
Definition: bullet_cast_bvh_manager.h:48
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
tesseract_collision::tesseract_collision_bullet::BulletCollisionShape::BulletCollisionShape
BulletCollisionShape()=default
tesseract_collision::tesseract_collision_bullet::BulletCollisionShape
Definition: bullet_collision_shape_cache.h:45
tesseract_collision::tesseract_collision_bullet::BulletCollisionShapeCache::prune
static void prune()
Remove any entries which are no longer valid.
Definition: bullet_collision_shape_cache.cpp:70
tesseract_collision::tesseract_collision_bullet::BulletCollisionShape::children
std::vector< std::shared_ptr< btCollisionShape > > children
Definition: bullet_collision_shape_cache.h:51
TESSERACT_COMMON_IGNORE_WARNINGS_POP
Definition: create_convex_hull.cpp:37
fwd.h
tesseract_collision::tesseract_collision_bullet::BulletCollisionShapeCache::insert
static void insert(const std::shared_ptr< const tesseract_geometry::Geometry > &key, const std::shared_ptr< BulletCollisionShape > &value)
Insert a new entry into the cache.
Definition: bullet_collision_shape_cache.cpp:45
tesseract_collision::tesseract_collision_bullet::BulletCollisionShapeCache::mutex_
static std::mutex mutex_
The shared mutex for thread safety.
Definition: bullet_collision_shape_cache.h:79
tesseract_collision::tesseract_collision_bullet::BulletCollisionShapeCache::get
static std::shared_ptr< BulletCollisionShape > get(const std::shared_ptr< const tesseract_geometry::Geometry > &key)
Retrieve the cache entry by key.
Definition: bullet_collision_shape_cache.cpp:54
tesseract_collision::tesseract_collision_bullet::BulletCollisionShapeCache
Definition: bullet_collision_shape_cache.h:54
tesseract_collision::tesseract_collision_bullet::BulletCollisionShapeCache::cache_
static std::map< boost::uuids::uuid, std::weak_ptr< BulletCollisionShape > > cache_
The static cache.
Definition: bullet_collision_shape_cache.h:77
macros.h
tesseract_collision::tesseract_collision_bullet::BulletCollisionShape::top_level
std::shared_ptr< btCollisionShape > top_level
Definition: bullet_collision_shape_cache.h:50


tesseract_collision
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:01:52