Pigweed
 
Loading...
Searching...
No Matches
pw::BasicInlineVarLenEntryQueue< T, kMaxSizeBytes >::Entry Class Reference

Refers to an entry in-place in the queue. Entries may be discontiguous. More...

#include <inline_var_len_entry_queue.h>

Classes

class  iterator
 

Public Types

using value_type = T
 
using size_type = std::uint32_t
 
using pointer = const T *
 
using const_pointer = pointer
 
using reference = const T &
 
using const_reference = reference
 
using const_iterator = iterator
 

Public Member Functions

constexpr Entry (const Entry &)=default
 
constexpr Entryoperator= (const Entry &)=default
 
const_reference at (size_t index) const
 
const_reference operator[] (size_t index) const
 
const_reference front () const
 
const_reference back () const
 
std::pair< span< const value_type >, span< const value_type > > contiguous_data () const
 
size_type copy (T *dest, size_type count) const
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator end () const
 
const_iterator cend () const
 
bool empty () const
 
size_type size () const
 

Friends

class BasicInlineVarLenEntryQueue
 

Detailed Description

template<typename T, size_t kMaxSizeBytes = containers::internal::kGenericSized>
class pw::BasicInlineVarLenEntryQueue< T, kMaxSizeBytes >::Entry

Refers to an entry in-place in the queue. Entries may be discontiguous.

Member Function Documentation

◆ contiguous_data()

template<typename T , size_t kMaxSizeBytes = containers::internal::kGenericSized>
std::pair< span< const value_type >, span< const value_type > > pw::BasicInlineVarLenEntryQueue< T, kMaxSizeBytes >::Entry::contiguous_data ( ) const
inline

Entries may be stored in up to two segments, so this returns spans refering to both portions of the entry. If the entry is contiguous, the second span is empty.

◆ copy()

template<typename T , size_t kMaxSizeBytes = containers::internal::kGenericSized>
size_type pw::BasicInlineVarLenEntryQueue< T, kMaxSizeBytes >::Entry::copy ( T *  dest,
size_type  count 
) const
inline

Copies the contents of the entry to the provided buffer. The entry may be split into two regions; this serializes it into one buffer.

Parameters
entryThe entry whose contents to copy
destThe buffer into which to copy the serialized entry
countCopy up to this many bytes; must not be larger than the dest buffer, but may be larger than the entry

Copying with copy() is likely more efficient than an iterator-based copy with std::copy(), since copy() uses one or two memcpy calls instead of copying byte-by-byte.


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