LockedStream.h 818 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // LockedStream.h
  2. #ifndef __LOCKEDSTREAM_H
  3. #define __LOCKEDSTREAM_H
  4. #include "../../Windows/Synchronization.h"
  5. #include "../../Common/MyCom.h"
  6. #include "../IStream.h"
  7. class CLockedInStream
  8. {
  9. CMyComPtr<IInStream> _stream;
  10. NWindows::NSynchronization::CCriticalSection _criticalSection;
  11. public:
  12. void Init(IInStream *stream)
  13. { _stream = stream; }
  14. HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize);
  15. };
  16. class CLockedSequentialInStreamImp:
  17. public ISequentialInStream,
  18. public CMyUnknownImp
  19. {
  20. CLockedInStream *_lockedInStream;
  21. UInt64 _pos;
  22. public:
  23. void Init(CLockedInStream *lockedInStream, UInt64 startPos)
  24. {
  25. _lockedInStream = lockedInStream;
  26. _pos = startPos;
  27. }
  28. MY_UNKNOWN_IMP
  29. STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
  30. };
  31. #endif