rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp > Class Template Reference
[Streams]

Implements a buffer that can be used with any kind of output stream. More...

#include <rw/stream/RWTOutputStreamBufferImp.h>

List of all members.

Public Types

typedef OutputStream RWOutputStream_type
typedef OutputStream::element_type element_type

Public Member Functions

virtual ~RWTOutputStreamBufferImp ()
virtual void write (element_type value)
virtual void write (const element_type *array, RWSize numElements)
virtual void close ()
virtual void flush ()

Static Public Member Functions

static OutputStream make (const OutputStream &sinkStream)
static OutputStream make (const OutputStream &sinkStream, RWSize bufSize)
static OutputStream make (const OutputStream &sinkStream, element_type *buffer, RWSize bufSize)

Protected Member Functions

 RWTOutputStreamBufferImp (const OutputStream &sinkStream)
 RWTOutputStreamBufferImp (const OutputStream &sinkStream, RWSize bufSize)
 RWTOutputStreamBufferImp (const OutputStream &sinkStream, element_type *buffer, RWSize bufSize)
element_typepbase () const
element_typepptr () const
element_typeepptr () const
void setp (element_type *pbeg_arg, element_type *pend_arg)
void pbump (RWSize n)
void freeBuffer ()

Detailed Description

template<class OutputStream, class FilteredOutputStreamImp>
class RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >

The class RWTOutputStreamBufferImp implements a buffer that can be used with any kind of output stream. The size of the buffer is specified in its static member make() function, which is used to create it. The buffer's role is to store elements up to its maximum capacity, and then to forward them to its associated sink stream. The buffer flushes itself upon destruction.


Member Typedef Documentation

template<class OutputStream , class FilteredOutputStreamImp >
typedef OutputStream::element_type RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::element_type

A typedef for the type of element to be written to RWOutputStream_type.

template<class OutputStream , class FilteredOutputStreamImp >
typedef OutputStream RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::RWOutputStream_type

A typedef for the template parameter OutputStream which will be used as the sink for elements.


Constructor & Destructor Documentation

template<class OutputStream , class FilteredOutputStreamImp >
virtual RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::~RWTOutputStreamBufferImp (  )  [virtual]

Destructor.

template<class OutputStream , class FilteredOutputStreamImp >
RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::RWTOutputStreamBufferImp ( const OutputStream &  sinkStream  )  [protected]

Initializes the reference to the output stream that will be used as the sink of elements, as well as the internal buffer capacity, which will be equal to RW_STREAM_BUFFER_SIZE.

Parameters:
sinkStream The output stream that will serve as the sink of elements.
template<class OutputStream , class FilteredOutputStreamImp >
RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::RWTOutputStreamBufferImp ( const OutputStream &  sinkStream,
RWSize  bufSize 
) [protected]

Initializes the reference to the output stream that will be used as the sink of elements, as well as the buffer capacity.

Parameters:
sinkStream The output stream that will serve as the sink of elements.
bufSize The buffer capacity in number of elements.
template<class OutputStream , class FilteredOutputStreamImp >
RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::RWTOutputStreamBufferImp ( const OutputStream &  sinkStream,
element_type buffer,
RWSize  bufSize 
) [protected]

Initializes the reference to the output stream that will be used as the sink of elements, as well as the internal buffer.

Parameters:
sinkStream The output stream that will serve as the sink of elements.
buffer A pre-allocated buffer of size bufSize to be i used internally by the constructed RWTOutputStreamBufferImp object.
bufSize The buffer capacity in number of elements.

Member Function Documentation

template<class OutputStream , class FilteredOutputStreamImp >
virtual void RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::close (  )  [virtual]

Calls flush(), then calls close() on the next processing stream.

template<class OutputStream , class FilteredOutputStreamImp >
element_type* RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::epptr (  )  const [inline, protected]

Returns a pointer one position past the buffer's last element. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp >
virtual void RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::flush (  )  [virtual]

Flushes the buffer by forwarding its content to the next processing stream.

template<class OutputStream , class FilteredOutputStreamImp >
void RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::freeBuffer (  )  [protected]

Frees the memory associated with the internal buffer if necessary. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp >
static OutputStream RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::make ( const OutputStream &  sinkStream,
element_type buffer,
RWSize  bufSize 
) [inline, static]

Constructs an RWTOutputStreamBufferImp instance that uses sinkStream as its sink of elements, and returns a handle to it. The internal buffer is initialized using the pre-allocated element's array of size bufSize.

Parameters:
sinkStream The output stream that will serve as the sink of elements.
buffer A pre-allocated buffer of size bufSize to be used internally by the constructed RWTOutputStreamBufferImp object.
bufSize The buffer capacity in number of elements.
template<class OutputStream , class FilteredOutputStreamImp >
static OutputStream RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::make ( const OutputStream &  sinkStream,
RWSize  bufSize 
) [inline, static]

Constructs an RWTOutputStreamBufferImp instance that uses sinkStream as its sink of elements, and returns a handle to it. The internal buffer is dynamically allocated to be of size bufSize.

Parameters:
sinkStream The output stream that will serve as the sink of elements.
bufSize The buffer capacity in number of elements.
template<class OutputStream , class FilteredOutputStreamImp >
static OutputStream RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::make ( const OutputStream &  sinkStream  )  [inline, static]

Constructs an RWTOutputStreamBufferImp instance that uses sinkStream as its sink of elements, and returns a handle to it. The internal buffer is dynamically allocated to be of size RW_STREAM_BUFFER_SIZE.

Parameters:
sinkStream The output stream that will serve as the sink of elements.
template<class OutputStream , class FilteredOutputStreamImp >
element_type* RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::pbase (  )  const [inline, protected]

Returns a pointer to the buffer's first element. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp >
void RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::pbump ( RWSize  n  )  [inline, protected]

Moves the current put pointer n position forward. Throws no exceptions.

Parameters:
n The number of elements the current put pointer should be advanced.
template<class OutputStream , class FilteredOutputStreamImp >
element_type* RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::pptr (  )  const [inline, protected]

Returns a pointer to the buffer's current position. Throws no exceptions.

template<class OutputStream , class FilteredOutputStreamImp >
void RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::setp ( element_type pbeg_arg,
element_type pend_arg 
) [inline, protected]

Sets the buffer's pointers. Throws no exceptions.

Parameters:
pbeg_arg The value to be set in pbeg_ and pnext_.
pend_arg The value to be set in pend_.
template<class OutputStream , class FilteredOutputStreamImp >
virtual void RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::write ( const element_type array,
RWSize  numElements 
) [virtual]

Writes an array of elements to the stream.

Parameters:
array A pointer to the first element of the array.
numElements The number of elements to be written to the stream.
template<class OutputStream , class FilteredOutputStreamImp >
virtual void RWTOutputStreamBufferImp< OutputStream, FilteredOutputStreamImp >::write ( element_type  value  )  [virtual]

Writes a single element to the stream.

Parameters:
value The element to be written to the stream.
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.