SubscribeOptions.hh
00001 #ifndef SUBSCRIBEOPTIONS_HH 00002 #define SUBSCRIBEOPTIONS_HH 00003 00004 #include <boost/function.hpp> 00005 #include <boost/shared_ptr.hpp> 00006 #include "transport/CallbackHelper.hh" 00007 00008 namespace gazebo 00009 { 00010 namespace transport 00011 { 00014 00016 class SubscribeOptions 00017 { 00018 public: SubscribeOptions() 00019 {} 00020 00021 public: template<class M> 00022 void Init(const std::string &_topic, 00023 NodePtr _node, 00024 bool _latching) 00025 { 00026 google::protobuf::Message *msg = NULL; 00027 M msgtype; 00028 msg = dynamic_cast<google::protobuf::Message *>(&msgtype); 00029 if (!msg) 00030 gzthrow("Subscribe requires a google protobuf type"); 00031 00032 this->node = _node; 00033 this->topic = _topic; 00034 this->msgType = msg->GetTypeName(); 00035 this->latching = _latching; 00036 } 00037 00038 public: NodePtr GetNode() const 00039 { 00040 return this->node; 00041 } 00042 00043 public: std::string GetTopic() const 00044 { 00045 return this->topic; 00046 } 00047 00048 public: std::string GetMsgType() const 00049 { 00050 return this->msgType; 00051 } 00052 00053 public: bool GetLatching() const 00054 { 00055 return this->latching; 00056 } 00057 00058 private: std::string topic; 00059 private: std::string msgType; 00060 private: NodePtr node; 00061 private: bool latching; 00062 }; 00064 } 00065 } 00066 00067 #endif

1.7.5.1