StreamBinder.h 832 B

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