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);
68 public:
bool IsRunning()
const;
81 public:
void Subscribe(
const std::string &_topic,
82 const std::string &_msgType,
87 public:
void Unsubscribe(
const msgs::Subscribe &_sub);
92 public:
void Unsubscribe(
const std::string &_topic,
93 const std::string &_msgType);
98 public:
void Advertise(
const std::string &_topic,
99 const std::string &_msgType);
103 public:
void Unadvertise(
const std::string &_topic);
107 public:
void GetAllPublishers(std::list<msgs::Publish> &_publishers);
115 public:
void RegisterTopicNamespace(
const std::string &_name);
119 public:
void GetTopicNamespaces(std::list<std::string> &_namespaces);
125 private:
ConnectionPtr FindConnection(
const std::string &_host,
132 public:
ConnectionPtr ConnectToRemoteHost(
const std::string &_host,
136 public:
void TriggerUpdate();
141 private:
void OnMasterRead(
const std::string &_data);
151 const std::string &_data);
155 private:
void ProcessMessage(
const std::string &_packet);
158 private:
void RunUpdate();
161 private: boost::condition_variable updateCondition;
164 private: boost::mutex updateMutex;
169 private: std::list<ConnectionPtr> connections;
172 private:
bool initialized;
173 private:
bool stop, stopped;
175 private:
unsigned int tmpIndex;
176 private: boost::recursive_mutex listMutex;
179 private: boost::mutex namespaceMutex;
180 private: boost::recursive_mutex masterMessagesMutex;
181 private: boost::recursive_mutex connectionMutex;
183 private: std::list<msgs::Publish> publishers;
184 private: std::list<std::string> namespaces;
185 private: std::list<std::string> masterMessages;
188 private: boost::condition_variable namespaceCondition;
boost::shared_ptr< Connection > ConnectionPtr
Definition: Connection.hh:50
Singleton template class.
Definition: SingletonT.hh:33
Manager of connections.
Definition: ConnectionManager.hh:43
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
#define GZ_TRANSPORT_VISIBLE
Definition: system.hh:159
GZ_TRANSPORT_VISIBLE void stop()
Stop the transport component from running.
Single TCP/IP connection manager.
Definition: Connection.hh:100
std::vector< event::ConnectionPtr > eventConnections
Definition: ConnectionManager.hh:170