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,
50 public:
Publisher(
const std::string &_topic,
const std::string &_msgType,
73 public:
void Publish(
const google::protobuf::Message &_message,
75 { this->PublishImpl(_message, _block); }
81 public:
template<
typename M>
82 void Publish(M _message,
bool _block =
false)
83 { this->PublishImpl(_message, _block); }
89 private:
void PublishImpl(
const google::protobuf::Message &_message,
94 public: std::string
GetTopic()
const;
111 private:
void OnPublishComplete();
113 private: std::
string topic;
114 private: std::
string msgType;
115 private:
unsigned int queueLimit;
116 private:
bool queueLimitWarned;
117 private: std::list<google::protobuf::Message *> messages;
118 private: mutable boost::recursive_mutex mutex;
121 private: google::protobuf::Message *prevMsg;