Header included in each discovery message containing the version of the discovery protocol, the process UUID of the sender node, the type. More...
#include <ignition/transport/Packet.hh>
Public Member Functions | |
Header ()=default | |
Constructor. More... | |
Header (const uint16_t _version, const std::string &_pUuid, const uint8_t _type, const uint16_t _flags=0) | |
Constructor. More... | |
virtual | ~Header ()=default |
Destructor. More... | |
uint16_t | Flags () const |
Get the message flags. More... | |
int | HeaderLength () const |
Get the header length. More... | |
size_t | Pack (char *_buffer) const |
Serialize the header. The caller has ownership of the buffer and is responsible for its [de]allocation. More... | |
std::string | PUuid () const |
Get the process uuid. More... | |
void | SetFlags (const uint16_t _flags) |
Set the message flags. More... | |
void | SetPUuid (const std::string &_pUuid) |
Set the process uuid. More... | |
void | SetType (const uint8_t _type) |
Set the message type. More... | |
void | SetVersion (const uint16_t _version) |
Set the discovery protocol version. More... | |
uint8_t | Type () const |
Get the message type. More... | |
size_t | Unpack (const char *_buffer) |
Unserialize the header. More... | |
uint16_t | Version () const |
Get the discovery protocol version. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &_out, const Header &_header) |
Stream insertion operator. More... | |
Detailed Description
Header included in each discovery message containing the version of the discovery protocol, the process UUID of the sender node, the type.
Constructor & Destructor Documentation
◆ Header() [1/2]
|
default |
Constructor.
◆ Header() [2/2]
Header | ( | const uint16_t | _version, |
const std::string & | _pUuid, | ||
const uint8_t | _type, | ||
const uint16_t | _flags = 0 |
||
) |
Constructor.
- Parameters
-
[in] _version Version of the discovery protocol. [in] _pUuid Every process has a unique UUID. [in] _type Message type (ADVERTISE, SUBSCRIPTION, ...) [in] _flags Optional flags included in the header.
◆ ~Header()
|
virtualdefault |
Destructor.
Member Function Documentation
◆ Flags()
uint16_t Flags | ( | ) | const |
Get the message flags.
- Returns
- Message flags used for compression or other optional features.
- See also
- SetFlags.
◆ HeaderLength()
int HeaderLength | ( | ) | const |
Get the header length.
- Returns
- The header length in bytes.
Referenced by Discovery< Pub >::WaitForInit().
◆ Pack()
size_t Pack | ( | char * | _buffer | ) | const |
Serialize the header. The caller has ownership of the buffer and is responsible for its [de]allocation.
- Parameters
-
[out] _buffer Destination buffer in which the header will be serialized.
- Returns
- Number of bytes serialized.
◆ PUuid()
std::string PUuid | ( | ) | const |
Get the process uuid.
- Returns
- A unique global identifier for every process.
- See also
- SetPUuid.
Referenced by Discovery< Pub >::WaitForInit().
◆ SetFlags()
void SetFlags | ( | const uint16_t | _flags | ) |
◆ SetPUuid()
void SetPUuid | ( | const std::string & | _pUuid | ) |
Set the process uuid.
- Parameters
-
[in] _pUuid A unique global identifier for every process.
- See also
- PUuid.
◆ SetType()
void SetType | ( | const uint8_t | _type | ) |
Set the message type.
- Parameters
-
[in] _type Message type (ADVERTISE, SUBSCRIPTION, ...).
- See also
- Type.
◆ SetVersion()
void SetVersion | ( | const uint16_t | _version | ) |
◆ Type()
uint8_t Type | ( | ) | const |
Get the message type.
- Returns
- Message type (ADVERTISE, SUBSCRIPTION, ...)
- See also
- SetType.
Referenced by Discovery< Pub >::WaitForInit().
◆ Unpack()
size_t Unpack | ( | const char * | _buffer | ) |
Unserialize the header.
- Parameters
-
[in] _buffer Input buffer with the data to be unserialized.
Referenced by Discovery< Pub >::WaitForInit().
◆ Version()
uint16_t Version | ( | ) | const |
Get the discovery protocol version.
- Returns
- The discovery protocol version.
- See also
- SetVersion.
Referenced by Discovery< Pub >::WaitForInit().
Friends And Related Function Documentation
◆ operator<<
|
friend |
Stream insertion operator.
- Parameters
-
[out] _out The output stream. [in] _msg Header to write to the stream.
The documentation for this class was generated from the following file: