21 #ifndef _PUBLISHER_HH_
22 #define _PUBLISHER_HH_
24 #include <google/protobuf/message.h>
25 #include <boost/thread.hpp>
47 public:
Publisher(
const std::string &_topic,
const std::string &_msgType,
48 unsigned int _limit,
bool _latch);
70 public:
void Publish(
const google::protobuf::Message &_message,
72 { this->PublishImpl(_message, _block); }
78 public:
template<
typename M>
79 void Publish(M _message,
bool _block =
false)
80 { this->PublishImpl(_message, _block); }
86 private:
void PublishImpl(
const google::protobuf::Message &_message,
91 public: std::string
GetTopic()
const;
109 private:
void OnPublishComplete();
111 private: std::string topic;
112 private: std::string msgType;
113 private:
unsigned int queueLimit;
114 private: std::list<google::protobuf::Message *> messages;
115 private: boost::recursive_mutex *mutex;
119 private: google::protobuf::Message *prevMsg;