C/C++ API Reference
Loading...
Searching...
No Matches
pw::containers::internal::VarLenEntry< T > Class Template Reference

Overview

template<typename T>
class pw::containers::internal::VarLenEntry< T >

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

Public Types

using element_type = T
 
using value_type = std::remove_cv_t< T >
 
using size_type = uint32_t
 
using pointer = T *
 
using const_pointer = const T *
 
using reference = T &
 
using const_reference = const T &
 
using iterator = VarLenEntryIterator< T >
 
using const_iterator = VarLenEntryIterator< const T >
 

Public Member Functions

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

Friends

class VarLenEntryC
 
template<typename >
class VarLenEntryQueueIterator
 
constexpr bool operator== (const VarLenEntry &lhs, const VarLenEntry &rhs)
 
constexpr bool operator!= (const VarLenEntry &lhs, const VarLenEntry &rhs)
 

Member Typedef Documentation

◆ iterator

template<typename T >
using pw::containers::internal::VarLenEntry< T >::iterator = VarLenEntryIterator<T>

Iterator for the bytes in an Entry. Entries may be discontiguous, so a pointer cannot serve as an iterator.

Member Function Documentation

◆ at()

template<typename T >
constexpr T & pw::containers::internal::VarLenEntry< T >::at ( size_t  index) const
constexpr

Returns a reference to the byte at the specified index.

Parameters
indexThe index of the byte to return.

◆ contiguous_data()

template<typename T >
constexpr std::pair< span< T >, span< T > > pw::containers::internal::VarLenEntry< T >::contiguous_data ( ) const
inlineconstexpr

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

◆ copy()

template<typename T >
constexpr size_t pw::containers::internal::VarLenEntry< T >::copy ( value_type *  dest,
size_t  count 
) const
constexpr

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

Truncates the data if the buffer is smaller than the dest buffer. Returns the size of the entry; if this is larger than dest.size(), the data was truncated.

Parameters
destBuffer into which to copy the serialized entry
countLength of the buffer, in bytes.

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