michael@0: // StreamBinder.h michael@0: michael@0: #ifndef __STREAMBINDER_H michael@0: #define __STREAMBINDER_H michael@0: michael@0: #include "../IStream.h" michael@0: #include "../../Windows/Synchronization.h" michael@0: michael@0: class CStreamBinder michael@0: { michael@0: NWindows::NSynchronization::CManualResetEvent *_allBytesAreWritenEvent; michael@0: NWindows::NSynchronization::CManualResetEvent *_thereAreBytesToReadEvent; michael@0: NWindows::NSynchronization::CManualResetEvent *_readStreamIsClosedEvent; michael@0: UInt32 _bufferSize; michael@0: const void *_buffer; michael@0: public: michael@0: // bool ReadingWasClosed; michael@0: UInt64 ProcessedSize; michael@0: CStreamBinder(): michael@0: _allBytesAreWritenEvent(NULL), michael@0: _thereAreBytesToReadEvent(NULL), michael@0: _readStreamIsClosedEvent(NULL) michael@0: {} michael@0: ~CStreamBinder(); michael@0: void CreateEvents(); michael@0: michael@0: void CreateStreams(ISequentialInStream **inStream, michael@0: ISequentialOutStream **outStream); michael@0: HRESULT Read(void *data, UInt32 size, UInt32 *processedSize); michael@0: void CloseRead(); michael@0: michael@0: HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize); michael@0: void CloseWrite(); michael@0: void ReInit(); michael@0: }; michael@0: michael@0: #endif