17 #ifndef TOPICMANAGER_HH
18 #define TOPICMANAGER_HH
20 #include <boost/bind.hpp>
80 public:
template<
typename M>
82 unsigned int _queueLimit,
85 google::protobuf::Message *msg =
NULL;
87 msg =
dynamic_cast<google::protobuf::Message *
>(&msgtype);
89 gzthrow(
"Advertise requires a google protobuf type");
94 msg->GetTypeName(), _queueLimit, _latch));
96 std::string msgTypename;
100 for (
int i = 0; i < 2; i ++)
106 msgTypename = msg->GetTypeName();
110 t = _topic +
"/__dbg";
112 msgTypename = tmp.GetTypeName();
123 pub->SetPublication(publication, i);
125 SubNodeMap::iterator iter2;
126 SubNodeMap::iterator st_end2 = this->subscribedNodes.end();
127 for (iter2 = this->subscribedNodes.begin();
128 iter2 != st_end2; iter2++)
130 if (iter2->first == t)
132 std::list<NodePtr>::iterator liter;
133 std::list<NodePtr>::iterator l_end = iter2->second.end();
134 for (liter = iter2->second.begin();
135 liter != l_end; liter++)
147 public:
void Unadvertise(
const std::string &topic);
154 public:
void Publish(
const std::string &topic,
155 const google::protobuf::Message &message,
156 const boost::function<
void()> &cb =
NULL);
167 const std::string &host,
172 const std::string &host,
181 const std::string &msgType);
193 typedef std::map<std::string, std::list<NodePtr> >
SubNodeMap;
195 private:
typedef std::map<std::string, PublicationPtr> PublicationPtr_M;
196 private: PublicationPtr_M advertisedTopics;
197 private: PublicationPtr_M::iterator advertisedTopicsEnd;
199 private: std::vector<NodePtr> nodes;
201 private: boost::recursive_mutex *nodeMutex;
203 private:
bool pauseIncoming;