diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Archive/Common/CoderMixer2MT.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,80 @@
     1.4 +// CoderMixer2MT.h
     1.5 +
     1.6 +#ifndef __CODER_MIXER2_MT_H
     1.7 +#define __CODER_MIXER2_MT_H
     1.8 +
     1.9 +#include "CoderMixer2.h"
    1.10 +#include "../../../Common/MyCom.h"
    1.11 +#include "../../Common/StreamBinder.h"
    1.12 +#include "../../Common/VirtThread.h"
    1.13 +
    1.14 +namespace NCoderMixer {
    1.15 +
    1.16 +struct CCoder2: public CCoderInfo2, public CVirtThread
    1.17 +{
    1.18 +  HRESULT Result;
    1.19 +  CObjectVector< CMyComPtr<ISequentialInStream> > InStreams;
    1.20 +  CObjectVector< CMyComPtr<ISequentialOutStream> > OutStreams;
    1.21 +  CRecordVector<ISequentialInStream*> InStreamPointers;
    1.22 +  CRecordVector<ISequentialOutStream*> OutStreamPointers;
    1.23 +
    1.24 +  CCoder2(UInt32 numInStreams, UInt32 numOutStreams);
    1.25 +  void SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes);
    1.26 +  virtual void Execute();
    1.27 +  void Code(ICompressProgressInfo *progress);
    1.28 +};
    1.29 +
    1.30 +
    1.31 +/*
    1.32 +  SetBindInfo()
    1.33 +  for each coder
    1.34 +    AddCoder[2]()
    1.35 +  SetProgressIndex(UInt32 coderIndex);
    1.36 + 
    1.37 +  for each file
    1.38 +  {
    1.39 +    ReInit()
    1.40 +    for each coder
    1.41 +      SetCoderInfo
    1.42 +    Code
    1.43 +  }
    1.44 +*/
    1.45 +
    1.46 +class CCoderMixer2MT:
    1.47 +  public ICompressCoder2,
    1.48 +  public CCoderMixer2,
    1.49 +  public CMyUnknownImp
    1.50 +{
    1.51 +  CBindInfo _bindInfo;
    1.52 +  CObjectVector<CStreamBinder> _streamBinders;
    1.53 +  int _progressCoderIndex;
    1.54 +
    1.55 +  void AddCoderCommon();
    1.56 +  HRESULT Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams);
    1.57 +  HRESULT ReturnIfError(HRESULT code);
    1.58 +public:
    1.59 +  CObjectVector<CCoder2> _coders;
    1.60 +  MY_UNKNOWN_IMP
    1.61 +
    1.62 +  STDMETHOD(Code)(ISequentialInStream **inStreams,
    1.63 +      const UInt64 **inSizes,
    1.64 +      UInt32 numInStreams,
    1.65 +      ISequentialOutStream **outStreams,
    1.66 +      const UInt64 **outSizes,
    1.67 +      UInt32 numOutStreams,
    1.68 +      ICompressProgressInfo *progress);
    1.69 +
    1.70 +  HRESULT SetBindInfo(const CBindInfo &bindInfo);
    1.71 +  void AddCoder(ICompressCoder *coder);
    1.72 +  void AddCoder2(ICompressCoder2 *coder);
    1.73 +  void SetProgressCoderIndex(int coderIndex) {  _progressCoderIndex = coderIndex; }
    1.74 +
    1.75 +  void ReInit();
    1.76 +  void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes)
    1.77 +    {  _coders[coderIndex].SetCoderInfo(inSizes, outSizes); }
    1.78 +  UInt64 GetWriteProcessedSize(UInt32 binderIndex) const
    1.79 +    {  return _streamBinders[binderIndex].ProcessedSize; }
    1.80 +};
    1.81 +
    1.82 +}
    1.83 +#endif