A publication for a topic.
More...
#include <transport/transport.hh>
Inherits enable_shared_from_this< Publication >.
A publication for a topic.
This facilitates transport of messages
◆ Publication()
Publication |
( |
const std::string & | _topic, |
|
|
const std::string & | _msgType ) |
Constructor.
- Parameters
-
[in] | _topic | The topic we're publishing |
[in] | _msgType | The type of the topic we're publishing |
◆ ~Publication()
◆ AddPublisher()
Add a publisher.
- Parameters
-
[in,out] | _pub | Pointer to publisher object to be added |
◆ AddSubscription() [1/2]
Subscribe a callback to our topic.
- Parameters
-
[in] | _callback | The callback |
◆ AddSubscription() [2/2]
void AddSubscription |
( |
const NodePtr & | _node | ) |
|
Subscribe a node to our topic.
- Parameters
-
◆ AddTransport()
Add a transport.
- Parameters
-
[in] | _publink | Pointer to publication transport object to be added |
◆ ClearPrevMsgs()
Clear all previous messages for a publisher.
◆ GetCallbackCount()
unsigned int GetCallbackCount |
( |
| ) |
const |
Get the number of callbacks.
- Returns
- The number of callbacks
◆ GetLocallyAdvertised()
bool GetLocallyAdvertised |
( |
| ) |
const |
Was the topic has been advertised from this process?
- Returns
- true if the topic has been advertised from this process, false otherwise
◆ GetMsgType()
std::string GetMsgType |
( |
| ) |
const |
Get the type of message.
- Returns
- The type of message
◆ GetNodeCount()
unsigned int GetNodeCount |
( |
| ) |
const |
Get the number of nodes.
- Returns
- The number of nodes
◆ GetPrevMsg()
Get a previous message for a publisher.
- Parameters
-
[in] | _pubId | ID of the publisher. |
- Returns
- Pointer to the previous message. NULL if there is no previous message.
◆ GetRemoteSubscriptionCount()
unsigned int GetRemoteSubscriptionCount |
( |
| ) |
|
Get the number of remote subscriptions.
- Returns
- The number of remote subscriptions
◆ GetTransportCount()
unsigned int GetTransportCount |
( |
| ) |
const |
Get the number of transports.
- Returns
- The number of transports
◆ HasTransport()
bool HasTransport |
( |
const std::string & | _host, |
|
|
unsigned int | _port ) |
Does a given transport exist?
- Parameters
-
[in] | _host | Hostname of the transport |
[in] | _port | Port of the transport |
- Returns
- true if the transport exists, false otherwise
◆ LocalPublish()
void LocalPublish |
( |
const std::string & | _data | ) |
|
Publish data to local subscribers (skip serialization)
- Parameters
-
[in] | _data | The data to be published |
◆ Publish()
int Publish |
( |
MessagePtr | _msg, |
|
|
boost::function< void(uint32_t)> | _cb, |
|
|
uint32_t | _id ) |
Publish data to remote subscribers.
- Parameters
-
[in] | _msg | Message to be published |
[in] | _cb | Callback to be invoked after publishing is completed |
- Returns
- Number of remote subscribers that will receive the message.
◆ PublisherCount()
unsigned int PublisherCount |
( |
| ) |
const |
Get the number of publishers.
- Returns
- The number of publishers.
◆ RemovePublisher() [1/2]
bool RemovePublisher |
( |
const uint32_t | id | ) |
|
Remove a publisher, based on a publisher ID.
- Parameters
-
[in] | _id | ID of the publisher to remove. |
- Returns
- True if successful.
◆ RemovePublisher() [2/2]
Remove a publisher.
- Parameters
-
[in] | _pub | Pointer to publisher object to remove. |
◆ RemoveSubscription() [1/2]
void RemoveSubscription |
( |
const NodePtr & | _node | ) |
|
Unsubscribe a node from our topic.
- Parameters
-
◆ RemoveSubscription() [2/2]
void RemoveSubscription |
( |
const std::string & | _host, |
|
|
unsigned int | _port ) |
Unsubscribe a a node by host/port from our topic.
- Parameters
-
[in] | _host | The node's hostname |
[in] | _port | The node's port |
◆ RemoveTransport()
void RemoveTransport |
( |
const std::string & | _host, |
|
|
unsigned int | _port ) |
Remove a transport.
- Parameters
-
[in] | _host | The transport's hostname |
[in] | _port | The transport's port |
◆ SetLocallyAdvertised()
void SetLocallyAdvertised |
( |
bool | _value | ) |
|
Set whether this topic has been advertised from this process.
- Parameters
-
[in] | _value | If true, the topic was locally advertise, otherwise it was not |
◆ SetPrevMsg()
void SetPrevMsg |
( |
uint32_t | _pubId, |
|
|
MessagePtr | _msg ) |
Set the previous message for a publisher.
- Parameters
-
[in] | _pubId | ID of the publisher. |
[in] | _msg | The previous message. |
The documentation for this class was generated from the following file: