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);
89 const std::string &_msgType,
100 const std::string &_msgType);
106 const std::string &_msgType);
132 private:
ConnectionPtr FindConnection(
const std::string &_host,
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;
gazebo
Definition ConnectionManager.hh:35
transport
Definition ConnectionManager.hh:35
Singleton template class.
Definition SingletonT.hh:34
Manager of connections.
Definition ConnectionManager.hh:48
void Fini()
Finalize the connection manager.
void GetAllPublishers(std::list< msgs::Publish > &_publishers)
Explicitly update the publisher list.
void RemoveConnection(ConnectionPtr &_conn)
Remove a connection from the manager.
void Unsubscribe(const std::string &_topic, const std::string &_msgType)
Unsubscribe from a topic.
void Stop()
Stop the conneciton manager.
void Subscribe(const std::string &_topic, const std::string &_msgType, bool _latching)
Subscribe to a topic.
bool IsInitialized() const
Is the manager initialized?
bool Init(const std::string &_masterHost, unsigned int _masterPort, uint32_t _timeoutIterations=30)
Initialize the connection manager.
void TriggerUpdate()
Inform the connection manager that it needs an update.
void RegisterTopicNamespace(const std::string &_name)
Register a new topic namespace.
void GetTopicNamespaces(std::list< std::string > &_namespaces)
Get all the topic namespaces.
void Run()
Run the connection manager loop.
void Unsubscribe(const msgs::Subscribe &_sub)
Unsubscribe from a topic.
void Unadvertise(const std::string &_topic)
Unadvertise a topic.
std::vector< event::ConnectionPtr > eventConnections
Definition ConnectionManager.hh:177
bool IsRunning() const
Is the manager running?
ConnectionPtr ConnectToRemoteHost(const std::string &_host, unsigned int _port)
Connect to a remote server.
void Advertise(const std::string &_topic, const std::string &_msgType)
Advertise a topic.
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition SingletonT.hh:58
boost::shared_ptr< Connection > ConnectionPtr
Definition Connection.hh:54
Forward declarations for the common classes.
Definition Animation.hh:27