diff src/win32/7zip/7z/CPP/7zip/Common/LockedStream.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Common/LockedStream.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,38 @@
     1.4 +// LockedStream.h
     1.5 +
     1.6 +#ifndef __LOCKEDSTREAM_H
     1.7 +#define __LOCKEDSTREAM_H
     1.8 +
     1.9 +#include "../../Windows/Synchronization.h"
    1.10 +#include "../../Common/MyCom.h"
    1.11 +#include "../IStream.h"
    1.12 +
    1.13 +class CLockedInStream
    1.14 +{
    1.15 +  CMyComPtr<IInStream> _stream;
    1.16 +  NWindows::NSynchronization::CCriticalSection _criticalSection;
    1.17 +public:
    1.18 +  void Init(IInStream *stream)
    1.19 +    { _stream = stream; }
    1.20 +  HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize);
    1.21 +};
    1.22 +
    1.23 +class CLockedSequentialInStreamImp:
    1.24 +  public ISequentialInStream,
    1.25 +  public CMyUnknownImp
    1.26 +{
    1.27 +  CLockedInStream *_lockedInStream;
    1.28 +  UInt64 _pos;
    1.29 +public:
    1.30 +  void Init(CLockedInStream *lockedInStream, UInt64 startPos)
    1.31 +  {
    1.32 +    _lockedInStream = lockedInStream;
    1.33 +    _pos = startPos;
    1.34 +  }
    1.35 +
    1.36 +  MY_UNKNOWN_IMP
    1.37 +
    1.38 +  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
    1.39 +};
    1.40 +
    1.41 +#endif