30 #ifndef COSTMAP_CSPACE_COSTMAP_3D_LAYER_CLASS_LOADER_H 31 #define COSTMAP_CSPACE_COSTMAP_3D_LAYER_CLASS_LOADER_H 35 #include <geometry_msgs/PolygonStamped.h> 36 #include <nav_msgs/OccupancyGrid.h> 37 #include <costmap_cspace_msgs/CSpace3D.h> 38 #include <costmap_cspace_msgs/CSpace3DUpdate.h> 51 using Ptr = std::shared_ptr<Costmap3dLayerSpawnerBase>;
66 using ClassList = std::map<std::string, Costmap3dLayerSpawnerBase::Ptr>;
72 if (classes_.find(name) == classes_.end())
74 throw std::runtime_error(
"Costmap3dLayerSpawner: class not found");
76 return classes_[name]->spawn();
80 classes_[name] = spawner;
83 #define COSTMAP_3D_LAYER_CLASS_LOADER_ENABLE() \ 84 costmap_cspace::Costmap3dLayerClassLoader::ClassList \ 85 costmap_cspace::Costmap3dLayerClassLoader::classes_; 87 #define COSTMAP_3D_LAYER_CLASS_LOADER_REGISTER(name, klass, id) \ 90 struct ClassLoaderRegister##id \ 92 ClassLoaderRegister##id() \ 94 costmap_cspace::Costmap3dLayerClassLoader::registerClass( \ 96 costmap_cspace::Costmap3dLayerSpawnerBase::Ptr( \ 97 new costmap_cspace::Costmap3dLayerSpawner<klass>)); \ 100 static ClassLoaderRegister##id g_register_class_##id; \ 105 #endif // COSTMAP_CSPACE_COSTMAP_3D_LAYER_CLASS_LOADER_H virtual Costmap3dLayerBase::Ptr spawn() const =0
Costmap3dLayerBase::Ptr spawn() const
std::map< std::string, Costmap3dLayerSpawnerBase::Ptr > ClassList
std::shared_ptr< Costmap3dLayerBase > Ptr
static ClassList classes_
static void registerClass(const std::string &name, Costmap3dLayerSpawnerBase::Ptr spawner)
static Costmap3dLayerBase::Ptr loadClass(const std::string &name)
std::shared_ptr< Costmap3dLayerSpawnerBase > Ptr