21 #include <boost/enable_shared_from_this.hpp>
40 class Node :
public boost::enable_shared_from_this<Node>
46 public:
virtual ~Node();
52 public:
void Init(
const std::string &_space =
"");
73 public:
unsigned int GetId()
const;
91 unsigned int _queueLimit = 1000,
97 decodedTopic, _queueLimit, _latch);
99 boost::recursive_mutex::scoped_lock lock(this->publisherMutex);
100 this->publishers.push_back(publisher);
101 this->publishersEnd = this->publishers.end();
113 template<
typename M,
typename T>
115 void(T::*_fp)(
const boost::shared_ptr<M const> &), T *_obj,
116 bool _latching =
false)
120 ops.template Init<M>(decodedTopic, shared_from_this(), _latching);
122 boost::recursive_mutex::scoped_lock lock(this->incomingMutex);
137 void(*_fp)(
const boost::shared_ptr<M const> &),
138 bool _latching =
false)
142 ops.template Init<M>(decodedTopic, shared_from_this(), _latching);
144 boost::recursive_mutex::scoped_lock lock(this->incomingMutex);
145 this->callbacks[decodedTopic].push_back(
155 public:
bool HandleData(
const std::string &_topic,
156 const std::string &_msg);
165 const std::string &_msg);
171 public: std::string
GetMsgType(
const std::string &_topic)
const;
173 private: std::string topicNamespace;
174 private: std::vector<PublisherPtr> publishers;
175 private: std::vector<PublisherPtr>::iterator publishersIter;
176 private: std::vector<PublisherPtr>::iterator publishersEnd;
177 private:
static unsigned int idCounter;
178 private:
unsigned int id;
180 private:
typedef std::list<CallbackHelperPtr> Callback_L;
181 private:
typedef std::map<std::string, Callback_L> Callback_M;
182 private: Callback_M callbacks;
183 private: std::map<std::string, std::list<std::string> > incomingMsgs;
184 private: boost::recursive_mutex publisherMutex;
185 private: boost::recursive_mutex incomingMutex;
187 private:
bool initialized;