AGX Dynamics 2.42.2.1
Loading...
Searching...
No Matches
agxData::ByteStream Class Reference

Utility class for parsing/writing a byte stream. More...

#include <ByteStream.h>

Public Member Functions

 ByteStream ()
 
 ByteStream (BytePtr begin, BytePtr end)
 
 ByteStream (BytePtr begin, BytePtr end, BytePtr head)
 
BytePtrbegin ()
 
const BytePtrbegin () const
 
template<typename T >
void consume (const T &value)
 Consume an expected value from the stream.
 
BytePtrend ()
 
const BytePtrend () const
 
size_t getCurrentOffset () const
 
BytePtrhead ()
 
const BytePtrhead () const
 
ByteStream operator+ (size_t offset) const
 
ByteStreamoperator+= (size_t offset)
 
BytePtr popBytes (size_t numBytes)
 
template<typename T >
popElement ()
 
void read (Byte *buffer, size_t numBytes)
 Read a buffer.
 
void read (char *buffer, size_t numBytes)
 
size_t size () const
 
template<typename T >
topElement () const
 
void write (const Byte *buffer, size_t numBytes)
 Write a buffer.
 
void write (const char *buffer, size_t numBytes)
 
template<typename T >
void write (const T &value)
 Write a value to the head of the stream and advance the head.
 

Detailed Description

Utility class for parsing/writing a byte stream.

Definition at line 27 of file ByteStream.h.

Constructor & Destructor Documentation

◆ ByteStream() [1/3]

agxData::ByteStream::ByteStream ( )

Definition at line 117 of file ByteStream.h.

Referenced by operator+().

◆ ByteStream() [2/3]

agxData::ByteStream::ByteStream ( BytePtr  begin,
BytePtr  end 
)

Definition at line 121 of file ByteStream.h.

◆ ByteStream() [3/3]

agxData::ByteStream::ByteStream ( BytePtr  begin,
BytePtr  end,
BytePtr  head 
)

Definition at line 125 of file ByteStream.h.

References agxAssert, begin(), end(), and head().

Member Function Documentation

◆ begin() [1/2]

BytePtr & agxData::ByteStream::begin ( )
Returns
The stream buffer start address.

Definition at line 131 of file ByteStream.h.

Referenced by ByteStream().

◆ begin() [2/2]

const BytePtr & agxData::ByteStream::begin ( ) const

Definition at line 132 of file ByteStream.h.

◆ consume()

template<typename T >
void agxData::ByteStream::consume ( const T &  value)

Consume an expected value from the stream.

Definition at line 162 of file ByteStream.h.

References agxVerify.

◆ end() [1/2]

BytePtr & agxData::ByteStream::end ( )
Returns
The stream buffer end address.

Definition at line 134 of file ByteStream.h.

Referenced by ByteStream().

◆ end() [2/2]

const BytePtr & agxData::ByteStream::end ( ) const

Definition at line 135 of file ByteStream.h.

◆ getCurrentOffset()

size_t agxData::ByteStream::getCurrentOffset ( ) const
Returns
The current offset of the head in bytes

Definition at line 141 of file ByteStream.h.

◆ head() [1/2]

BytePtr & agxData::ByteStream::head ( )
Returns
The current stream position.

Definition at line 137 of file ByteStream.h.

Referenced by ByteStream().

◆ head() [2/2]

const BytePtr & agxData::ByteStream::head ( ) const

Definition at line 138 of file ByteStream.h.

◆ operator+()

ByteStream agxData::ByteStream::operator+ ( size_t  offset) const

Definition at line 211 of file ByteStream.h.

References ByteStream().

◆ operator+=()

ByteStream & agxData::ByteStream::operator+= ( size_t  offset)

Definition at line 212 of file ByteStream.h.

◆ popBytes()

BytePtr agxData::ByteStream::popBytes ( size_t  numBytes)
Returns
The stream head and advance the stream the requested number of bytes.

Definition at line 176 of file ByteStream.h.

References agxVerify.

◆ popElement()

template<typename T >
T agxData::ByteStream::popElement
Returns
The front element and advance the stream head.

Definition at line 153 of file ByteStream.h.

◆ read() [1/2]

void agxData::ByteStream::read ( Byte buffer,
size_t  numBytes 
)

Read a buffer.

Definition at line 197 of file ByteStream.h.

References agxVerify.

Referenced by read().

◆ read() [2/2]

void agxData::ByteStream::read ( char *  buffer,
size_t  numBytes 
)

Definition at line 204 of file ByteStream.h.

References read().

◆ size()

size_t agxData::ByteStream::size ( ) const
Returns
The size of the stream (in bytes)

Definition at line 140 of file ByteStream.h.

◆ topElement()

template<typename T >
T agxData::ByteStream::topElement
inline
Returns
The front element.

Definition at line 144 of file ByteStream.h.

References agxVerify.

◆ write() [1/3]

void agxData::ByteStream::write ( const Byte buffer,
size_t  numBytes 
)

Write a buffer.

Definition at line 185 of file ByteStream.h.

References agxVerify.

◆ write() [2/3]

void agxData::ByteStream::write ( const char *  buffer,
size_t  numBytes 
)

Definition at line 192 of file ByteStream.h.

References write().

◆ write() [3/3]

template<typename T >
void agxData::ByteStream::write ( const T &  value)

Write a value to the head of the stream and advance the head.

Definition at line 169 of file ByteStream.h.

References agxVerify.

Referenced by write().


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