00001 /* 00002 * GenericPublisher.hpp 00003 * 00004 * Created on: Mar 1, 2012 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef GENERICPUBLISHER_HPP_ 00009 #define GENERICPUBLISHER_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 #include <boost/thread/mutex.hpp> 00013 00014 #include <ros/node_handle.h> 00015 00016 namespace TELEKYB_NAMESPACE 00017 { 00018 00019 template <class T_> 00020 class GenericPublisher { 00021 protected: 00022 ros::Publisher pub; 00023 00024 public: 00025 GenericPublisher(ros::NodeHandle handle, const std::string& topicName, int queue_size) { 00026 pub = handle.advertise<T_>(topicName, queue_size); 00027 } 00028 00029 virtual ~GenericPublisher() {} 00030 00031 void publish(const T_& msg) { 00032 pub.publish(msg); 00033 } 00034 }; 00035 00036 } /* namespace telekyb */ 00037 #endif /* GENERICPUBLISHER_HPP_ */