17 #ifndef _CONNECTION_MANAGER_HH_ 18 #define _CONNECTION_MANAGER_HH_ 21 #include <boost/shared_ptr.hpp> 22 #include <boost/interprocess/sync/interprocess_semaphore.hpp> 58 public:
bool Init(
const std::string &_masterHost,
59 unsigned int _masterPort,
60 uint32_t _timeoutIterations = 30);
64 public:
bool IsInitialized()
const;
72 public:
bool IsRunning()
const;
85 public:
void Subscribe(
const std::string &_topic,
86 const std::string &_msgType,
91 public:
void Unsubscribe(
const msgs::Subscribe &_sub);
96 public:
void Unsubscribe(
const std::string &_topic,
97 const std::string &_msgType);
102 public:
void Advertise(
const std::string &_topic,
103 const std::string &_msgType);
107 public:
void Unadvertise(
const std::string &_topic);
111 public:
void GetAllPublishers(std::list<msgs::Publish> &_publishers);
119 public:
void RegisterTopicNamespace(
const std::string &_name);
123 public:
void GetTopicNamespaces(std::list<std::string> &_namespaces);
129 private:
ConnectionPtr FindConnection(
const std::string &_host,
136 public:
ConnectionPtr ConnectToRemoteHost(
const std::string &_host,
140 public:
void TriggerUpdate();
145 private:
void OnMasterRead(
const std::string &_data);
155 const std::string &_data);
159 private:
void ProcessMessage(
const std::string &_packet);
162 private:
void RunUpdate();
165 private: boost::condition_variable updateCondition;
168 private: boost::mutex updateMutex;
173 private: std::list<ConnectionPtr> connections;
176 private:
bool initialized;
177 private:
bool stop, stopped;
179 private:
unsigned int tmpIndex;
180 private: boost::recursive_mutex listMutex;
183 private: boost::mutex namespaceMutex;
184 private: boost::recursive_mutex masterMessagesMutex;
185 private: boost::recursive_mutex connectionMutex;
187 private: std::list<msgs::Publish> publishers;
188 private: std::list<std::string> namespaces;
189 private: std::list<std::string> masterMessages;
192 private: boost::condition_variable namespaceCondition;
Forward declarations for the common classes.
Definition: Animation.hh:26
Singleton template class.
Definition: SingletonT.hh:33
std::vector< event::ConnectionPtr > eventConnections
Definition: ConnectionManager.hh:174
void stop()
Stop the transport component from running.
boost::shared_ptr< Connection > ConnectionPtr
Definition: Connection.hh:51
Manager of connections.
Definition: ConnectionManager.hh:43
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.