1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// 7zCompressionMode.h
2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __7Z_COMPRESSION_MODE_H
4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __7Z_COMPRESSION_MODE_H
5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
6cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky#include "../../Common/MethodId.h"
7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Common/MethodProps.h"
8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
9baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace NArchive {
10baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace N7z {
11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
12f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osakastruct CMethodFull: public CMethodProps
13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
14cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky  CMethodId Id;
15f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  UInt32 NumStreams;
16cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky
17f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  bool IsSimpleCoder() const { return NumStreams == 1; }
18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync};
19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
20f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osakastruct CBond2
21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
22baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 OutCoder;
23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 OutStream;
24f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  UInt32 InCoder;
25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync};
26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
27baa3858d3f5d128a5c8466b700098109edcad5f2repo syncstruct CCompressionMethodMode
28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
29f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  /*
30f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka    if (Bonds.Empty()), then default bonds must be created
31f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka    if (Filter_was_Inserted)
32f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka    {
33f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka      Methods[0] is filter method
34f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka      Bonds don't contain bonds for filter (these bonds must be created)
35f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka    }
36f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  */
37f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka
38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CObjectVector<CMethodFull> Methods;
39f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  CRecordVector<CBond2> Bonds;
40f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka
41f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  bool IsThereBond_to_Coder(unsigned coderIndex) const
42f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  {
43f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka    FOR_VECTOR(i, Bonds)
44f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka      if (Bonds[i].InCoder == coderIndex)
45f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka        return true;
46f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka    return false;
47f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  }
48f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka
49f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  bool DefaultMethod_was_Inserted;
50f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  bool Filter_was_Inserted;
51f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka
52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  #ifndef _7ZIP_ST
53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 NumThreads;
54f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  bool MultiThreadMixer;
55baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  #endif
56f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka
57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool PasswordIsDefined;
58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UString Password;
59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
60baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); }
61f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka  CCompressionMethodMode():
62f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka      DefaultMethod_was_Inserted(false),
63f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka      Filter_was_Inserted(false),
64f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka      PasswordIsDefined(false)
65baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      #ifndef _7ZIP_ST
66baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      , NumThreads(1)
67f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka      , MultiThreadMixer(true)
68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      #endif
69baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  {}
70baa3858d3f5d128a5c8466b700098109edcad5f2repo sync};
71baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}}
73baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
74baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif
75