Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cQueueBytes Class Reference

#include <cQueue.h>

Inheritance diagram for Gray::cQueueBytes:
Gray::cQueueDyn< BYTE > Gray::cQueueRW< TYPE > Gray::cQueueRead< BYTE > Gray::cQueueBase Gray::cStreamQueue Gray::cStreamStackInp Gray::cStreamStackOut GrayLib::cThreadQueue Gray::cStreamTextReader GrayCodec::cAudioAACDec GrayCodec::cAudioMP3Dec GrayCodec::cAudioOpusDec GrayLib::cAudioADPCMDec GrayLib::cStreamBZ2Decompress GrayLib::cStreamCipherDec GrayLib::cStreamZLibDecompress Gray::cStreamStackPackets GrayCodec::cAudioAACEnc GrayCodec::cAudioMP3Enc GrayCodec::cAudioOpusEnc GrayLib::cAudioADPCMEnc GrayLib::cStreamBZ2Compress GrayLib::cStreamCipherEnc GrayLib::cStreamZLibCompress

Public Member Functions

 cQueueBytes (size_t nGrowSizeChunk=8 *1024, size_t nGrowSizeMax=cHeap::k_ALLOC_MAX) noexcept
 
 ~cQueueBytes ()
 
bool InsertDataHead (const BYTE *pDataSrc, size_t iLen)
 
bool SetAllData (const BYTE *pData, size_t iLen)
 
- Public Member Functions inherited from Gray::cQueueDyn< BYTE >
 cQueueDyn (ITERATE_t nGrowSizeChunk=128, ITERATE_t nGrowSizeMax=(cHeap::k_ALLOC_MAX/sizeof(BYTE))) noexcept
 
 ~cQueueDyn ()
 
void put_GrowSizeChunk (ITERATE_t nGrowSizeChunk) noexcept
 
ITERATE_t get_GrowSizeChunk () const noexcept
 
bool MakeWritePrepared (ITERATE_t iDesiredCount=1)
 
BYTE * GetWritePrepared (ITERATE_t iDesiredCount=1)
 
bool WriteQ (BYTE val)
 
void WriteQ (cQueueRead< BYTE > &queue)
 
HRESULT WriteQty (const BYTE *pVal, ITERATE_t iCount)
 
HRESULT WriteX (const void *pData, size_t nDataSize)
 
- Public Member Functions inherited from Gray::cQueueRW< TYPE >
 cQueueRW () noexcept
 
 cQueueRW (TYPE *pData, ITERATE_t iDataAlloc, ITERATE_t iReadLast, ITERATE_t iWriteLast, ITERATE_t iAutoReadCommit=0)
 
 cQueueRW (const TYPE *pData, ITERATE_t iDataMax)
 
 ~cQueueRW ()
 
void ReadCommitCheck ()
 
ITERATE_t get_AutoReadCommit () const
 
void put_AutoReadCommit (ITERATE_t iAutoReadCommit=8 *1024)
 
void put_ReadIndex (ITERATE_t iReadLo)
 
STREAM_SEEKRET_t SeekQ (STREAM_OFFSET_t iOffset, SEEK_ORIGIN_TYPE eSeekOrigin=SEEK_Set)
 
HRESULT ReadQty (TYPE *pData, ITERATE_t iDataMaxQty)
 
HRESULT ReadX (void *pData, size_t nDataSize)
 
bool isFullQ () const
 
ITERATE_t get_WriteQty () const
 
TYPEget_WritePtr () const
 
HRESULT WriteQty (const TYPE *pData, ITERATE_t iQtyMax)
 
HRESULT WriteX (const void *pData, size_t nDataSize)
 
void AdvanceWrite (ITERATE_t iCount=1)
 
- Public Member Functions inherited from Gray::cQueueRead< BYTE >
 cQueueRead (const BYTE *pData=nullptr, ITERATE_t iReadLast=0, ITERATE_t iWriteLast=0) noexcept
 
 ~cQueueRead ()
 
const BYTE * get_ReadPtr () const
 
void SetQueueRead (const BYTE *pData, ITERATE_t iReadLast=0, ITERATE_t iWriteLast=0)
 
BYTE Read1 (void)
 
HRESULT ReadPeek (BYTE *pData, ITERATE_t iDataMaxQty)
 
HRESULT ReadQty (BYTE *pData, ITERATE_t iDataMaxQty)
 
void ReadCommitNow ()
 
- Public Member Functions inherited from Gray::cQueueBase
 cQueueBase (ITERATE_t iReadLast=0, ITERATE_t iWriteLast=0) noexcept
 
void InitQ (ITERATE_t iReadLast=0, ITERATE_t iWriteLast=0) noexcept
 
bool isEmptyQ () const noexcept
 
void EmptyQ () noexcept
 
ITERATE_t get_ReadIndex () const noexcept
 
ITERATE_t get_WriteIndex () const noexcept
 
ITERATE_t get_ReadQty () const
 
void AdvanceRead (ITERATE_t iCount=1)
 
STREAM_SEEKRET_t SeekQ (STREAM_OFFSET_t iOffset, SEEK_ORIGIN_TYPE eSeekOrigin=SEEK_Set)
 

Additional Inherited Members

- Protected Member Functions inherited from Gray::cQueueDyn< BYTE >
bool AllocSizeMaxQ (ITERATE_t iDataAlloc)
 
- Protected Member Functions inherited from Gray::cQueueRW< TYPE >
void WriteQN (const TYPE *pData, ITERATE_t iQtyMax)
 
- Protected Attributes inherited from Gray::cQueueDyn< BYTE >
ITERATE_t m_nGrowSizeChunk
 number of TYPE elements to grow by in a single re-alloc chunk. 0 = never grow. More...
 
ITERATE_t m_nGrowSizeMax
 Total arbitrary max allowed for m_iDataSizeAlloc. 0 = never grow. More...
 
- Protected Attributes inherited from Gray::cQueueRW< TYPE >
ITERATE_t m_iDataSizeAlloc
 The max qty we can write into m_pData. Maybe NOT exactly same as m_pData true OS allocated size? More...
 
ITERATE_t m_iAutoReadCommit
 Read data is destroyed once read more than this amount. make more room for writing. 0 = don't do this, just fail write if we run out of space. More...
 
- Protected Attributes inherited from Gray::cQueueRead< BYTE >
BYTE * m_pData
 NOT owned/managed block of memory I read from. not freed on destruct. More...
 
- Protected Attributes inherited from Gray::cQueueBase
ITERATE_t m_iReadLast
 old items removed/read from here. More...
 
ITERATE_t m_iWriteLast
 new items added/written here. end of read. More...
 

Detailed Description

a queue that grows the memory allocation as needed. free on destruct.

Constructor & Destructor Documentation

◆ cQueueBytes()

Gray::cQueueBytes::cQueueBytes ( size_t  nGrowSizeChunk = 8 * 1024,
size_t  nGrowSizeMax = cHeap::k_ALLOC_MAX 
)
inlineexplicitnoexcept
  • nGrowSizeMax = 0 = not used. write only ? total size < nGrowSizeMax.

◆ ~cQueueBytes()

Gray::cQueueBytes::~cQueueBytes ( )
inline

Member Function Documentation

◆ InsertDataHead()

bool Gray::cQueueBytes::InsertDataHead ( const BYTE *  pDataSrc,
size_t  iLen 
)
inline

insert data at the head of the queue. first out.

◆ SetAllData()

bool Gray::cQueueBytes::SetAllData ( const BYTE *  pData,
size_t  iLen 
)
inline

Toss any previous data. replace with new data. just set the data in the queue. erase any previous data


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