00001 /* 00002 * File: subscriber.h 00003 * Author: hpcl 00004 * 00005 * Created on May 28, 2015, 4:15 PM 00006 */ 00007 00008 #ifndef ROSRTT_SUBSCRIBER_HANDLE_H 00009 #define ROSRTT_SUBSCRIBER_HANDLE_H 00010 00011 #include "ros/subscriber.h" 00012 #include "topic_manager.h" 00013 00014 namespace hpcl_rtt 00015 { 00016 00017 class Subscriber 00018 { 00019 public: 00020 Subscriber(); 00021 Subscriber(ConnectionBasePtr sub_connection, ros::Subscriber ros_subscriber); 00022 ~Subscriber(); 00023 00024 template<class M> void call() 00025 { 00026 if(subscription) 00027 { 00028 Subscription<M>* sub = static_cast< Subscription<M>* >(subscription.get ()); 00029 sub->call(); 00030 } 00031 } 00032 00033 private: 00034 ConnectionBasePtr subscription; 00035 ros::Subscriber ros_sub; 00036 }; 00037 00038 } 00039 00040 00041 #endif /* SUBSCRIBER_H */ 00042