Ignition Transport

API Reference

8.1.0
AdvertiseMessage< T > Class Template Reference

Advertise packet used in the discovery protocol to broadcast information about the node advertising a topic. The information sent contains the name of the protobuf message type advertised. This message is used for advertising messages and services. 'T' is the Publisher type used inside this AdvertiseMessage object. More...

#include <ignition/transport/Packet.hh>

Public Member Functions

 AdvertiseMessage ()=default
 Constructor. More...
 
 AdvertiseMessage (const Header &_header, const T &_publisher)
 Constructor. More...
 
transport::Header Header () const
 Get the message header. More...
 
size_t MsgLength () const
 Get the total length of the message. More...
 
size_t Pack (char *_buffer) const
 Serialize the advertise message. More...
 
T & Publisher ()
 Get the publisher of this message. More...
 
void SetFromDiscovery (const msgs::Discovery &_msg)
 Set from discovery message. More...
 
void SetHeader (const transport::Header &_header)
 Set the header of the message. More...
 
void SetPublisher (const T &_publisher)
 Set the publisher of this message. More...
 
size_t Unpack (const char *_buffer)
 Unserialize a stream of bytes into an AdvertiseMessage. More...
 

Friends

std::ostreamoperator<< (std::ostream &_out, const AdvertiseMessage &_msg)
 Stream insertion operator. More...
 

Detailed Description

template<class T>
class ignition::transport::AdvertiseMessage< T >

Advertise packet used in the discovery protocol to broadcast information about the node advertising a topic. The information sent contains the name of the protobuf message type advertised. This message is used for advertising messages and services. 'T' is the Publisher type used inside this AdvertiseMessage object.

Deprecated:
This class is deprecated. Discovery uses the ignition::msgs::Discovery message.

Constructor & Destructor Documentation

◆ AdvertiseMessage() [1/2]

AdvertiseMessage ( )
default

Constructor.

◆ AdvertiseMessage() [2/2]

AdvertiseMessage ( const Header _header,
const T &  _publisher 
)
inline

Constructor.

Parameters
[in]_headerMessage header.
[in]_publisherContains the topic name, UUIDs, addresses.

Member Function Documentation

◆ Header()

transport::Header Header ( ) const
inline

Get the message header.

Returns
Reference to the message header.
See also
SetHeader.

◆ MsgLength()

size_t MsgLength ( ) const
inline

Get the total length of the message.

Returns
Return the length of the message in bytes.

◆ Pack()

size_t Pack ( char *  _buffer) const
inline

Serialize the advertise message.

Parameters
[out]_bufferBuffer where the message will be serialized.
Returns
The length of the serialized message in bytes.

◆ Publisher()

T& Publisher ( )
inline

Get the publisher of this message.

Returns
Publisher.
See also
SetPublisher.

◆ SetFromDiscovery()

void SetFromDiscovery ( const msgs::Discovery &  _msg)
inline

Set from discovery message.

Parameters
[in]_msgDiscovery message.

◆ SetHeader()

void SetHeader ( const transport::Header _header)
inline

Set the header of the message.

Parameters
[in]_headerMessage header.
See also
Header.

◆ SetPublisher()

void SetPublisher ( const T &  _publisher)
inline

Set the publisher of this message.

Parameters
[in]_publisherNew publisher.
See also
Publisher.

◆ Unpack()

size_t Unpack ( const char *  _buffer)
inline

Unserialize a stream of bytes into an AdvertiseMessage.

Parameters
[out]_bufferUnpack the body from the buffer.
Returns
The number of bytes from the body.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream _out,
const AdvertiseMessage< T > &  _msg 
)
friend

Stream insertion operator.

Parameters
[out]_outThe output stream.
[in]_msgAdvertiseMsg to write to the stream.

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