Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::ByteBuffer Class Referencefinal

An auto-resizable byte storage. More...

#include <ByteBuffer.h>

Public Member Functions

 ByteBuffer ()
 
 ByteBuffer (std::size_t numExpectedWrittenBytes)
 
template<typename T >
read ()
 
template<typename T >
void read (T *out_data, std::size_t numElements)
 
template<typename T >
void write (const T &data)
 Writes data to the buffer. Grows the buffer if no space left.
 
template<typename T >
void write (const T *data, std::size_t numElements)
 Writes data to the buffer. Grows the buffer if no space left.
 
void rewindRead ()
 
void rewindWrite ()
 
void clear ()
 Clear all data and reset reader and writer positions.
 
void fill (std::byte filledByte)
 
void truncate ()
 
void fit ()
 
void setReadPosition (std::size_t indexOfByte)
 
void setWritePosition (std::size_t indexOfByte)
 
void setNumBytes (std::size_t numBytes)
 
std::size_t getReadPosition () const
 
std::size_t getWritePosition () const
 
std::size_t numBytes () const
 
bool isEmpty () const
 
bool hasMoreToRead () const
 
TSpan< std::byte > getBytes ()
 Direct access to all the bytes in the buffer.
 
TSpanView< std::byte > getBytes () const
 

Detailed Description

An auto-resizable byte storage.

Constructor & Destructor Documentation

◆ ByteBuffer() [1/2]

ph::ByteBuffer::ByteBuffer ( )
inline

◆ ByteBuffer() [2/2]

ph::ByteBuffer::ByteBuffer ( std::size_t numExpectedWrittenBytes)
inlineexplicit

Member Function Documentation

◆ clear()

void ph::ByteBuffer::clear ( )
inline

Clear all data and reset reader and writer positions.

◆ fill()

void ph::ByteBuffer::fill ( std::byte filledByte)
inline

◆ fit()

void ph::ByteBuffer::fit ( )
inline

◆ getBytes() [1/2]

TSpan< std::byte > ph::ByteBuffer::getBytes ( )
inline

Direct access to all the bytes in the buffer.

◆ getBytes() [2/2]

TSpanView< std::byte > ph::ByteBuffer::getBytes ( ) const
inline

◆ getReadPosition()

std::size_t ph::ByteBuffer::getReadPosition ( ) const
inline
Returns
The index that is going to be read next.

◆ getWritePosition()

std::size_t ph::ByteBuffer::getWritePosition ( ) const
inline
Returns
The index that is going to be written next.

◆ hasMoreToRead()

bool ph::ByteBuffer::hasMoreToRead ( ) const
inline

◆ isEmpty()

bool ph::ByteBuffer::isEmpty ( ) const
inline

◆ numBytes()

std::size_t ph::ByteBuffer::numBytes ( ) const
inline

◆ read() [1/2]

template<typename T >
T ph::ByteBuffer::read ( )
inline

◆ read() [2/2]

template<typename T >
void ph::ByteBuffer::read ( T * out_data,
std::size_t numElements )
inline

◆ rewindRead()

void ph::ByteBuffer::rewindRead ( )
inline

◆ rewindWrite()

void ph::ByteBuffer::rewindWrite ( )
inline

◆ setNumBytes()

void ph::ByteBuffer::setNumBytes ( std::size_t numBytes)
inline

◆ setReadPosition()

void ph::ByteBuffer::setReadPosition ( std::size_t indexOfByte)
inline

◆ setWritePosition()

void ph::ByteBuffer::setWritePosition ( std::size_t indexOfByte)
inline

◆ truncate()

void ph::ByteBuffer::truncate ( )
inline

◆ write() [1/2]

template<typename T >
void ph::ByteBuffer::write ( const T & data)
inline

Writes data to the buffer. Grows the buffer if no space left.

◆ write() [2/2]

template<typename T >
void ph::ByteBuffer::write ( const T * data,
std::size_t numElements )
inline

Writes data to the buffer. Grows the buffer if no space left.


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