barrier/lib/io/IInputStream.h
crs fee4095624 Reorganized source tree. Moved client.cpp into cmd/synergy as
synergy.cpp and server.cpp into cmd/synergyd as synergyd.cpp.
Moved and renamed related files.  Moved remaining source files
into lib/....  Modified and added makefiles as appropriate.
Result is that library files are under lib with each library
in its own directory and program files are under cmd with each
command in its own directory.
2002-07-30 16:52:46 +00:00

54 lines
1.3 KiB
C++

#ifndef IINPUTSTREAM_H
#define IINPUTSTREAM_H
#include "IInterface.h"
#include "BasicTypes.h"
//! Input stream interface
/*!
Defines the interface for all input streams.
*/
class IInputStream : public IInterface {
public:
//! @name manipulators
//@{
//! Close the stream
/*!
Closes the stream. Attempting to read() after close() throws
XIOClosed and getSize() always returns zero.
*/
virtual void close() = 0;
//! Read from stream
/*!
Read up to \c n bytes into buffer, returning the number read.
Blocks for up to \c timeout seconds if no data is available but does
not wait if any data is available, even if less than \c n bytes.
If \c timeout < 0 then it blocks indefinitely until data is available.
If \c buffer is NULL then the data is discarded. Returns (UInt32)-1 if
it times out and 0 if no data is available and the other end of the
stream has hungup.
(cancellation point)
*/
virtual UInt32 read(void* buffer, UInt32 n, double timeout) = 0;
//@}
//! @name accessors
//@{
//! Get remaining size of stream
/*!
Returns a conservative estimate of the available bytes to read
(i.e. a number not greater than the actual number of bytes).
Some streams may not be able to determine this and will always
return zero.
*/
virtual UInt32 getSize() const = 0;
//@}
};
#endif