view src/win32/7zip/7z/CPP/7zip/Archive/Common/CoderMixer2MT.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 source
1 // CoderMixer2MT.h
3 #ifndef __CODER_MIXER2_MT_H
4 #define __CODER_MIXER2_MT_H
6 #include "CoderMixer2.h"
7 #include "../../../Common/MyCom.h"
8 #include "../../Common/StreamBinder.h"
9 #include "../../Common/VirtThread.h"
11 namespace NCoderMixer {
13 struct CCoder2: public CCoderInfo2, public CVirtThread
14 {
15 HRESULT Result;
16 CObjectVector< CMyComPtr<ISequentialInStream> > InStreams;
17 CObjectVector< CMyComPtr<ISequentialOutStream> > OutStreams;
18 CRecordVector<ISequentialInStream*> InStreamPointers;
19 CRecordVector<ISequentialOutStream*> OutStreamPointers;
21 CCoder2(UInt32 numInStreams, UInt32 numOutStreams);
22 void SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes);
23 virtual void Execute();
24 void Code(ICompressProgressInfo *progress);
25 };
28 /*
29 SetBindInfo()
30 for each coder
31 AddCoder[2]()
32 SetProgressIndex(UInt32 coderIndex);
34 for each file
35 {
36 ReInit()
37 for each coder
38 SetCoderInfo
39 Code
40 }
41 */
43 class CCoderMixer2MT:
44 public ICompressCoder2,
45 public CCoderMixer2,
46 public CMyUnknownImp
47 {
48 CBindInfo _bindInfo;
49 CObjectVector<CStreamBinder> _streamBinders;
50 int _progressCoderIndex;
52 void AddCoderCommon();
53 HRESULT Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams);
54 HRESULT ReturnIfError(HRESULT code);
55 public:
56 CObjectVector<CCoder2> _coders;
57 MY_UNKNOWN_IMP
59 STDMETHOD(Code)(ISequentialInStream **inStreams,
60 const UInt64 **inSizes,
61 UInt32 numInStreams,
62 ISequentialOutStream **outStreams,
63 const UInt64 **outSizes,
64 UInt32 numOutStreams,
65 ICompressProgressInfo *progress);
67 HRESULT SetBindInfo(const CBindInfo &bindInfo);
68 void AddCoder(ICompressCoder *coder);
69 void AddCoder2(ICompressCoder2 *coder);
70 void SetProgressCoderIndex(int coderIndex) { _progressCoderIndex = coderIndex; }
72 void ReInit();
73 void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes)
74 { _coders[coderIndex].SetCoderInfo(inSizes, outSizes); }
75 UInt64 GetWriteProcessedSize(UInt32 binderIndex) const
76 { return _streamBinders[binderIndex].ProcessedSize; }
77 };
79 }
80 #endif