Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes
Standard_ArrayStreamBuffer Class Reference

Custom buffer object implementing STL interface std::streambuf for streamed reading from allocated memory block. Implements minimal sub-set of methods for passing buffer to std::istream, including seek support. More...

#include <Standard_ArrayStreamBuffer.hxx>

Inheritance diagram for Standard_ArrayStreamBuffer:
Inheritance graph
[legend]

Public Member Functions

 Standard_ArrayStreamBuffer (const char *theBegin, const size_t theSize)
 Main constructor. Passed pointer is stored as is (memory is NOT copied nor released with destructor).
 
 ~Standard_ArrayStreamBuffer () override
 Destructor.
 
virtual void Init (const char *theBegin, const size_t theSize)
 (Re)-initialize the stream. Passed pointer is stored as is (memory is NOT copied nor released with destructor).
 
std::streamsize xsgetn (char *thePtr, std::streamsize theCount) override
 Read a bunch of bytes at once.
 

Protected Member Functions

int_type underflow () override
 Get character on underflow. Virtual function called by other member functions to get the current character in the controlled input sequence without changing the current position.
 
int_type uflow () override
 Get character on underflow and advance position. Virtual function called by other member functions to get the current character in the controlled input sequence and then advance the position indicator to the next character.
 
int_type pbackfail (int_type ch) override
 Put character back in the case of backup underflow. Virtual function called by other member functions to put a character back into the controlled input sequence and decrease the position indicator.
 
std::streamsize showmanyc () override
 Get number of characters available. Virtual function (to be read s-how-many-c) called by other member functions to get an estimate on the number of characters available in the associated input sequence.
 
pos_type seekoff (off_type theOff, std::ios_base::seekdir theWay, std::ios_base::openmode theWhich) override
 Seek to specified position.
 
pos_type seekpos (pos_type thePosition, std::ios_base::openmode theWhich) override
 Change to specified position, according to mode.
 

Protected Attributes

const charmyBegin
 
const charmyEnd
 
const charmyCurrent
 

Detailed Description

Custom buffer object implementing STL interface std::streambuf for streamed reading from allocated memory block. Implements minimal sub-set of methods for passing buffer to std::istream, including seek support.

This class can be used for creating a seekable input stream in cases, when the source data does not satisfies Reader requirements (non-seekable stream, compressed data) or represents an in-memory resource.

The memory itself is NOT managed by this class - it is up to the caller to ensure that passed memory pointer is not released during Standard_ArrayStreamBuffer lifetime.

Usage example:

const char* theBuffer;
const size_t theBufferLength;
std::istream aStream (&aStreamBuffer);
A framework providing advanced tolerance control. It is used to build Shapes. If tolerance control is...
Definition BRep_Builder.hxx:58
static void Read(TopoDS_Shape &Sh, Standard_IStream &S, const BRep_Builder &B, const Message_ProgressRange &theProgress=Message_ProgressRange())
Reads a Shape from in returns it in <Sh>. is used to build the shape.
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142
Custom buffer object implementing STL interface std::streambuf for streamed reading from allocated me...
Definition Standard_ArrayStreamBuffer.hxx:49
Describes a shape which.
Definition TopoDS_Shape.hxx:41

Constructor & Destructor Documentation

◆ Standard_ArrayStreamBuffer()

Standard_ArrayStreamBuffer::Standard_ArrayStreamBuffer ( const char * theBegin,
const size_t theSize )

Main constructor. Passed pointer is stored as is (memory is NOT copied nor released with destructor).

Parameters
theBeginpointer to the beginning of pre-allocated buffer
theSizelength of pre-allocated buffer

◆ ~Standard_ArrayStreamBuffer()

Standard_ArrayStreamBuffer::~Standard_ArrayStreamBuffer ( )
override

Destructor.

Member Function Documentation

◆ Init()

virtual void Standard_ArrayStreamBuffer::Init ( const char * theBegin,
const size_t theSize )
virtual

(Re)-initialize the stream. Passed pointer is stored as is (memory is NOT copied nor released with destructor).

Parameters
theBeginpointer to the beginning of pre-allocated buffer
theSizelength of pre-allocated buffer

◆ pbackfail()

int_type Standard_ArrayStreamBuffer::pbackfail ( int_type ch)
overrideprotected

Put character back in the case of backup underflow. Virtual function called by other member functions to put a character back into the controlled input sequence and decrease the position indicator.

◆ seekoff()

pos_type Standard_ArrayStreamBuffer::seekoff ( off_type theOff,
std::ios_base::seekdir theWay,
std::ios_base::openmode theWhich )
overrideprotected

Seek to specified position.

◆ seekpos()

pos_type Standard_ArrayStreamBuffer::seekpos ( pos_type thePosition,
std::ios_base::openmode theWhich )
overrideprotected

Change to specified position, according to mode.

◆ showmanyc()

std::streamsize Standard_ArrayStreamBuffer::showmanyc ( )
overrideprotected

Get number of characters available. Virtual function (to be read s-how-many-c) called by other member functions to get an estimate on the number of characters available in the associated input sequence.

◆ uflow()

int_type Standard_ArrayStreamBuffer::uflow ( )
overrideprotected

Get character on underflow and advance position. Virtual function called by other member functions to get the current character in the controlled input sequence and then advance the position indicator to the next character.

◆ underflow()

int_type Standard_ArrayStreamBuffer::underflow ( )
overrideprotected

Get character on underflow. Virtual function called by other member functions to get the current character in the controlled input sequence without changing the current position.

◆ xsgetn()

std::streamsize Standard_ArrayStreamBuffer::xsgetn ( char * thePtr,
std::streamsize theCount )
override

Read a bunch of bytes at once.

Field Documentation

◆ myBegin

const char* Standard_ArrayStreamBuffer::myBegin
protected

◆ myCurrent

const char* Standard_ArrayStreamBuffer::myCurrent
protected

◆ myEnd

const char* Standard_ArrayStreamBuffer::myEnd
protected

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