00001 /* 00002 * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 00018 #ifndef SHAPES_MANAGER_HPP_ 00019 #define SHAPES_MANAGER_HPP_ 00020 00021 #include <ros/ros.h> 00022 #include <unordered_map> 00023 00024 #include <visualization_msgs/MarkerArray.h> 00025 #include "cob_obstacle_distance/marker_shapes/marker_shapes_interface.hpp" 00026 00028 class ShapesManager 00029 { 00030 private: 00031 std::unordered_map<std::string, PtrIMarkerShape_t> shapes_; 00032 const ros::Publisher& pub_; 00033 00034 public: 00035 typedef std::unordered_map<std::string, PtrIMarkerShape_t>::iterator MapIter_t; 00036 typedef std::unordered_map<std::string, PtrIMarkerShape_t>::const_iterator MapConstIter_t; 00037 00042 ShapesManager(const ros::Publisher &pub); 00043 00044 ~ShapesManager(); 00045 00051 void addShape(const std::string& id, PtrIMarkerShape_t s); 00052 00057 void removeShape(const std::string& id); 00058 00059 00066 bool getShape(const std::string& id, PtrIMarkerShape_t& s); 00067 00068 00072 void draw(); 00073 00077 void clear(); 00078 00083 uint32_t count() const; 00084 00089 uint32_t count(const std::string& id) const; 00090 00091 00092 MapIter_t begin() {return this->shapes_.begin(); } 00093 MapConstIter_t begin() const {return this->shapes_.begin(); } 00094 MapIter_t end() {return this->shapes_.end(); } 00095 MapConstIter_t end() const {return this->shapes_.end(); } 00096 }; 00097 00098 #endif /* SHAPES_MANAGER_HPP_ */