00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _blockingstream_h
00018 #define _blockingstream_h
00019
00020 #include <spl/io/Stream.h>
00021
00028 class BlockingStream;
00029 typedef RefCountPtrCast<BlockingStream, spl::IStream, spl::IStreamPtr> BlockingStreamPtr;
00030 typedef WeakReference<BlockingStream, spl::IStreamPtr> BlockingStreamRef;
00031
00032 REGISTER_TYPEOF(72, BlockingStreamPtr);
00033 REGISTER_TYPEOF( 448, BlockingStreamRef );
00034
00036 class BlockingStream : public spl::IStream
00037 {
00038 protected:
00039 spl::IStreamPtr m_strm;
00040 bool m_deleteStream;
00041 Mutex m_datalock;
00042 Event m_dataready;
00043
00044 public:
00045 BlockingStream( spl::IStreamPtr strm );
00046 virtual ~BlockingStream();
00047
00048 virtual int Read(Array<byte>& buffer, const int offset, int count);
00049 virtual int ReadByte();
00050 virtual void Write(const Array<byte>& buffer, const int offset, const int count);
00051 virtual void WriteByte(byte value);
00052
00053 virtual void Close();
00054 virtual void Flush();
00055 virtual long Seek(const long offset, const SeekOrigin origin);
00056
00057 virtual bool CanRead() const;
00058 virtual bool CanSeek() const;
00059 virtual bool CanWrite() const;
00060
00061 virtual long Length() const;
00062 virtual long Position() const;
00063
00064 #ifdef DEBUG
00065 virtual void ValidateMem() const;
00066 virtual void CheckMem() const;
00067 #endif
00068 };
00069
00070 REGISTER_TYPEOF(74, BlockingStream);
00071
00074 #endif