20#include "pw_allocator/deallocator.h"
21#include "pw_allocator/internal/control_block.h"
23namespace pw::multibuf::internal {
43 static constexpr size_t kMaxSize = ~(1U << 15);
85 return (chunk + 1) * entries_per_chunk - 1;
Abstract interface for releasing memory.
Definition: deallocator.h:29
Describes the entire memory region.
Definition: entry.h:98
size_type shared
Definition: entry.h:111
size_type owned
Definition: entry.h:104
size_type length
Amount of data from the buffer to present.
Definition: entry.h:107
size_type offset
Starting offset within the buffer of the data to present.
Definition: entry.h:100
size_type length
Amount of data from the buffer to present.
Definition: entry.h:127
size_type boundary
Definition: entry.h:132
size_type offset
Starting offset within the buffer of the data to present.
Definition: entry.h:118
size_type sealed
Definition: entry.h:124
static constexpr size_type kMinEntriesPerChunk
Minimum number of entries per chunk.
Definition: entry.h:55
allocator::internal::ControlBlock * control_block
Optional control block involved in freeing shared memory.
Definition: entry.h:92
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.
Definition: entry.h:70
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.
Definition: entry.h:76
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.
Definition: entry.h:58
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.
Definition: entry.h:64
static constexpr size_t kMaxSize
Offset and length must fit in 15 bits.
Definition: entry.h:43
static constexpr size_type kBaseViewIndex
Per-chunk index entry that holds the base view of the data.
Definition: entry.h:52
std::byte * data
Pointer to memory.
Definition: entry.h:95
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.
Definition: entry.h:83
uint16_t size_type
Definition: entry.h:40
Deallocator * deallocator
Optional deallocator involved in freeing owned memory.
Definition: entry.h:89
static constexpr size_type kDataIndex
Per-chunk index entry that holds the data pointer.
Definition: entry.h:49
static constexpr size_type kMemoryContextIndex
Per-chunk index entry that holds the deallocator or control block.
Definition: entry.h:46