21 #ifndef _PUBLISHER_HH_
22 #define _PUBLISHER_HH_
24 #include <google/protobuf/message.h>
25 #include <boost/thread.hpp>
43 public:
Publisher(
const std::string &_topic,
const std::string &_msgType,
52 public:
Publisher(
const std::string &_topic,
const std::string &_msgType,
53 unsigned int _limit,
double _hzRate);
75 public:
void Publish(
const google::protobuf::Message &_message,
77 { this->PublishImpl(_message, _block); }
83 public:
template<
typename M>
84 void Publish(M _message,
bool _block =
false)
85 { this->PublishImpl(_message, _block); }
91 private:
void PublishImpl(
const google::protobuf::Message &_message,
96 public: std::string
GetTopic()
const;
113 private:
void OnPublishComplete();
116 private: std::
string topic;
119 private: std::
string msgType;
123 private:
unsigned int queueLimit;
127 private:
double updatePeriod;
131 private:
bool queueLimitWarned;
134 private: std::list<google::protobuf::Message *> messages;
137 private: mutable boost::recursive_mutex mutex;
144 private: google::protobuf::Message *prevMsg;
146 private: common::Time currentTime;
147 private: common::Time prevPublishTime;