ConnectionManager Class Reference

Manager of connections. More...

#include <transport/transport.hh>

Inherits SingletonT< ConnectionManager >.

Public Member Functions

void Advertise (const std::string &_topic, const std::string &_msgType)
 Advertise a topic. More...
ConnectionPtr ConnectToRemoteHost (const std::string &_host, unsigned int _port)
 Connect to a remote server. More...
void Fini ()
 Finalize the connection manager. More...
void GetAllPublishers (std::list< msgs::Publish > &_publishers)
 Explicitly update the publisher list. More...
void GetTopicNamespaces (std::list< std::string > &_namespaces)
 Get all the topic namespaces. More...
bool Init (const std::string &_masterHost, unsigned int _masterPort, uint32_t _timeoutIterations=30)
 Initialize the connection manager. More...
bool IsRunning () const
 Is the manager running? More...
void RegisterTopicNamespace (const std::string &_name)
 Register a new topic namespace. More...
void RemoveConnection (ConnectionPtr &_conn)
 Remove a connection from the manager. More...
void Run ()
 Run the connection manager loop. More...
void Stop ()
 Stop the conneciton manager. More...
void Subscribe (const std::string &_topic, const std::string &_msgType, bool _latching)
 Subscribe to a topic. More...
void TriggerUpdate ()
 Inform the connection manager that it needs an update. More...
void Unadvertise (const std::string &_topic)
 Unadvertise a topic. More...
void Unsubscribe (const msgs::Subscribe &_sub)
 Unsubscribe from a topic. More...
void Unsubscribe (const std::string &_topic, const std::string &_msgType)
 Unsubscribe from a topic. More...

Static Public Member Functions

static ConnectionManagerInstance ()
 Get an instance of the singleton. More...

Protected Attributes

std::vector< event::ConnectionPtreventConnections

Detailed Description

Manager of connections.

Member Function Documentation

void Advertise ( const std::string &  _topic,
const std::string &  _msgType 

Advertise a topic.

[in]_topicThe topic to advertise
[in]_msgTypeThe type of the topic
ConnectionPtr ConnectToRemoteHost ( const std::string &  _host,
unsigned int  _port 

Connect to a remote server.

[in]_hostHost to connect to
[in]_portPort to connect to
Pointer to the connection; can be null (if connection failed)
void Fini ( )

Finalize the connection manager.

void GetAllPublishers ( std::list< msgs::Publish > &  _publishers)

Explicitly update the publisher list.

[out]_publishersThe updated list of publishers is written here
void GetTopicNamespaces ( std::list< std::string > &  _namespaces)

Get all the topic namespaces.

[out]_namespacesThe list of namespace is written here
bool Init ( const std::string &  _masterHost,
unsigned int  _masterPort,
uint32_t  _timeoutIterations = 30 

Initialize the connection manager.

[in]_masterHostHost where the master is running.
[in]_masterPortPort where the master is running.
[in]_timeoutIterationsNumber of times to wait for a connection to master.
true if initialization succeeded, false otherwise
static ConnectionManager * Instance ( )

Get an instance of the singleton.

Referenced by TopicManager::Advertise().

bool IsRunning ( ) const

Is the manager running?

true if running, false otherwise
void RegisterTopicNamespace ( const std::string &  _name)

Register a new topic namespace.

[in]_nameThe name of the topic namespace to be registered
void RemoveConnection ( ConnectionPtr _conn)

Remove a connection from the manager.

[in]_connThe connection to be removed
void Run ( )

Run the connection manager loop.

Does not return until stopped.

void Stop ( )

Stop the conneciton manager.

void Subscribe ( const std::string &  _topic,
const std::string &  _msgType,
bool  _latching 

Subscribe to a topic.

[in]_topicThe topic to subscribe to.
[in]_msgTypeThe type of the topic.
[in]_latchingIf true, latch the latest incoming message; otherwise don't.
void TriggerUpdate ( )

Inform the connection manager that it needs an update.

void Unadvertise ( const std::string &  _topic)

Unadvertise a topic.

[in]_topicThe topic to unadvertise
void Unsubscribe ( const msgs::Subscribe &  _sub)

Unsubscribe from a topic.

[in]_subA subscription object
void Unsubscribe ( const std::string &  _topic,
const std::string &  _msgType 

Unsubscribe from a topic.

[in]_topicThe topic to unsubscribe from
[in]_msgTypeThe type of the topic

Member Data Documentation

std::vector<event::ConnectionPtr> eventConnections

The documentation for this class was generated from the following file: