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

A class that is used to store information about an advertised publisher. More...

#include <Node.hh>

Public Member Functions

 Publisher ()
 Default constructor. More...
 
 Publisher (const MessagePublisher &_publisher)
 Constructor. More...
 
virtual ~Publisher ()
 Destructor. More...
 
bool HasConnections () const
 Return true if this publisher has subscribers. More...
 
 operator bool ()
 Allows this class to be evaluated as a boolean. More...
 
bool Publish (const ProtoMsg &_msg)
 Publish a message. More...
 
bool Valid () const
 Return true if valid information, such as a non-empty topic name, is present. More...
 

Detailed Description

A class that is used to store information about an advertised publisher.

An instance of this class is returned from Node::Advertise, and should be used in subsequent Node::Publisher::Publish calls.

Pseudo code example

auto pub = myNode.Advertise<MsgType>("topic_name"); if (pub) { MsgType msg; pub.Publish(msg); }

Constructor & Destructor Documentation

ignition::transport::Node::Publisher::Publisher ( )

Default constructor.

ignition::transport::Node::Publisher::Publisher ( const MessagePublisher _publisher)
explicit

Constructor.

Parameters
[in]_publisherA message publisher.
virtual ignition::transport::Node::Publisher::~Publisher ( )
virtual

Destructor.

Member Function Documentation

bool ignition::transport::Node::Publisher::HasConnections ( ) const

Return true if this publisher has subscribers.

Returns
True if subscribers have connected to this publisher.
ignition::transport::Node::Publisher::operator bool ( )

Allows this class to be evaluated as a boolean.

Returns
True if valid
See Also
Valid
bool ignition::transport::Node::Publisher::Publish ( const ProtoMsg _msg)

Publish a message.

Parameters
[in]_msgA google::protobuf message.
Returns
true when success.
bool ignition::transport::Node::Publisher::Valid ( ) const

Return true if valid information, such as a non-empty topic name, is present.

Returns
True if this object can be used in Publish() calls.

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