C/C++ API Reference
Loading...
Searching...
No Matches
pw::multibuf::internal::Entry Union Reference

Overview

Describes either a memory location or a view of an associated location.

This module stores byte buffers in queues using sequences of entries. The first entry holds an address, and subsequent entries hold the offset and lengths of ever-narrower views of that data. This provides a compact representation of data encoded using nested or layered protocols.

For example, in a TCP/IP stack:

  • The first entry hold addresses to Ethernet frames.
  • The second entry holds a zero offset and the whole frame length.
  • The third entry holds the offset and length describing the IP data.
  • The fourth entry holds the offset and length describing the TCP data.

Classes

struct  BaseView
 Describes the entire memory region. More...
 
struct  View
 

Public Types

using size_type = uint16_t
 

Static Public Member Functions

static constexpr size_type memory_context_index (size_type chunk, size_type entries_per_chunk)
 Returns the index to the data entry of a given chunk.
 
static constexpr size_type data_index (size_type chunk, size_type entries_per_chunk)
 Returns the index to the data entry of a given chunk.
 
static constexpr size_type base_view_index (size_type chunk, size_type entries_per_chunk)
 Returns the index to the base view entry of a given chunk.
 
static constexpr size_type view_index (size_type chunk, size_type entries_per_chunk, size_type layer)
 Returns the index to a view entry of a given chunk.
 
static constexpr size_type top_view_index (size_type chunk, size_type entries_per_chunk)
 Returns the index to the top view entry of a given chunk.
 

Public Attributes

Deallocatordeallocator
 Optional deallocator involved in freeing owned memory.
 
allocator::internal::ControlBlock * control_block
 Optional control block involved in freeing shared memory.
 
std::byte * data
 Pointer to memory.
 
struct pw::multibuf::internal::Entry::BaseView base_view
 
struct pw::multibuf::internal::Entry::View view
 

Static Public Attributes

static constexpr size_t kMaxSize = ~(1U << 15)
 Offset and length must fit in 15 bits.
 
static constexpr size_type kMemoryContextIndex = 0
 Per-chunk index entry that holds the deallocator or control block.
 
static constexpr size_type kDataIndex = 1
 Per-chunk index entry that holds the data pointer.
 
static constexpr size_type kBaseViewIndex = 2
 Per-chunk index entry that holds the base view of the data.
 
static constexpr size_type kMinEntriesPerChunk = 3
 Minimum number of entries per chunk.
 

Member Typedef Documentation

◆ size_type

Entries fit in a single word on 32-bit platforms and larger. Fields are ordered in such a way to ensure this is true on supported platforms.


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