1 // 7zCompressionMode.h 2 3 #ifndef __7Z_COMPRESSION_MODE_H 4 #define __7Z_COMPRESSION_MODE_H 5 6 #include "../../Common/MethodId.h" 7 #include "../../Common/MethodProps.h" 8 9 namespace NArchive { 10 namespace N7z { 11 12 struct CMethodFull: public CMethodProps 13 { 14 CMethodId Id; 15 UInt32 NumStreams; 16 int CodecIndex; 17 UInt32 NumThreads; 18 bool Set_NumThreads; 19 CMethodFullCMethodFull20 CMethodFull(): CodecIndex(-1), NumThreads(1), Set_NumThreads(false) {} IsSimpleCoderCMethodFull21 bool IsSimpleCoder() const { return NumStreams == 1; } 22 }; 23 24 struct CBond2 25 { 26 UInt32 OutCoder; 27 UInt32 OutStream; 28 UInt32 InCoder; 29 }; 30 31 struct CCompressionMethodMode 32 { 33 /* 34 if (Bonds.Empty()), then default bonds must be created 35 if (Filter_was_Inserted) 36 { 37 Methods[0] is filter method 38 Bonds don't contain bonds for filter (these bonds must be created) 39 } 40 */ 41 42 CObjectVector<CMethodFull> Methods; 43 CRecordVector<CBond2> Bonds; 44 IsThereBond_to_CoderCCompressionMethodMode45 bool IsThereBond_to_Coder(unsigned coderIndex) const 46 { 47 FOR_VECTOR(i, Bonds) 48 if (Bonds[i].InCoder == coderIndex) 49 return true; 50 return false; 51 } 52 53 bool DefaultMethod_was_Inserted; 54 bool Filter_was_Inserted; 55 56 #ifndef _7ZIP_ST 57 UInt32 NumThreads; 58 bool NumThreads_WasForced; 59 bool MultiThreadMixer; 60 #endif 61 62 UInt64 MemoryUsageLimit; 63 bool MemoryUsageLimit_WasSet; 64 65 bool PasswordIsDefined; 66 UString Password; // _Wipe 67 IsEmptyCCompressionMethodMode68 bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); } CCompressionMethodModeCCompressionMethodMode69 CCompressionMethodMode(): 70 DefaultMethod_was_Inserted(false) 71 , Filter_was_Inserted(false) 72 #ifndef _7ZIP_ST 73 , NumThreads(1) 74 , NumThreads_WasForced(false) 75 , MultiThreadMixer(true) 76 #endif 77 , MemoryUsageLimit((UInt64)1 << 30) 78 , MemoryUsageLimit_WasSet(false) 79 , PasswordIsDefined(false) 80 {} 81 ~CCompressionMethodModeCCompressionMethodMode82 ~CCompressionMethodMode() { Password.Wipe_and_Empty(); } 83 }; 84 85 }} 86 87 #endif 88