Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cQueueRead< TYPE > Class Template Reference

#include <cQueue.h>

Inheritance diagram for Gray::cQueueRead< TYPE >:
Gray::cQueueBase Gray::cQueueRW< BYTE > Gray::cQueueDyn< TYPE > Gray::cStreamStatic Gray::cStreamStringA

Public Member Functions

 cQueueRead (const TYPE *pData=nullptr, ITERATE_t iReadLast=0, ITERATE_t iWriteLast=0) noexcept
 
 ~cQueueRead ()
 
const TYPEget_ReadPtr () const
 
void SetQueueRead (const TYPE *pData, ITERATE_t iReadLast=0, ITERATE_t iWriteLast=0)
 
TYPE Read1 (void)
 
HRESULT ReadPeek (TYPE *pData, ITERATE_t iDataMaxQty)
 
HRESULT ReadQty (TYPE *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)
 

Protected Attributes

TYPEm_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

template<class TYPE = BYTE>
class Gray::cQueueRead< TYPE >

a simple read only queue. un-managed memory

Constructor & Destructor Documentation

◆ cQueueRead()

template<class TYPE = BYTE>
Gray::cQueueRead< TYPE >::cQueueRead ( const TYPE pData = nullptr,
ITERATE_t  iReadLast = 0,
ITERATE_t  iWriteLast = 0 
)
inlinenoexcept

◆ ~cQueueRead()

template<class TYPE = BYTE>
Gray::cQueueRead< TYPE >::~cQueueRead ( )
inline

Member Function Documentation

◆ get_ReadPtr()

template<class TYPE = BYTE>
const TYPE* Gray::cQueueRead< TYPE >::get_ReadPtr ( ) const
inline

get start of data i could read directly. contiguous isEmptyQ() is OK, might be 0 length.

◆ Read1()

template<class TYPE = BYTE>
TYPE Gray::cQueueRead< TYPE >::Read1 ( void  )
inline

get a single TYPE element.

◆ ReadCommitNow()

template<class TYPE = BYTE>
void Gray::cQueueRead< TYPE >::ReadCommitNow ( )
inline

Prepare to read. move (read) data down to not waste space. allow more space for writing. commit the read = can't get the data back. Seek will fail.

Note
beware of the rollback that protocols like to do if they get a bad request or non atomic transactions. can't Seek() back after this. pointers into this are now bad!

◆ ReadPeek()

template<class TYPE = BYTE>
HRESULT Gray::cQueueRead< TYPE >::ReadPeek ( TYPE pData,
ITERATE_t  iDataMaxQty 
)
inline
  • iDataMaxQty = max qty of TYPE units i can fit in pData.
  • pData = nullptr = just return how much data i might get.
    Returns
    quantity i actually read.
    copy data out.

◆ ReadQty()

template<class TYPE = BYTE>
HRESULT Gray::cQueueRead< TYPE >::ReadQty ( TYPE pData,
ITERATE_t  iDataMaxQty 
)
inline

Just read a block. like ReadX but for TYPE

  • iDataMaxQty = max qty of TYPE units i can fit in pData.
    Returns
    iQty i actually read.
    copy data out.

◆ SetQueueRead()

template<class TYPE = BYTE>
void Gray::cQueueRead< TYPE >::SetQueueRead ( const TYPE pData,
ITERATE_t  iReadLast = 0,
ITERATE_t  iWriteLast = 0 
)
inline

Member Data Documentation

◆ m_pData

template<class TYPE = BYTE>
TYPE* Gray::cQueueRead< TYPE >::m_pData
protected

NOT owned/managed block of memory I read from. not freed on destruct.


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