17 #ifndef _TOPICMANAGER_HH_
18 #define _TOPICMANAGER_HH_
20 #include <boost/bind.hpp>
100 public:
template<
typename M>
102 unsigned int _queueLimit,
105 google::protobuf::Message *msg =
NULL;
107 msg =
dynamic_cast<google::protobuf::Message *
>(&msgtype);
109 gzthrow(
"Advertise requires a google protobuf type");
114 msg->GetTypeName(), _queueLimit, _hzRate));
116 std::string msgTypename;
120 for (
int i = 0; i < 2; i ++)
126 msgTypename = msg->GetTypeName();
130 t = _topic +
"/__dbg";
132 msgTypename = tmp.GetTypeName();
143 pub->SetPublication(publication, i);
145 SubNodeMap::iterator iter2;
146 SubNodeMap::iterator st_end2 = this->subscribedNodes.end();
147 for (iter2 = this->subscribedNodes.begin();
148 iter2 != st_end2; iter2++)
150 if (iter2->first == t)
152 std::list<NodePtr>::iterator liter;
153 std::list<NodePtr>::iterator l_end = iter2->second.end();
154 for (liter = iter2->second.begin();
155 liter != l_end; liter++)
168 public:
void Unadvertise(
const std::string &_topic);
175 public:
void Publish(
const std::string &_topic,
176 const google::protobuf::Message &_message,
177 const boost::function<
void()> &_cb =
NULL);
194 const std::string &_host,
202 const std::string &_host,
215 const std::string &_msgType);
229 public: std::map<std::string, std::list<std::string> >
242 private: typedef std::map<std::
string,
PublicationPtr> PublicationPtr_M;
243 private: PublicationPtr_M advertisedTopics;
244 private: PublicationPtr_M::iterator advertisedTopicsEnd;
245 private: SubNodeMap subscribedNodes;
246 private: std::vector<
NodePtr> nodes;
248 private: boost::recursive_mutex nodeMutex;
251 private: boost::mutex subscriberMutex;
253 private:
bool pauseIncoming;