Sunshine master
Self-hosted game stream host for Moonlight.
util::buffer_t< T > Class Template Reference

Owning contiguous buffer with an explicit logical element count. More...

#include <src/utility.h>

Public Member Functions

T * begin ()
 Return an iterator to the first byte in the buffer view.
 
const T * begin () const
 Return an iterator to the first byte in the buffer view.
 
 buffer_t (buffer_t &&o) noexcept
 Construct an owning contiguous buffer.
 
 buffer_t (const buffer_t &o)
 Construct an owning contiguous buffer.
 
 buffer_t (size_t elements)
 Construct an owning contiguous buffer.
 
 buffer_t (size_t elements, const T &t)
 Construct an owning contiguous buffer.
 
T * end ()
 Return an iterator one past the final byte in the buffer view.
 
const T * end () const
 Return an iterator one past the final byte in the buffer view.
 
void fake_resize (std::size_t els)
 Update the logical element count without reallocating storage.
 
buffer_toperator= (buffer_t &&o) noexcept
 Assign state from another instance while preserving ownership semantics.
 
T & operator[] (size_t el)
 Access an element in the owning buffer.
 
const T & operator[] (size_t el) const
 Access an element in the owning buffer.
 
size_t size () const
 Return the serialized size of the current object.
 

Detailed Description

template<class T>
class util::buffer_t< T >

Owning contiguous buffer with an explicit logical element count.

Constructor & Destructor Documentation

◆ buffer_t() [1/4]

template<class T >
util::buffer_t< T >::buffer_t ( buffer_t< T > && o)
inlinenoexcept

Construct an owning contiguous buffer.

Parameters
oSource object used for comparison or assignment.

◆ buffer_t() [2/4]

template<class T >
util::buffer_t< T >::buffer_t ( const buffer_t< T > & o)
inline

Construct an owning contiguous buffer.

Parameters
oSource object used for comparison or assignment.

◆ buffer_t() [3/4]

template<class T >
util::buffer_t< T >::buffer_t ( size_t elements)
inlineexplicit

Construct an owning contiguous buffer.

Parameters
elementsElements copied into the buffer.

◆ buffer_t() [4/4]

template<class T >
util::buffer_t< T >::buffer_t ( size_t elements,
const T & t )
inlineexplicit

Construct an owning contiguous buffer.

Parameters
elementsElements copied into the buffer.
tInitial value used to populate the GPU buffer.

Member Function Documentation

◆ begin() [1/2]

template<class T >
T * util::buffer_t< T >::begin ( )
inline

Return an iterator to the first byte in the buffer view.

Returns
Iterator to the first element.

◆ begin() [2/2]

template<class T >
const T * util::buffer_t< T >::begin ( ) const
inline

Return an iterator to the first byte in the buffer view.

Returns
Iterator to the first element.

◆ end() [1/2]

template<class T >
T * util::buffer_t< T >::end ( )
inline

Return an iterator one past the final byte in the buffer view.

Returns
Iterator one past the last element.

◆ end() [2/2]

template<class T >
const T * util::buffer_t< T >::end ( ) const
inline

Return an iterator one past the final byte in the buffer view.

Returns
Iterator one past the last element.

◆ fake_resize()

template<class T >
void util::buffer_t< T >::fake_resize ( std::size_t els)
inline

Update the logical element count without reallocating storage.

Parameters
elsElements used to initialize the buffer.

◆ operator=()

template<class T >
buffer_t & util::buffer_t< T >::operator= ( buffer_t< T > && o)
inlinenoexcept

Assign state from another instance while preserving ownership semantics.

Parameters
oSource object used for comparison or assignment.
Returns
Reference returned by the operator overload.

◆ operator[]() [1/2]

template<class T >
T & util::buffer_t< T >::operator[] ( size_t el)
inline

Access an element in the owning buffer.

Parameters
elZero-based element index.
Returns
Mutable reference to the requested element.

◆ operator[]() [2/2]

template<class T >
const T & util::buffer_t< T >::operator[] ( size_t el) const
inline

Access an element in the owning buffer.

Parameters
elZero-based element index.
Returns
Const reference to the requested element.

◆ size()

template<class T >
size_t util::buffer_t< T >::size ( ) const
inline

Return the serialized size of the current object.

Returns
Number of elements currently stored.

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