Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 // StreamBinder.h
3 #ifndef __STREAMBINDER_H
4 #define __STREAMBINDER_H
6 #include "../IStream.h"
7 #include "../../Windows/Synchronization.h"
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();
27 void CreateStreams(ISequentialInStream **inStream,
28 ISequentialOutStream **outStream);
29 HRESULT Read(void *data, UInt32 size, UInt32 *processedSize);
30 void CloseRead();
32 HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize);
33 void CloseWrite();
34 void ReInit();
35 };
37 #endif