publisher.h
Go to the documentation of this file.
00001 /* 
00002  *  publisher.h - micros topic publisher
00003  *  Copyright (C) 2015 Zaile Jiang
00004  *  
00005  *  This program is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU General Public License
00007  *  as published by the Free Software Foundation; either version 2
00008  *  of the License, or (at your option) any later version.
00009  *  
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *  
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 */
00019 #ifndef MICROSRTT_PUBLISHER_HANDLE_H
00020 #define MICROSRTT_PUBLISHER_HANDLE_H
00021 
00022 #include "ros/ros.h"
00023 #include "micros_rtt/topic_manager.h"
00024 #include "micros_rtt/publication.hpp"
00025 
00026 namespace micros_rtt
00027 {
00028 
00029 class Publisher 
00030 {
00031 public:
00032   Publisher(){}
00033   Publisher(ros::Publisher ros_publisher, ConnectionBasePtr pub_connection);
00034   ~Publisher(){}
00035   
00036   template <class M>
00037   void publish(M message)
00038   {
00039     if (publication)
00040     {
00041       typename Publication<M>::shared_ptr output = boost::static_pointer_cast< Publication<M> >(publication);
00042       if(!output->publish(message))
00043         ROS_WARN("micros publish failed");
00044     }
00045     else 
00046     {
00047       ROS_WARN("micros publisher can't publish message with no connection.");
00048     }
00049 
00050   }
00051   
00052   ros::Publisher getRosPublisher() {return ros_pub;}
00053   
00054 private:
00055   ros::Publisher ros_pub;
00056   ConnectionBasePtr publication;
00057 };
00058 
00059 }
00060 
00061 #endif


micros_rtt
Author(s): Zaile Jiang , Xiaodong Yi , Minglong Li
autogenerated on Sat Jun 8 2019 19:02:21