00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <spl/io/Stream.h>
00018
00019 #ifdef _stream2_h
00020
00021
00022 #ifndef _streamreadpump_h
00023 #define _streamreadpump_h
00024
00025 #include <spl/collection/Array.h>
00026 #include <spl/DelegateDispatch.h>
00027 #include <spl/io/StreamDelegateDispatch.h>
00028 #include <spl/threading/Thread.h>
00029
00040 class StreamReadPump : public Thread
00041 {
00042 private:
00043
00044 inline StreamReadPump(const StreamReadPump& pmp) {}
00045 inline void operator =(const StreamReadPump& pmp) {}
00046
00047 protected:
00048 spl::IStreamPtr m_strm;
00049 volatile bool m_running;
00050 Array<byte> m_buf;
00051 int m_bufsize;
00052
00053 StreamDelegateDispatch m_eventDispatch;
00054
00055 public:
00056 StreamReadPump(spl::IStreamPtr strm, int bufsize = 512);
00057 ~StreamReadPump();
00058
00059 inline spl::IStreamPtr GetStream() { return m_strm; }
00060
00061 void Run();
00062 void Stop();
00063
00064 inline StreamDelegateDispatch& Delegates() { return m_eventDispatch; }
00065
00066 #ifdef DEBUG
00067 virtual void ValidateMem() const;
00068 virtual void CheckMem() const;
00069 #endif
00070 };
00071
00072 REGISTER_TYPEOF(132, StreamReadPump);
00073
00076 #endif
00077 #endif