Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

lfc::BufferedInput Class Template Reference

A class which does generalized buffered input. More...

Inheritance diagram for lfc::BufferedInput::

lfc::Object lfc::_InputFilter< TYPE, TYPE > lfc::_Input lfc::_Server List of all members.

Public Methods

 BufferedInput (_Input< TYPE > &rInputBase, long bufferSize=DEFAULT_BUFFER_SIZE)
 ~BufferedInput () throw ()
virtual void setBufferSize (long bufferSize)
 Sets the buffer size. More...

virtual long bufferSize () const throw ()
 
Returns:
the buffer size for this stream in units of TYPE.
More...


virtual long read (TYPE *buffer, long count, bool bWaitAll=true)
 Reads from this stream. More...

virtual bool hasMore () const
 Indicates whether there is more data to read from this stream. More...

virtual TYPE pop ()
 
Returns:
a single object of type TYPE from this stream.
More...


virtual void resetInput ()
 \brief Resets the input. More...


Static Public Attributes

const long DEFAULT_BUFFER_SIZE = 1024L
 the default size of the buffer used by this class. More...


Protected Methods

virtual long readFromBase (long wantCnt, bool bWaitAll)
 A function which actually makes a read() call to the underlying input stream. More...


Protected Attributes

TYPE * m_buffer
 the actual buffer. More...

long m_bufferSize
 its size. More...

long m_bufferPosition
 where we are in the buffer. More...

long m_bufferUse
 how much of the buffer is used. More...


Detailed Description

template<class TYPE>
class lfc::BufferedInput< TYPE >

A class which does generalized buffered input.

Note:
Do not mix read calls of BufferedInput with reads of the underlying streams.
Note:
All buffer sizes are in units of TYPE, not in bytes.


Constructor & Destructor Documentation

template<class TYPE>
lfc::BufferedInput< TYPE >::BufferedInput _Input< TYPE > &    rInputBase,
long    bufferSize = DEFAULT_BUFFER_SIZE
[inline]
 

Parameters:
rInputBase  the input stream to buffer
bufferSize  the buffer size (in units of TYPE)

template<class TYPE>
lfc::BufferedInput< TYPE >::~BufferedInput   throw () [inline]
 


Member Function Documentation

template<class TYPE>
void lfc::BufferedInput< TYPE >::setBufferSize long    bufferSize [virtual]
 

Sets the buffer size.

An exception is thrown if the amount of unread data currently in the buffer exceeds the new buffer size. It is extremely unadvisable to make a call to this method unless the new buffer size is larger than the old. This method is largely here for symmetry with BufferedOutput::setBufferSize

template<class TYPE>
virtual long lfc::BufferedInput< TYPE >::bufferSize   const throw () [inline, virtual]
 

Returns:
the buffer size for this stream in units of TYPE.

template<class TYPE>
long lfc::BufferedInput< TYPE >::read TYPE *    buffer,
long    count,
bool    bWaitAll = true
[virtual]
 

Reads from this stream.

Parameters:
buffer  the buffer to put the data into
count  the number of bytes to try to read
bWaitAll  whether to wait for everything or not
Returns:
the count of TYPE read

Reimplemented from lfc::_Input.

template<class TYPE>
virtual bool lfc::BufferedInput< TYPE >::hasMore   const [inline, virtual]
 

Indicates whether there is more data to read from this stream.

Returns:
whether this stream has more data to read

Reimplemented from lfc::_Input.

template<class TYPE>
virtual TYPE lfc::BufferedInput< TYPE >::pop   [inline, virtual]
 

Returns:
a single object of type TYPE from this stream.

Reimplemented from lfc::_Input.

template<class TYPE>
virtual void lfc::BufferedInput< TYPE >::resetInput   [inline, virtual]
 

\brief Resets the input.

Reimplemented from lfc::_Input.

template<class TYPE>
long lfc::BufferedInput< TYPE >::readFromBase long    wantCnt,
bool    bWaitAll
[protected, virtual]
 

A function which actually makes a read() call to the underlying input stream.

Returns:
the real number of TYPE objects read


Member Data Documentation

template<class TYPE>
const long lfc::BufferedInput::DEFAULT_BUFFER_SIZE = 1024L [static]
 

the default size of the buffer used by this class.

template<class TYPE>
TYPE* lfc::BufferedInput::m_buffer [protected]
 

the actual buffer.

template<class TYPE>
long lfc::BufferedInput::m_bufferSize [protected]
 

its size.

template<class TYPE>
long lfc::BufferedInput::m_bufferPosition [protected]
 

where we are in the buffer.

template<class TYPE>
long lfc::BufferedInput::m_bufferUse [protected]
 

how much of the buffer is used.


The documentation for this class was generated from the following file:
Generated on Fri Jan 25 03:12:54 2002 for LFC2 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001