Open CASCADE Technology 7.9.0
Standard_ReadBuffer Class Reference

Auxiliary tool for buffered reading from input stream within chunks of constant size. More...

#include <Standard_ReadBuffer.hxx>

Public Member Functions

 Standard_ReadBuffer (int64_t theDataLen, size_t theChunkLen, bool theIsPartialPayload=false)
 Constructor with initialization.
 
void Init (int64_t theDataLen, size_t theChunkLen, bool theIsPartialPayload=false)
 Initialize the buffer.
 
bool IsDone () const
 Return TRUE if amount of read bytes is equal to requested length of entire data.
 
template<typename Chunk_T, typename Stream_T>
Chunk_T * ReadChunk (Stream_T &theStream)
 Read next chunk.
 
template<typename Stream_T>
char * ReadDataChunk (Stream_T &theStream)
 Read next chunk.
 

Detailed Description

Auxiliary tool for buffered reading from input stream within chunks of constant size.

Constructor & Destructor Documentation

◆ Standard_ReadBuffer()

Standard_ReadBuffer::Standard_ReadBuffer ( int64_t theDataLen,
size_t theChunkLen,
bool theIsPartialPayload = false )
inline

Constructor with initialization.

Member Function Documentation

◆ Init()

void Standard_ReadBuffer::Init ( int64_t theDataLen,
size_t theChunkLen,
bool theIsPartialPayload = false )
inline

Initialize the buffer.

Parameters
[in]theDataLenthe full length of input data to read from stream.
[in]theChunkLenthe length of single chunk to read
[in]theIsPartialPayloadwhen FALSE, theDataLen will be automatically aligned to the multiple of theChunkLen; when TRUE, last chunk will be read from stream exactly till theDataLen allowing portion of chunk to be uninitialized (useful for interleaved data)

◆ IsDone()

bool Standard_ReadBuffer::IsDone ( ) const
inline

Return TRUE if amount of read bytes is equal to requested length of entire data.

◆ ReadChunk()

template<typename Chunk_T, typename Stream_T>
Chunk_T * Standard_ReadBuffer::ReadChunk ( Stream_T & theStream)
inline

Read next chunk.

Returns
pointer to the chunk or NULL on error / end of reading buffer

◆ ReadDataChunk()

template<typename Stream_T>
char * Standard_ReadBuffer::ReadDataChunk ( Stream_T & theStream)
inline

Read next chunk.

Returns
pointer to the chunk or NULL on error / end of reading buffer

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