18 #ifndef _PUBLICATION_HH_
19 #define _PUBLICATION_HH_
22 #include <boost/shared_ptr.hpp>
23 #include <boost/thread/mutex.hpp>
50 const std::string &_msgType);
57 public: std::string GetMsgType()
const;
65 public:
void AddSubscription(
const NodePtr &_node);
69 public:
void RemoveSubscription(
const NodePtr &_node);
74 public:
void RemoveSubscription(
const std::string &_host,
80 public:
void RemoveTransport(
const std::string &_host,
unsigned
85 public:
unsigned int GetTransportCount()
const;
89 public:
unsigned int GetCallbackCount()
const;
93 public:
unsigned int GetNodeCount()
const;
97 public:
unsigned int GetRemoteSubscriptionCount();
102 public:
bool GetLocallyAdvertised()
const;
107 public:
void SetLocallyAdvertised(
bool _value);
111 public:
void LocalPublish(
const std::string &_data);
120 boost::function<
void(uint32_t)> _cb,
130 public:
void SetPrevMsg(uint32_t _pubId,
MessagePtr _msg);
136 public:
MessagePtr GetPrevMsg(uint32_t _pubId);
147 public:
bool HasTransport(
const std::string &_host,
unsigned int _port);
154 private:
void RemoveNodes();
157 private:
unsigned int id;
160 private:
static unsigned int idCounter;
163 private: std::string topic;
166 private: std::string msgType;
169 private: std::list<CallbackHelperPtr> callbacks;
172 private: std::list<NodePtr> nodes;
175 private: std::list<unsigned int> removeNodes;
178 private: std::list<std::pair<std::string, unsigned int> > removeCallbacks;
181 private: std::list<PublicationTransportPtr> transports;
184 private: std::vector<PublisherPtr> publishers;
187 private:
bool locallyAdvertised;
190 private:
mutable boost::mutex nodeMutex;
193 private:
mutable boost::mutex callbackMutex;
196 private:
mutable boost::mutex nodeRemoveMutex;
199 private: std::map<uint32_t, MessagePtr> prevMsgs;
Forward declarations for transport.
A publication for a topic.
Definition: Publication.hh:44
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