AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
Loading...
Searching...
No Matches
AudioDataLib::MemoryStream Class Reference

This is a read/write, in-memory stream of bytes that is bounded only by the memory limitations of the operating system. More...

#include <ByteStream.h>

Inheritance diagram for AudioDataLib::MemoryStream:
AudioDataLib::ByteStream

Classes

class  Chunk
 

Public Member Functions

 MemoryStream ()
 
virtual ~MemoryStream ()
 
virtual uint64_t WriteBytesToStream (const uint8_t *buffer, uint64_t bufferSize) override
 
virtual uint64_t ReadBytesFromStream (uint8_t *buffer, uint64_t bufferSize) override
 
virtual uint64_t GetSize () const override
 
virtual bool CanRead () override
 
virtual bool CanWrite () override
 
void Clear ()
 
- Public Member Functions inherited from AudioDataLib::ByteStream
 ByteStream ()
 
virtual ~ByteStream ()
 
virtual uint64_t PeekBytesFromStream (uint8_t *buffer, uint64_t bufferSize)
 
template<typename T >
bool ReadType (T *value)
 
template<typename T >
bool WriteType (const T *value)
 

Protected Attributes

std::list< Chunk * > * chunkList
 
uint64_t chunkSize
 

Detailed Description

This is a read/write, in-memory stream of bytes that is bounded only by the memory limitations of the operating system.

Constructor & Destructor Documentation

◆ MemoryStream()

MemoryStream::MemoryStream ( )

◆ ~MemoryStream()

MemoryStream::~MemoryStream ( )
virtual

Member Function Documentation

◆ CanRead()

bool MemoryStream::CanRead ( )
overridevirtual

Indicate whether there is data available to be read from the stream.

Implements AudioDataLib::ByteStream.

◆ CanWrite()

bool MemoryStream::CanWrite ( )
overridevirtual

Indicate whether it is possible to write additional data to the stream.

Implements AudioDataLib::ByteStream.

◆ Clear()

void MemoryStream::Clear ( )

◆ GetSize()

uint64_t MemoryStream::GetSize ( ) const
overridevirtual

Return the amount of data (in bytes) currently stored in the stream.

Implements AudioDataLib::ByteStream.

◆ ReadBytesFromStream()

uint64_t MemoryStream::ReadBytesFromStream ( uint8_t * buffer,
uint64_t bufferSize )
overridevirtual

Read from this stream into the given buffer.

Parameters
[out]bufferThis is a pointer to an array where bytes read from the stream will be written.
[in]bufferSizeThis is the size in bytes of the given array.
Returns
The number of bytes actually read from the stream and written to the given buffer is returned.

Implements AudioDataLib::ByteStream.

◆ WriteBytesToStream()

uint64_t MemoryStream::WriteBytesToStream ( const uint8_t * buffer,
uint64_t bufferSize )
overridevirtual

Write the given buffer to this stream.

Parameters
[in]bufferThis is a pointer to the array of bytes to write to the stream.
[in]bufferSizeThis is the size of the given array in bytes.
Returns
The number of bytes actually written to the stream is returned.

Implements AudioDataLib::ByteStream.

Member Data Documentation

◆ chunkList

std::list<Chunk*>* AudioDataLib::MemoryStream::chunkList
protected

◆ chunkSize

uint64_t AudioDataLib::MemoryStream::chunkSize
protected

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