21 #ifndef _PUBLISHER_HH_
22 #define _PUBLISHER_HH_
24 #include <google/protobuf/message.h>
25 #include <boost/thread.hpp>
48 public:
Publisher(
const std::string &_topic,
const std::string &_msgType,
49 unsigned int _limit,
double _hzRate);
77 public:
void Publish(
const google::protobuf::Message &_message,
79 { this->PublishImpl(_message, _block); }
85 public:
template<
typename M>
86 void Publish(M _message,
bool _block =
false)
87 { this->PublishImpl(_message, _block); }
93 private:
void PublishImpl(
const google::protobuf::Message &_message,
98 public: std::string
GetTopic()
const;
122 private:
void OnPublishComplete(uint32_t _id);
125 private: std::string topic;
128 private: std::string msgType;
132 private:
unsigned int queueLimit;
136 private:
double updatePeriod;
140 private:
bool queueLimitWarned;
143 private: std::list<MessagePtr> messages;
146 private:
mutable boost::mutex mutex;
162 private:
bool waiting;
165 private: uint32_t pubId;
166 private: std::list<uint32_t> pubIds;