21 #ifndef _PUBLISHER_HH_
22 #define _PUBLISHER_HH_
24 #include <google/protobuf/message.h>
25 #include <boost/thread.hpp>
49 public:
Publisher(
const std::string &_topic,
const std::string &_msgType,
50 unsigned int _limit,
double _hzRate);
78 public:
void Publish(
const google::protobuf::Message &_message,
80 { this->PublishImpl(_message, _block); }
86 public:
template<
typename M>
87 void Publish(M _message,
bool _block =
false)
88 { this->PublishImpl(_message, _block); }
94 private:
void PublishImpl(
const google::protobuf::Message &_message,
99 public: std::string
GetTopic()
const;
123 private:
void OnPublishComplete(uint32_t _id);
126 private: std::string topic;
129 private: std::string msgType;
133 private:
unsigned int queueLimit;
137 private:
double updatePeriod;
141 private:
bool queueLimitWarned;
144 private: std::list<MessagePtr> messages;
147 private:
mutable boost::mutex mutex;
163 private:
bool waiting;
166 private: uint32_t pubId;
167 private: std::list<uint32_t> pubIds;