##

ConnectionManager Class Reference
Transport

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 | IsInitialized () const
| Is the manager initialized? 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 ConnectionManager * | Instance ()
| Get an instance of the singleton. More...

## Protected Attributes

std::vector< event::ConnectionPtr > | eventConnections

## Detailed Description

Manager of connections.

## Member Function Documentation

## Advertise()

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

Advertise a topic.

Parameters

  [in] | _topic | The topic to advertise
  [in] | _msgType | The type of the topic

## ConnectToRemoteHost()

ConnectionPtr ConnectToRemoteHost | ( | const std::string & | _host,
|  | unsigned int | _port
| ) |  |

Connect to a remote server.

Parameters

  [in] | _host | Host to connect to
  [in] | _port | Port to connect to

Returns
  Pointer to the connection; can be null (if connection failed)

## Fini()

void Fini | ( |  | ) |

Finalize the connection manager.

## GetAllPublishers()

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

Explicitly update the publisher list.

Parameters

  [out] | _publishers | The updated list of publishers is written here

## GetTopicNamespaces()

void GetTopicNamespaces | ( | std::list< std::string > & | _namespaces | ) |

Get all the topic namespaces.

Parameters

  [out] | _namespaces | The list of namespace is written here

## Init()

bool Init | ( | const std::string & | _masterHost,
|  | unsigned int | _masterPort,
|  | uint32_t | _timeoutIterations = `30`
| ) |  |

Initialize the connection manager.

Parameters

  [in] | _masterHost | Host where the master is running.
  [in] | _masterPort | Port where the master is running.
  [in] | _timeoutIterations | Number of times to wait for a connection to master.

Returns
  true if initialization succeeded, false otherwise

## Instance()

static ConnectionManager * Instance | ( |  | ) |

inline static inherited

Get an instance of the singleton.

## IsInitialized()

bool IsInitialized | ( |  | ) | const

Is the manager initialized?

Returns
  true if initialized, false otherwise

## IsRunning()

bool IsRunning | ( |  | ) | const

Is the manager running?

Returns
  true if running, false otherwise

## RegisterTopicNamespace()

void RegisterTopicNamespace | ( | const std::string & | _name | ) |

Register a new topic namespace.

Parameters

  [in] | _name | The name of the topic namespace to be registered

## RemoveConnection()

void RemoveConnection | ( | ConnectionPtr & | _conn | ) |

Remove a connection from the manager.

Parameters

  [in] | _conn | The connection to be removed

## Run()

void Run | ( |  | ) |

Run the connection manager loop.

Does not return until stopped.

## Stop()

void Stop | ( |  | ) |

Stop the conneciton manager.

## Subscribe()

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

Subscribe to a topic.

Parameters

  [in] | _topic | The topic to subscribe to.
  [in] | _msgType | The type of the topic.
  [in] | _latching | If true, latch the latest incoming message; otherwise don't.

## TriggerUpdate()

void TriggerUpdate | ( |  | ) |

Inform the connection manager that it needs an update.

## Unadvertise()

void Unadvertise | ( | const std::string & | _topic | ) |

Unadvertise a topic.

Parameters

  [in] | _topic | The topic to unadvertise

## Unsubscribe() [1/2]

void Unsubscribe | ( | const msgs::Subscribe & | _sub | ) |

Unsubscribe from a topic.

Parameters

  [in] | _sub | A subscription object

## Unsubscribe() [2/2]

void Unsubscribe | ( | const std::string & | _topic,
|  | const std::string & | _msgType
| ) |  |

Unsubscribe from a topic.

Parameters

  [in] | _topic | The topic to unsubscribe from
  [in] | _msgType | The type of the topic

## Member Data Documentation

## eventConnections

std::vector<event::ConnectionPtr> eventConnections

protected

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

- ConnectionManager.hh