All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
gazebo::transport::Publication Class Reference

A publication for a topic. More...

#include <transport/transport.hh>

Public Member Functions

 Publication (const std::string &_topic, const std::string &_msgType)
 Constructor.
 
virtual ~Publication ()
 Destructor.
 
void AddPublisher (PublisherPtr _pub)
 Add a publisher.
 
void AddSubscription (const CallbackHelperPtr &_callback)
 Subscribe a callback to our topic.
 
void AddSubscription (const NodePtr &_node)
 Subscribe a node to our topic.
 
void AddTransport (const PublicationTransportPtr &_publink)
 Add a transport.
 
unsigned int GetCallbackCount () const
 Get the number of callbacks.
 
bool GetLocallyAdvertised () const
 Was the topic has been advertised from this process?
 
std::string GetMsgType () const
 Get the type of message.
 
unsigned int GetNodeCount () const
 Get the number of nodes.
 
unsigned int GetRemoteSubscriptionCount ()
 Get the number of remote subscriptions.
 
unsigned int GetTransportCount () const
 Get the number of transports.
 
bool HasTransport (const std::string &_host, unsigned int _port)
 Does a given transport exist?
 
void LocalPublish (const std::string &_data)
 Publish data to local subscribers (skip serialization)
 
void Publish (const google::protobuf::Message &_msg, const boost::function< void()> &_cb=NULL)
 Publish data to remote subscribers.
 
void RemoveSubscription (const NodePtr &_node)
 Unsubscribe a node from our topic.
 
void RemoveSubscription (const std::string &_host, unsigned int _port)
 Unsubscribe a a node by host/port from our topic.
 
void RemoveTransport (const std::string &_host, unsigned int _port)
 Remove a transport.
 
void SetLocallyAdvertised (bool _value)
 Set whether this topic has been advertised from this process.
 

Detailed Description

A publication for a topic.

This facilitates transport of messages

Constructor & Destructor Documentation

gazebo::transport::Publication::Publication ( const std::string &  _topic,
const std::string &  _msgType 
)

Constructor.

Parameters
[in]_topicThe topic we're publishing
[in]_msgTypeThe type of the topic we're publishing
virtual gazebo::transport::Publication::~Publication ( )
virtual

Destructor.

Member Function Documentation

void gazebo::transport::Publication::AddPublisher ( PublisherPtr  _pub)

Add a publisher.

Parameters
[in,out]_pubPointer to publisher object to be added

Referenced by gazebo::transport::TopicManager::Advertise().

void gazebo::transport::Publication::AddSubscription ( const CallbackHelperPtr _callback)

Subscribe a callback to our topic.

Parameters
[in]_callbackThe callback

Referenced by gazebo::transport::TopicManager::Advertise().

void gazebo::transport::Publication::AddSubscription ( const NodePtr _node)

Subscribe a node to our topic.

Parameters
[in]_nodeThe node
void gazebo::transport::Publication::AddTransport ( const PublicationTransportPtr _publink)

Add a transport.

Parameters
[in]_publinkPointer to publication transport object to be added
unsigned int gazebo::transport::Publication::GetCallbackCount ( ) const

Get the number of callbacks.

Returns
The number of callbacks
bool gazebo::transport::Publication::GetLocallyAdvertised ( ) const

Was the topic has been advertised from this process?

Returns
true if the topic has been advertised from this process, false otherwise

Referenced by gazebo::transport::TopicManager::Advertise().

std::string gazebo::transport::Publication::GetMsgType ( ) const

Get the type of message.

Returns
The type of message
unsigned int gazebo::transport::Publication::GetNodeCount ( ) const

Get the number of nodes.

Returns
The number of nodes
unsigned int gazebo::transport::Publication::GetRemoteSubscriptionCount ( )

Get the number of remote subscriptions.

Returns
The number of remote subscriptions
unsigned int gazebo::transport::Publication::GetTransportCount ( ) const

Get the number of transports.

Returns
The number of transports
bool gazebo::transport::Publication::HasTransport ( const std::string &  _host,
unsigned int  _port 
)

Does a given transport exist?

Parameters
[in]_hostHostname of the transport
[in]_portPort of the transport
Returns
true if the transport exists, false otherwise
void gazebo::transport::Publication::LocalPublish ( const std::string &  _data)

Publish data to local subscribers (skip serialization)

Parameters
[in]_dataThe data to be published
void gazebo::transport::Publication::Publish ( const google::protobuf::Message &  _msg,
const boost::function< void()> &  _cb = NULL 
)

Publish data to remote subscribers.

Parameters
[in]_msgMessage to be published
[in]_cbIf non-null, callback to be invoked after publishing is completed
void gazebo::transport::Publication::RemoveSubscription ( const NodePtr _node)

Unsubscribe a node from our topic.

Parameters
[in]_nodeThe node
void gazebo::transport::Publication::RemoveSubscription ( const std::string &  _host,
unsigned int  _port 
)

Unsubscribe a a node by host/port from our topic.

Parameters
[in]_hostThe node's hostname
[in]_portThe node's port
void gazebo::transport::Publication::RemoveTransport ( const std::string &  _host,
unsigned int  _port 
)

Remove a transport.

Parameters
[in]_hostThe transport's hostname
[in]_portThe transport's port
void gazebo::transport::Publication::SetLocallyAdvertised ( bool  _value)

Set whether this topic has been advertised from this process.

Parameters
[in]_valueIf true, the topic was locally advertise, otherwise it was not

Referenced by gazebo::transport::TopicManager::Advertise().


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