subscriber.h
Go to the documentation of this file.
00001 /* 
00002  *  subscriber.h - micros topic subscriber
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 
00020 #ifndef MICROSRTT_SUBSCRIBER_HANDLE_H
00021 #define MICROSRTT_SUBSCRIBER_HANDLE_H
00022 
00023 #include "ros/ros.h"
00024 #include "micros_rtt/topic_manager.h"
00025 #include "micros_rtt/subscription.hpp"
00026 
00027 namespace micros_rtt
00028 {
00029 
00030 class Subscriber 
00031 {
00032 public:
00033   Subscriber(){}
00034   Subscriber(ros::Subscriber ros_subscriber, ConnectionBasePtr sub_connection);
00035   ~Subscriber(){}
00036   
00037   template<class M> void call() 
00038   { 
00039     if(subscription)
00040     {
00041             ROS_DEBUG("micros subscriber have subscription %s", subscription->getTopic().c_str());
00042           Subscription<M>* sub = static_cast< Subscription<M>*>(subscription.get());
00043           sub->call();
00044     }
00045   }
00046   
00047   ros::Subscriber getRosSubscriber() { return ros_sub; }
00048   
00049 private:
00050   ConnectionBasePtr subscription;
00051   ros::Subscriber ros_sub;
00052 };
00053 
00054 }
00055 
00056 
00057 #endif /* SUBSCRIBER_H */
00058 


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