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, _latch));
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);
233 typedef std::map<std::string, std::list<NodePtr> >
SubNodeMap;
235 private:
typedef std::map<std::string, PublicationPtr> PublicationPtr_M;
236 private: PublicationPtr_M advertisedTopics;
237 private: PublicationPtr_M::iterator advertisedTopicsEnd;
239 private: std::vector<NodePtr> nodes;
241 private: boost::recursive_mutex *nodeMutex;
243 private:
bool pauseIncoming;