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