Ignition Transport

API Reference

8.1.0
SubscriptionMsg Class Reference

Subscription packet used in the discovery protocol for requesting information about a given topic. More...

#include <ignition/transport/Packet.hh>

Public Member Functions

 SubscriptionMsg ()=default
 Constructor. More...
 
 SubscriptionMsg (const transport::Header &_header, const std::string &_topic)
 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 subscription message. More...
 
void SetHeader (const transport::Header &_header)
 Set the header of the message. More...
 
void SetTopic (const std::string &_topic)
 Set the topic. More...
 
std::string Topic () const
 Get the topic. More...
 
size_t Unpack (const char *_buffer)
 Unserialize a stream of bytes into a Sub. More...
 

Friends

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

Detailed Description

Subscription packet used in the discovery protocol for requesting information about a given topic.

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

Constructor & Destructor Documentation

◆ SubscriptionMsg() [1/2]

SubscriptionMsg ( )
default

Constructor.

◆ SubscriptionMsg() [2/2]

SubscriptionMsg ( const transport::Header _header,
const std::string _topic 
)

Constructor.

Parameters
[in]_headerMessage header.
[in]_topicTopic name.

Member Function Documentation

◆ Header()

Get the message header.

Returns
Reference to the message header.
See also
SetHeader.

◆ MsgLength()

size_t MsgLength ( ) const

Get the total length of the message.

Returns
Return the length of the message in bytes.

◆ Pack()

size_t Pack ( char *  _buffer) const

Serialize the subscription message.

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

◆ SetHeader()

void SetHeader ( const transport::Header _header)

Set the header of the message.

Parameters
[in]_headerMessage header.
See also
Header.

◆ SetTopic()

void SetTopic ( const std::string _topic)

Set the topic.

Parameters
[in]_topicTopic name.
See also
Topic.

◆ Topic()

std::string Topic ( ) const

Get the topic.

Returns
Topic name.
See also
SetTopic.

◆ Unpack()

size_t Unpack ( const char *  _buffer)

Unserialize a stream of bytes into a Sub.

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 SubscriptionMsg _msg 
)
friend

Stream insertion operator.

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

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