Files
easy7zip/7zip/Common/StreamBinder.h
Igor Pavlov 3c510ba80b 4.20
2016-05-28 00:15:41 +01:00

40 lines
1.1 KiB
C++
Executable File

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