Struct ChunkHeader

Struct Documentation

struct ChunkHeader

Public Types

using UserPayloadOffset_t = uint32_t

Public Functions

ChunkHeader(const uint32_t chunkSize, const ChunkSettings &chunkSettings) noexcept

constructs and initializes a ChunkHeader

Parameters:
  • chunkSize[in] is the size of the chunk the ChunkHeader is constructed

  • chunkSettings[in] are the settings like user-payload size and user-header alignment

ChunkHeader(const ChunkHeader&) = delete
ChunkHeader(ChunkHeader&&) = delete
ChunkHeader &operator=(const ChunkHeader&) = delete
ChunkHeader &operator=(ChunkHeader&&) = delete
uint8_t chunkHeaderVersion() const noexcept

The ChunkHeader version is used to detect incompatibilities for record&replay functionality.

Returns:

the ChunkHeader version

uint16_t userHeaderId() const noexcept

The id of the user-header used by the chunk; if no user-header is used, this is set to NO_USER_HEADER.

Returns:

the user-header id of the chunk

void *userHeader() noexcept

Get the pointer to the user-header.

Returns:

the pointer to the user-header

const void *userHeader() const noexcept

Get the const pointer to the user-header.

Returns:

the const pointer to the user-header

void *userPayload() noexcept

Get a pointer to the user-payload carried by the chunk.

Returns:

the pointer to the user-payload

const void *userPayload() const noexcept

Get a const pointer to the user-payload carried by the chunk.

Returns:

the const pointer to the user-payload

uint32_t usedSizeOfChunk() const noexcept

Calculates the used size of the chunk with the ChunkHeader, user-heander and user-payload.

Returns:

the used size of the chunk

uint32_t chunkSize() const noexcept

The size of the whole chunk, including the header.

Returns:

the chunk size

uint32_t userHeaderSize() const noexcept

The size of the chunk occupied by the user-header.

Returns:

the user-header size

uint32_t userPayloadSize() const noexcept

The size of the chunk occupied by the user-payload.

Returns:

the user-payload size

uint32_t userPayloadAlignment() const noexcept

The alignment of the chunk occupied by the user-payload.

Returns:

the user-payload alignment

popo::UniquePortId originId() const noexcept

The unique identifier of the publisher the chunk was sent from.

Returns:

the id of the publisher the chunk was sent from

uint64_t sequenceNumber() const noexcept

A serial number for the sent chunks.

the serquence number of the chunk

Public Static Functions

static ChunkHeader *fromUserPayload(void *const userPayload) noexcept

Get a pointer to the ChunkHeader associated to the user-payload of the chunk.

Parameters:

userPayload[in] is the pointer to the user-payload of the chunk

Returns:

the pointer to the ChunkHeader or a nullptr if userPayload is a nullptr

static const ChunkHeader *fromUserPayload(const void *const userPayload) noexcept

Get a const pointer to the ChunkHeader associated to the user-payload of the chunk.

Parameters:

userPayload[in] is the const pointer to the user-payload of the chunk

Returns:

the const pointer to the ChunkHeader or a nullptr if userPayload is a nullptr

static ChunkHeader *fromUserHeader(void *const userHeader) noexcept

Get a pointer to the ChunkHeader associated to the user-header of the chunk.

Parameters:

userHeader[in] is the pointer to the user-header of the chunk

Returns:

the pointer to the ChunkHeader or a nullptr if userHeader is a nullptr

static const ChunkHeader *fromUserHeader(const void *const userHeader) noexcept

Get a const pointer to the ChunkHeader associated to the user-header of the chunk.

Parameters:

userHeader[in] is the const pointer to the user-header of the chunk

Returns:

the const pointer to the ChunkHeader or a nullptr if userPayload is a nullptr

Public Static Attributes

static constexpr uint8_t CHUNK_HEADER_VERSION = {1U}

From the 1.0 release onward, this must be incremented for each incompatible change, e.g.

  • data width of members changes

  • members are rearranged

  • semantic meaning of a member changes

static constexpr uint16_t NO_USER_HEADER = {0x0000}

User-Header id for no user-header.

static constexpr uint16_t UNKNOWN_USER_HEADER = {0xFFFF}

User-Header id for an unknown user-header.

Friends

friend class popo::ChunkSender