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

A publisher of messages on a topic. More...

#include <transport/transport.hh>

Public Member Functions

 Publisher (const std::string &_topic, const std::string &_msgType, unsigned int _limit, bool _latch) GAZEBO_DEPRECATED(1.5)
 Deprecated.
 Publisher (const std::string &_topic, const std::string &_msgType, unsigned int _limit, double _hzRate)
 Constructor.
virtual ~Publisher ()
 Destructor.
bool GetLatching () const GAZEBO_DEPRECATED(1.5)
 Deprecated.
std::string GetMsgType () const
 Get the message type.
unsigned int GetOutgoingCount () const
 Get the number of outgoing messages.
std::string GetPrevMsg () const
 Get the previously published message.
MessagePtr GetPrevMsgPtr () const
 Get the previously published message.
std::string GetTopic () const
 Get the topic name.
bool HasConnections () const
 Are there any connections?
void Publish (const google::protobuf::Message &_message, bool _block=false)
 Publish a protobuf message on the topic.
template<typename M >
void Publish (M _message, bool _block=false)
 Publish an arbitrary message on the topic.
void SendMessage ()
 Send latest message over the wire. For internal use only.
void SetNode (NodePtr _node)
 Set our containing node.
void SetPublication (PublicationPtr &_publication, int _i) GAZEBO_DEPRECATED(1.5)
 DEPRECATED in version 1.6.
void SetPublication (PublicationPtr _publication)
 Set the publication object for a particular publication.
void WaitForConnection () const
 Block until a connection has been established with this publisher.
bool WaitForConnection (const common::Time &_timeout) const
 Block until a connection has been established with this publisher.

Detailed Description

A publisher of messages on a topic.

Constructor & Destructor Documentation

gazebo::transport::Publisher::Publisher ( const std::string &  _topic,
const std::string &  _msgType,
unsigned int  _limit,
bool  _latch 
)

Deprecated.

gazebo::transport::Publisher::Publisher ( const std::string &  _topic,
const std::string &  _msgType,
unsigned int  _limit,
double  _hzRate 
)

Constructor.

Parameters
[in]_topicName of topic to be published
[in]_msgTypeType of the message to be published
[in]_limitMaximum number of outgoing messages to queue
[in]_hzUpdate rate for the publisher. Units are 1.0/seconds.
virtual gazebo::transport::Publisher::~Publisher ( )
virtual

Destructor.

Member Function Documentation

bool gazebo::transport::Publisher::GetLatching ( ) const

Deprecated.

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

Get the message type.

Returns
The message type
unsigned int gazebo::transport::Publisher::GetOutgoingCount ( ) const

Get the number of outgoing messages.

Returns
The number of outgoing messages
std::string gazebo::transport::Publisher::GetPrevMsg ( ) const

Get the previously published message.

Returns
The previously published message, if any
MessagePtr gazebo::transport::Publisher::GetPrevMsgPtr ( ) const

Get the previously published message.

Returns
The previously published message, if any
std::string gazebo::transport::Publisher::GetTopic ( ) const

Get the topic name.

Returns
The topic name
bool gazebo::transport::Publisher::HasConnections ( ) const

Are there any connections?

Returns
true if there are any connections, false otherwise
void gazebo::transport::Publisher::Publish ( const google::protobuf::Message &  _message,
bool  _block = false 
)
inline

Publish a protobuf message on the topic.

Parameters
[in]_messageMessage to be published
[in]_blockWhether to block until the message is actually written out
template<typename M >
void gazebo::transport::Publisher::Publish ( _message,
bool  _block = false 
)
inline

Publish an arbitrary message on the topic.

Parameters
[in]_messageMessage to be published
[in]_blockWhether to block until the message is actually written out
void gazebo::transport::Publisher::SendMessage ( )

Send latest message over the wire. For internal use only.

void gazebo::transport::Publisher::SetNode ( NodePtr  _node)

Set our containing node.

Parameters
[in]_nodePointer to a node. Should be the node that create this publisher.
void gazebo::transport::Publisher::SetPublication ( PublicationPtr _publication,
int  _i 
)

DEPRECATED in version 1.6.

See Also
SetPublication
void gazebo::transport::Publisher::SetPublication ( PublicationPtr  _publication)

Set the publication object for a particular publication.

Parameters
[in]_publicationPointer to the publication object to be set
void gazebo::transport::Publisher::WaitForConnection ( ) const

Block until a connection has been established with this publisher.

bool gazebo::transport::Publisher::WaitForConnection ( const common::Time _timeout) const

Block until a connection has been established with this publisher.

Parameters
[in]_timeoutMaxiumum time to wait. Use a negative time value to wait forever.
Returns
True if a connection was established.

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