PublicationTransport.hh
00001 #ifndef PUBLICATIONTRANSPORT_HH 00002 #define PUBLICATIONTRANSPORT_HH 00003 00004 #include <boost/shared_ptr.hpp> 00005 #include "transport/Connection.hh" 00006 #include "common/Event.hh" 00007 00008 namespace gazebo 00009 { 00010 namespace transport 00011 { 00014 00017 class PublicationTransport 00018 { 00019 public: PublicationTransport(const std::string &topic, 00020 const std::string &msgType); 00021 00022 public: virtual ~PublicationTransport(); 00023 00024 public: void Init(const ConnectionPtr &conn); 00025 public: void Fini(); 00026 public: void AddCallback( 00027 const boost::function<void(const std::string &)> &cb); 00028 00029 public: const ConnectionPtr GetConnection() const; 00030 public: std::string GetTopic() const; 00031 public: std::string GetMsgType() const; 00032 00033 private: void OnConnectionShutdown(); 00034 00035 private: void OnPublish(const std::string &data); 00036 00037 private: std::string topic; 00038 private: std::string msgType; 00039 private: ConnectionPtr connection; 00040 private: boost::function<void (const std::string &)> callback; 00041 private: event::ConnectionPtr shutdownConnectionPtr; 00042 00043 private: static int counter; 00044 private: int id; 00045 }; 00047 } 00048 } 00049 00050 #endif

1.7.5.1