|
1 // StreamBinder.h |
|
2 |
|
3 #ifndef __STREAMBINDER_H |
|
4 #define __STREAMBINDER_H |
|
5 |
|
6 #include "../IStream.h" |
|
7 #include "../../Windows/Synchronization.h" |
|
8 |
|
9 class CStreamBinder |
|
10 { |
|
11 NWindows::NSynchronization::CManualResetEvent *_allBytesAreWritenEvent; |
|
12 NWindows::NSynchronization::CManualResetEvent *_thereAreBytesToReadEvent; |
|
13 NWindows::NSynchronization::CManualResetEvent *_readStreamIsClosedEvent; |
|
14 UInt32 _bufferSize; |
|
15 const void *_buffer; |
|
16 public: |
|
17 // bool ReadingWasClosed; |
|
18 UInt64 ProcessedSize; |
|
19 CStreamBinder(): |
|
20 _allBytesAreWritenEvent(NULL), |
|
21 _thereAreBytesToReadEvent(NULL), |
|
22 _readStreamIsClosedEvent(NULL) |
|
23 {} |
|
24 ~CStreamBinder(); |
|
25 void CreateEvents(); |
|
26 |
|
27 void CreateStreams(ISequentialInStream **inStream, |
|
28 ISequentialOutStream **outStream); |
|
29 HRESULT Read(void *data, UInt32 size, UInt32 *processedSize); |
|
30 void CloseRead(); |
|
31 |
|
32 HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize); |
|
33 void CloseWrite(); |
|
34 void ReInit(); |
|
35 }; |
|
36 |
|
37 #endif |