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.
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 >
template<class OutputStream , class FilteredOutputStreamImp >
A typedef for the template parameter OutputStream
which will be used as the sink for elements.
Constructor & Destructor Documentation
template<class OutputStream , class FilteredOutputStreamImp >
template<class OutputStream , class FilteredOutputStreamImp >
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 >
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 >
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 >
template<class OutputStream , class FilteredOutputStreamImp >
Returns a pointer one position past the buffer's last element. Throws no exceptions.
template<class OutputStream , class FilteredOutputStreamImp >
Flushes the buffer by forwarding its content to the next processing stream.
template<class OutputStream , class FilteredOutputStreamImp >
Frees the memory associated with the internal buffer if necessary. Throws no exceptions.
template<class OutputStream , class FilteredOutputStreamImp >
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 >
Returns a pointer to the buffer's first element. Throws no exceptions.
template<class OutputStream , class FilteredOutputStreamImp >
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 >
Returns a pointer to the buffer's current position. Throws no exceptions.
template<class OutputStream , class FilteredOutputStreamImp >
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 >
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 >
Writes a single element to the stream.
- Parameters:
-
| value | The element to be written to the stream. |