17 #ifndef _CONNECTION_MANAGER_HH_ 18 #define _CONNECTION_MANAGER_HH_ 21 #include <boost/shared_ptr.hpp> 22 #include <boost/interprocess/sync/interprocess_semaphore.hpp> 61 public:
bool Init(
const std::string &_masterHost,
62 unsigned int _masterPort,
63 uint32_t _timeoutIterations = 30);
67 public:
bool IsInitialized()
const;
75 public:
bool IsRunning()
const;
88 public:
void Subscribe(
const std::string &_topic,
89 const std::string &_msgType,
94 public:
void Unsubscribe(
const msgs::Subscribe &_sub);
99 public:
void Unsubscribe(
const std::string &_topic,
100 const std::string &_msgType);
105 public:
void Advertise(
const std::string &_topic,
106 const std::string &_msgType);
110 public:
void Unadvertise(
const std::string &_topic);
114 public:
void GetAllPublishers(std::list<msgs::Publish> &_publishers);
122 public:
void RegisterTopicNamespace(
const std::string &_name);
126 public:
void GetTopicNamespaces(std::list<std::string> &_namespaces);
132 private:
ConnectionPtr FindConnection(
const std::string &_host,
139 public:
ConnectionPtr ConnectToRemoteHost(
const std::string &_host,
143 public:
void TriggerUpdate();
148 private:
void OnMasterRead(
const std::string &_data);
158 const std::string &_data);
162 private:
void ProcessMessage(
const std::string &_packet);
165 private:
void RunUpdate();
168 private: boost::condition_variable updateCondition;
171 private: boost::mutex updateMutex;
176 private: std::list<ConnectionPtr> connections;
179 private:
bool initialized;
180 private:
bool stop, stopped;
182 private:
unsigned int tmpIndex;
183 private: boost::recursive_mutex listMutex;
186 private: boost::mutex namespaceMutex;
187 private: boost::recursive_mutex masterMessagesMutex;
188 private: boost::recursive_mutex connectionMutex;
190 private: std::list<msgs::Publish> publishers;
191 private: std::list<std::string> namespaces;
192 private: std::list<std::string> masterMessages;
195 private: boost::condition_variable namespaceCondition;
Forward declarations for the common classes.
Definition: Animation.hh:26
transport
Definition: ConnectionManager.hh:35
Singleton template class.
Definition: SingletonT.hh:33
std::vector< event::ConnectionPtr > eventConnections
Definition: ConnectionManager.hh:177
void stop()
Stop the transport component from running.
boost::shared_ptr< Connection > ConnectionPtr
Definition: Connection.hh:51
Manager of connections.
Definition: ConnectionManager.hh:46
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition: SingletonT.hh:61