blocxx
BLOCXX_NAMESPACE::BaseStreamBuffer Class Reference

#include <BaseStreamBuffer.hpp>

Inheritance diagram for BLOCXX_NAMESPACE::BaseStreamBuffer:
BLOCXX_NAMESPACE::FileBuf BLOCXX_NAMESPACE::IOIFCStreamBuffer BLOCXX_NAMESPACE::OStringStreamBuf BLOCXX_NAMESPACE::IFileStream BLOCXX_NAMESPACE::SocketStreamBuffer

Public Types

enum  EDirectionFlag { E_IN , E_OUT , E_IN_OUT }
 

Public Member Functions

 BaseStreamBuffer (EDirectionFlag direction, size_t bufSize=BASE_BUF_SIZE)
 Create a base stream buffer.
 
 ~BaseStreamBuffer ()
 

Protected Member Functions

int underflow ()
 
std::streamsize xsputn (const char *s, std::streamsize n)
 
virtual int overflow (int c)
 
virtual int sync ()
 
virtual void initBuffers ()
 
virtual void initGetBuffer ()
 
virtual void initPutBuffer ()
 
virtual int buffer_to_device (const char *c, int n)
 Writes the buffer to the "device".
 
virtual int buffer_from_device (char *c, int n)
 Fill the buffer from the "device".
 

Private Member Functions

int buffer_in ()
 
int buffer_out ()
 
 BaseStreamBuffer (const BaseStreamBuffer &arg)
 
BaseStreamBufferoperator= (const BaseStreamBuffer &arg)
 

Private Attributes

std::streamsize m_bufSize
 
char * m_inputBuffer
 
char * m_outputBuffer
 

Detailed Description

Definition at line 57 of file BaseStreamBuffer.hpp.

Member Enumeration Documentation

◆ EDirectionFlag

Enumerator
E_IN 
E_OUT 
E_IN_OUT 

Definition at line 60 of file BaseStreamBuffer.hpp.

Constructor & Destructor Documentation

◆ BaseStreamBuffer() [1/2]

BLOCXX_NAMESPACE::BaseStreamBuffer::BaseStreamBuffer ( EDirectionFlag direction,
size_t bufSize = BASE_BUF_SIZE )

◆ ~BaseStreamBuffer()

BLOCXX_NAMESPACE::BaseStreamBuffer::~BaseStreamBuffer ( )

Definition at line 85 of file BaseStreamBuffer.cpp.

References m_inputBuffer, and m_outputBuffer.

◆ BaseStreamBuffer() [2/2]

BLOCXX_NAMESPACE::BaseStreamBuffer::BaseStreamBuffer ( const BaseStreamBuffer & arg)
private

References BaseStreamBuffer().

Member Function Documentation

◆ buffer_from_device()

int BLOCXX_NAMESPACE::BaseStreamBuffer::buffer_from_device ( char * c,
int n )
protectedvirtual

Fill the buffer from the "device".

Parameters
cA pointer to the beginning of the buffer
nThe number of bytes to be read into the buffer.
Returns
-1 if no bytes are able to be read from the "device" (for instance, end of input stream). Otherwise, return the number of bytes read into the buffer.
Exceptions
IOExceptionon failure.

Reimplemented in BLOCXX_NAMESPACE::FileBuf, and BLOCXX_NAMESPACE::IOIFCStreamBuffer.

Definition at line 190 of file BaseStreamBuffer.cpp.

References BLOCXX_ASSERT.

Referenced by buffer_in().

◆ buffer_in()

int BLOCXX_NAMESPACE::BaseStreamBuffer::buffer_in ( )
private

Definition at line 166 of file BaseStreamBuffer.cpp.

References buffer_from_device(), m_bufSize, and m_inputBuffer.

Referenced by underflow().

◆ buffer_out()

int BLOCXX_NAMESPACE::BaseStreamBuffer::buffer_out ( )
private

Definition at line 98 of file BaseStreamBuffer.cpp.

References buffer_to_device(), and m_outputBuffer.

Referenced by overflow(), and sync().

◆ buffer_to_device()

int BLOCXX_NAMESPACE::BaseStreamBuffer::buffer_to_device ( const char * c,
int n )
protectedvirtual

Writes the buffer to the "device".

Parameters
cA pointer to the start of the buffer
nthe number of bytes to write
Returns
-1 if error, 0 if the entire buffer was written.

Reimplemented in BLOCXX_NAMESPACE::FileBuf, BLOCXX_NAMESPACE::IOIFCStreamBuffer, and BLOCXX_NAMESPACE::OStringStreamBuf.

Definition at line 183 of file BaseStreamBuffer.cpp.

References BLOCXX_ASSERT.

Referenced by buffer_out().

◆ initBuffers()

void BLOCXX_NAMESPACE::BaseStreamBuffer::initBuffers ( )
protectedvirtual

Definition at line 67 of file BaseStreamBuffer.cpp.

References initGetBuffer(), and initPutBuffer().

Referenced by BLOCXX_NAMESPACE::IOIFCStreamBuffer::reset().

◆ initGetBuffer()

void BLOCXX_NAMESPACE::BaseStreamBuffer::initGetBuffer ( )
protectedvirtual

Definition at line 80 of file BaseStreamBuffer.cpp.

References m_inputBuffer.

Referenced by BaseStreamBuffer(), and initBuffers().

◆ initPutBuffer()

void BLOCXX_NAMESPACE::BaseStreamBuffer::initPutBuffer ( )
protectedvirtual

Definition at line 74 of file BaseStreamBuffer.cpp.

References m_bufSize, and m_outputBuffer.

Referenced by BaseStreamBuffer(), and initBuffers().

◆ operator=()

BaseStreamBuffer & BLOCXX_NAMESPACE::BaseStreamBuffer::operator= ( const BaseStreamBuffer & arg)
private

References BaseStreamBuffer().

◆ overflow()

int BLOCXX_NAMESPACE::BaseStreamBuffer::overflow ( int c)
protectedvirtual

Definition at line 107 of file BaseStreamBuffer.cpp.

References buffer_out().

◆ sync()

int BLOCXX_NAMESPACE::BaseStreamBuffer::sync ( )
protectedvirtual

◆ underflow()

int BLOCXX_NAMESPACE::BaseStreamBuffer::underflow ( )
protected

Definition at line 149 of file BaseStreamBuffer.cpp.

References buffer_in().

◆ xsputn()

std::streamsize BLOCXX_NAMESPACE::BaseStreamBuffer::xsputn ( const char * s,
std::streamsize n )
protected

Definition at line 127 of file BaseStreamBuffer.cpp.

Member Data Documentation

◆ m_bufSize

std::streamsize BLOCXX_NAMESPACE::BaseStreamBuffer::m_bufSize
private

Definition at line 107 of file BaseStreamBuffer.hpp.

Referenced by BaseStreamBuffer(), buffer_in(), and initPutBuffer().

◆ m_inputBuffer

char* BLOCXX_NAMESPACE::BaseStreamBuffer::m_inputBuffer
private

◆ m_outputBuffer

char* BLOCXX_NAMESPACE::BaseStreamBuffer::m_outputBuffer
private

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