Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. C/C++
  4. pw::containers::internal::GenericVarLenEntryQueueBase Class Reference
Loading...
Searching...
No Matches
pw::containers::internal::GenericVarLenEntryQueueBase Class Reference

Overview

Helper class that reduces code size by providing type-erased static methods for the functionality of the templated GenericVarLenEntryQueue types.

Inheritance diagram for pw::containers::internal::GenericVarLenEntryQueueBase:
pw::containers::internal::GenericVarLenEntryQueue< BasicInlineVarLenEntryQueue< T, containers::internal::kGenericSized >, T > pw::containers::internal::GenericVarLenEntryQueue< Derived, T > pw::BasicInlineVarLenEntryQueue< T, containers::internal::kGenericSized >

Classes

struct  Info
 

Static Protected Member Functions

static constexpr Info GetInfo (ConstByteSpan bytes, size_t head, size_t tail)
 
static constexpr size_t AvailableBytes (ConstByteSpan bytes, size_t head, size_t tail)
 Returns the number of bytes not being used to store entries.
 
static constexpr bool Push (ConstByteSpan data, bool overwrite, ByteSpan bytes, size_t &head, size_t &tail)
 Add an entry to the tail of the queue.
 
static constexpr size_t PopNonEmpty (ConstByteSpan bytes, size_t &head)
 Removes an entry from the head of the queue. Must not be empty.
 
static constexpr void CopyEntries (ConstByteSpan src_bytes, size_t &src_head, size_t src_tail, ByteSpan dst_bytes, size_t &dst_head, size_t &dst_tail, bool overwrite)
 
static constexpr void CopyAndWrap (ConstByteSpan data, ByteSpan bytes, size_t &tail)
 Copies data to the buffer, wrapping around the end if needed.
 
static constexpr std::pair< ConstByteSpan, ConstByteSpan > ContiguousRawStorage (ConstByteSpan bytes, size_t head, size_t tail)
 
static void Dering (ByteSpan bytes, size_t head)
 Moves entries to be contiguous and start from the beginning of the buffer.
 

Friends

template<typename D1 , typename T1 , typename D2 , typename T2 >
constexpr void CopyVarLenEntriesImpl (const GenericVarLenEntryQueue< D1, T1 > &src, GenericVarLenEntryQueue< D2, T2 > &dst, bool overwrite)
 
template<typename D1 , typename T1 , typename D2 , typename T2 >
constexpr void MoveVarLenEntriesImpl (GenericVarLenEntryQueue< D1, T1 > &src, GenericVarLenEntryQueue< D2, T2 > &dst, bool overwrite)
 

Member Function Documentation

◆ ContiguousRawStorage()

constexpr std::pair< ConstByteSpan, ConstByteSpan > pw::containers::internal::GenericVarLenEntryQueueBase::ContiguousRawStorage ( ConstByteSpan  bytes,
size_t  head,
size_t  tail 
)
staticconstexprprotected

Returns views of the contiguous raw storage backing this queue. If empty, both returned spans will be empty. If the data does not wrap, only the first returned span will be non-empty. If the data wraps around, both contiguous regions will be returned, from the head to the tail.

◆ CopyEntries()

constexpr void pw::containers::internal::GenericVarLenEntryQueueBase::CopyEntries ( ConstByteSpan  src_bytes,
size_t &  src_head,
size_t  src_tail,
ByteSpan  dst_bytes,
size_t &  dst_head,
size_t &  dst_tail,
bool  overwrite 
)
staticconstexprprotected

Copies entries from another queue to this one.

This will discard existing entries as needed to make room if allowed to overwrite.

◆ GetInfo()

constexpr GenericVarLenEntryQueueBase::Info pw::containers::internal::GenericVarLenEntryQueueBase::GetInfo ( ConstByteSpan  bytes,
size_t  head,
size_t  tail 
)
staticconstexprprotected

Returns the number, total data, and total size of the variable-length entries in the buffer. This is at most O(n) in the number of entries in the queue.


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