1// MultiStream.h 2 3#ifndef ZIP7_INC_MULTI_STREAM_H 4#define ZIP7_INC_MULTI_STREAM_H 5 6#include "../../../Common/MyCom.h" 7#include "../../../Common/MyVector.h" 8 9#include "../../IStream.h" 10#include "../../Archive/IArchive.h" 11 12Z7_CLASS_IMP_COM_1( 13 CMultiStream 14 , IInStream 15) 16 Z7_IFACE_COM7_IMP(ISequentialInStream) 17 18 unsigned _streamIndex; 19 UInt64 _pos; 20 UInt64 _totalLength; 21 22public: 23 24 struct CSubStreamInfo 25 { 26 CMyComPtr<IInStream> Stream; 27 UInt64 Size; 28 UInt64 GlobalOffset; 29 UInt64 LocalPos; 30 CSubStreamInfo(): Size(0), GlobalOffset(0), LocalPos(0) {} 31 }; 32 33 CMyComPtr<IArchiveUpdateCallbackFile> updateCallbackFile; 34 CObjectVector<CSubStreamInfo> Streams; 35 36 HRESULT Init() 37 { 38 UInt64 total = 0; 39 FOR_VECTOR (i, Streams) 40 { 41 CSubStreamInfo &s = Streams[i]; 42 s.GlobalOffset = total; 43 total += s.Size; 44 s.LocalPos = 0; 45 { 46 // it was already set to start 47 // RINOK(InStream_GetPos(s.Stream, s.LocalPos)); 48 } 49 } 50 _totalLength = total; 51 _pos = 0; 52 _streamIndex = 0; 53 return S_OK; 54 } 55}; 56 57/* 58Z7_CLASS_IMP_COM_1( 59 COutMultiStream, 60 IOutStream 61) 62 Z7_IFACE_COM7_IMP(ISequentialOutStream) 63 64 unsigned _streamIndex; // required stream 65 UInt64 _offsetPos; // offset from start of _streamIndex index 66 UInt64 _absPos; 67 UInt64 _length; 68 69 struct CSubStreamInfo 70 { 71 CMyComPtr<ISequentialOutStream> Stream; 72 UInt64 Size; 73 UInt64 Pos; 74 }; 75 CObjectVector<CSubStreamInfo> Streams; 76public: 77 CMyComPtr<IArchiveUpdateCallback2> VolumeCallback; 78 void Init() 79 { 80 _streamIndex = 0; 81 _offsetPos = 0; 82 _absPos = 0; 83 _length = 0; 84 } 85}; 86*/ 87 88#endif 89