18 #ifndef _PUBLICATION_HH_
19 #define _PUBLICATION_HH_
22 #include <boost/function.hpp>
23 #include <boost/shared_ptr.hpp>
24 #include <boost/thread/mutex.hpp>
51 const std::string &_msgType);
58 public: std::string GetMsgType()
const;
66 public:
void AddSubscription(
const NodePtr &_node);
70 public:
void RemoveSubscription(
const NodePtr &_node);
75 public:
void RemoveSubscription(
const std::string &_host,
81 public:
void RemoveTransport(
const std::string &_host,
unsigned
86 public:
unsigned int GetTransportCount()
const;
90 public:
unsigned int GetCallbackCount()
const;
94 public:
unsigned int GetNodeCount()
const;
98 public:
unsigned int GetRemoteSubscriptionCount();
103 public:
bool GetLocallyAdvertised()
const;
108 public:
void SetLocallyAdvertised(
bool _value);
112 public:
void LocalPublish(
const std::string &_data);
121 boost::function<
void(uint32_t)> _cb,
131 public:
void SetPrevMsg(uint32_t _pubId,
MessagePtr _msg);
137 public:
MessagePtr GetPrevMsg(uint32_t _pubId);
148 public:
bool HasTransport(
const std::string &_host,
unsigned int _port);
155 private:
void RemoveNodes();
158 private:
unsigned int id;
161 private:
static unsigned int idCounter;
164 private: std::string topic;
167 private: std::string msgType;
170 private: std::list<CallbackHelperPtr> callbacks;
173 private: std::list<NodePtr> nodes;
176 private: std::list<unsigned int> removeNodes;
179 private: std::list<std::pair<std::string, unsigned int> > removeCallbacks;
182 private: std::list<PublicationTransportPtr> transports;
185 private: std::vector<PublisherPtr> publishers;
188 private:
bool locallyAdvertised;
191 private:
mutable boost::mutex nodeMutex;
194 private:
mutable boost::mutex callbackMutex;
197 private:
mutable boost::mutex nodeRemoveMutex;
200 private: std::map<uint32_t, MessagePtr> prevMsgs;
Forward declarations for the common classes.
Definition: Animation.hh:33
Forward declarations for transport.
A publication for a topic.
Definition: Publication.hh:45
boost::shared_ptr< google::protobuf::Message > MessagePtr
Definition: TransportTypes.hh:45
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
#define GZ_TRANSPORT_VISIBLE
Definition: system.hh:166
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
boost::shared_ptr< CallbackHelper > CallbackHelperPtr
boost shared pointer to transport::CallbackHelper
Definition: CallbackHelper.hh:101
boost::shared_ptr< PublicationTransport > PublicationTransportPtr
Definition: TransportTypes.hh:65