A queue of variable length entries.
This type use CRTP to allow a derived class to specify access to the backing storage and indicate where the queue head and tail are within it.
Public Types | |
| using | value_type = containers::internal::VarLenEntry< T > |
| using | const_value_type = containers::internal::VarLenEntry< const T > |
| using | iterator = VarLenEntryQueueIterator< T > |
| using | const_iterator = VarLenEntryQueueIterator< const T > |
Public Member Functions | |
| constexpr iterator | begin () |
Returns an iterator to the start of the queue. | |
| constexpr const_iterator | begin () const |
| constexpr const_iterator | cbegin () const |
| constexpr iterator | end () |
Returns an iterator to the end of the queue. | |
| constexpr const_iterator | end () const |
| constexpr const_iterator | cend () const |
| constexpr bool | empty () const |
| Returns true if the queue is empty, false if it has at least one entry. | |
| constexpr size_t | size () const |
| constexpr size_t | max_size () const |
| constexpr size_t | size_bytes () const |
| constexpr size_t | encoded_size_bytes () const |
| constexpr size_t | max_size_bytes () const |
| constexpr value_type | front () |
| constexpr const_value_type | front () const |
| constexpr void | push (span< const T > data) |
| constexpr bool | try_push (span< const T > data) |
| constexpr void | push_overwrite (span< const T > data) |
| constexpr void | pop () |
| constexpr void | clear () |
| Empties the queue. | |
| constexpr std::pair< span< const T >, span< const T > > | contiguous_raw_storage () const |
| span< const T > | dering () |
| Moves entries to be contiguous and start from the beginning of the buffer. | |
Static Public Member Functions | |
| static constexpr size_t | DataSizeBytes (size_t max_size_bytes) |
Protected Member Functions | |
| constexpr size_t | GetHead () const |
| constexpr void | SetHead (size_t head) |
| constexpr size_t | GetTail () const |
| constexpr void | SetTail (size_t tail) |
| constexpr span< T > | GetBuffer () |
| constexpr span< const T > | GetBuffer () const |
GetBytes | |
Returns the buffer as a span of bytes. Only constexpr if T is std::byte. | |
| constexpr ByteSpan | GetBytes () |
| constexpr ConstByteSpan | GetBytes () const |
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) |
|
constexpr |
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.
|
inlinestaticconstexpr |
Returns the minimum number of data bytes needed to hold an entry of max_size_bytes.
| span< const T > pw::containers::internal::GenericVarLenEntryQueue< Derived, T >::dering |
Moves entries to be contiguous and start from the beginning of the buffer.
Returns a view to the contiguous data.
|
inlineconstexpr |
Returns the combined size in bytes of all entries in the queue, including metadata. This is at most O(n) in the number of entries in the queue.
|
constexpr |
Returns the first entry in the queue.
empty() is false).
|
inlineconstexpr |
Returns the maximum number of entries in the queue. This is only attainable if all entries are empty.
|
inlineconstexpr |
Returns the maximum number of bytes that can be stored in the queue. This is largest possible value of size_bytes(), and the size of the largest single entry that can be stored in this queue. Attempting to store a larger entry is invalid and results in a crash.
|
constexpr |
Removes the first entry from queue.
|
inlineconstexpr |
Appends an entry to the end of the queue.
max_size_bytes().
|
inlineconstexpr |
Appends an entry to the end of the queue, removing entries with Pop as necessary to make room. Calling this function drops old entries to make room for new; call try_push() to drop new entries instead.
max_size_bytes().
|
inlineconstexpr |
Returns the number of variable-length entries in the queue. This is at most O(n) in the number of entries in the queue.
|
inlineconstexpr |
Returns the combined size in bytes of all entries in the queue, excluding metadata. This is at most O(n) in the number of entries in the queue.
|
inlineconstexpr |
Appends an entry to the end of the queue, but only if there is sufficient space for it.
max_size_bytes().