Logo ROOT  
Reference Guide
Compression.h
Go to the documentation of this file.
1 // @(#)root/zip:$Id$
2 // Author: David Dagenhart May 2011
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_Compression
13 #define ROOT_Compression
14 
15 #include "RtypesCore.h"
16 
17 namespace ROOT {
18 
19 /// The global settings depend on a global variable named R__ZipMode which can be
20 /// modified by a global function named R__SetZipMode. Both are defined in Bits.h.
21 ///
22 /// - The default is to use the global setting and the default of the global
23 /// setting is to use the ZLIB compression algorithm.
24 /// - The LZMA algorithm (from the XZ package) is also available. The LZMA
25 /// compression usually results in greater compression factors, but takes
26 /// more CPU time and memory when compressing. LZMA memory usage is particularly
27 /// high for compression levels 8 and 9.
28 /// - Finally, the LZ4 package results in worse compression ratios
29 /// than ZLIB but achieves much faster decompression rates.
30 ///
31 /// The current algorithms support level 1 to 9. The higher the level the greater
32 /// the compression and more CPU time and memory resources used during compression.
33 /// Level 0 means no compression.
34 ///
35 /// Recommendation for the compression algorithm's levels:
36 /// - ZLIB is recommended to be used with compression level 1 [101]
37 /// - LZMA is recommended to be used with compression level 7-8 (higher is better,
38 /// since in the case of LZMA we don't care about compression/decompression speed)
39 /// [207 - 208]
40 /// - LZ4 is recommended to be used with compression level 4 [404]
41 /// - ZSTD is recommended to be used with compression level 5 [505]
42 
44  struct EDefaults { /// Note: this is only temporarily a struct and will become a enum class hence the name convention
45  /// used.
46  enum EValues {
47  /// Use the global compression setting for this process; may be affected by rootrc.
49  /// Use the compile-time default setting
51  /// Use the default analysis setting; fast reading but poor compression ratio
52  kUseAnalysis = 404,
53  /// Use the new recommended general-purpose setting; it is a best trade-off between compression ratio/decompression speed
55  /// Use the setting that results in the smallest files; very slow read and write
56  kUseSmallest = 207,
57  };
58  };
59  struct ELevel { /// Note: this is only temporarily a struct and will become a enum class hence the name convention
60  /// used.
61  enum EValues {
62  /// Some objects use this value to denote that the compression algorithm
63  /// should be inherited from the parent object
64  kInherit = -1,
65  /// Compression level reserved for "uncompressed state"
67  /// Compression level reserved when we are not sure what to use (1 is for the fastest compression)
68  kUseMin = 1,
69  /// Compression level reserved for ZLIB compression algorithm (fastest compression)
71  /// Compression level reserved for LZ4 compression algorithm (trade-off between file ratio/decompression speed)
73  /// Compression level reserved for ZSYD compression algorithm (trade-off between file ratio/decompression speed)
75  /// Compression level reserved for old ROOT compression algorithm
77  /// Compression level reserved for LZMA compression algorithm (slowest compression with smallest files)
78  kDefaultLZMA = 7
79  };
80  };
81  struct EAlgorithm { /// Note: this is only temporarily a struct and will become a enum class hence the name
82  /// convention used.
83  enum EValues {
84  /// Some objects use this value to denote that the compression algorithm
85  /// should be inherited from the parent object (e.g., TBranch should get the algorithm from the TTree)
86  kInherit = -1,
87  /// Use the global compression algorithm
89  /// Use ZLIB compression
91  /// Use LZMA compression
93  /// Use the old compression algorithm
95  /// Use LZ4 compression
97  /// Use ZSTD compression
99  /// Undefined compression algorithm (must be kept the last of the list in case a new algorithm is added).
100  kUndefined
101  };
102  };
103 };
104 
106  /// Deprecated name, do *not* use:
108  /// Deprecated name, do *not* use:
110  /// Deprecated name, do *not* use:
112  /// Deprecated name, do *not* use:
114  /// Deprecated name, do *not* use:
116  /// Deprecated name, do *not* use:
118  /// Deprecated name, do *not* use:
120  /// Deprecated name, do *not* use:
122 };
123 
124 int CompressionSettings(RCompressionSetting::EAlgorithm algorithm, int compressionLevel);
125 /// Deprecated name, do *not* use:
126 int CompressionSettings(ROOT::ECompressionAlgorithm algorithm, int compressionLevel);
127 } // namespace ROOT
128 
129 #endif
ROOT::RCompressionSetting::EDefaults
Definition: Compression.h:44
ROOT::RCompressionSetting::ELevel::kDefaultZSTD
@ kDefaultZSTD
Compression level reserved for ZSYD compression algorithm (trade-off between file ratio/decompression...
Definition: Compression.h:74
ROOT::RCompressionSetting::EDefaults::kUseGlobal
@ kUseGlobal
Use the global compression setting for this process; may be affected by rootrc.
Definition: Compression.h:48
ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose
@ kUseGeneralPurpose
Use the new recommended general-purpose setting; it is a best trade-off between compression ratio/dec...
Definition: Compression.h:54
ROOT::RCompressionSetting::ELevel::kUncompressed
@ kUncompressed
Compression level reserved for "uncompressed state".
Definition: Compression.h:66
ROOT::RCompressionSetting::ELevel::kUseMin
@ kUseMin
Compression level reserved when we are not sure what to use (1 is for the fastest compression)
Definition: Compression.h:68
ROOT::RCompressionSetting::ELevel
Definition: Compression.h:59
ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault
@ kUseCompiledDefault
Use the compile-time default setting.
Definition: Compression.h:50
ROOT::RCompressionSetting::EAlgorithm::kLZMA
@ kLZMA
Use LZMA compression.
Definition: Compression.h:92
ROOT::RCompressionSetting::EAlgorithm::EValues
EValues
Note: this is only temporarily a struct and will become a enum class hence the name.
Definition: Compression.h:83
ROOT::kUndefinedCompressionAlgorithm
@ kUndefinedCompressionAlgorithm
Deprecated name, do not use:
Definition: Compression.h:121
ROOT::RCompressionSetting::EDefaults::kUseSmallest
@ kUseSmallest
Use the setting that results in the smallest files; very slow read and write.
Definition: Compression.h:56
ROOT::kZLIB
@ kZLIB
Deprecated name, do not use:
Definition: Compression.h:111
ROOT::RCompressionSetting
The global settings depend on a global variable named R__ZipMode which can be modified by a global fu...
Definition: Compression.h:43
ROOT::RCompressionSetting::EDefaults::EValues
EValues
Note: this is only temporarily a struct and will become a enum class hence the name convention used.
Definition: Compression.h:46
ROOT::RCompressionSetting::EAlgorithm::kZSTD
@ kZSTD
Use ZSTD compression.
Definition: Compression.h:98
ROOT::RCompressionSetting::EDefaults::kUseAnalysis
@ kUseAnalysis
Use the default analysis setting; fast reading but poor compression ratio.
Definition: Compression.h:52
ROOT::RCompressionSetting::ELevel::kDefaultOld
@ kDefaultOld
Compression level reserved for old ROOT compression algorithm.
Definition: Compression.h:76
ROOT::kUseGlobalSetting
@ kUseGlobalSetting
Deprecated name, do not use:
Definition: Compression.h:109
ROOT::kLZ4
@ kLZ4
Deprecated name, do not use:
Definition: Compression.h:117
ROOT::RCompressionSetting::EAlgorithm::kOldCompressionAlgo
@ kOldCompressionAlgo
Use the old compression algorithm.
Definition: Compression.h:94
ROOT::RCompressionSetting::EAlgorithm
Definition: Compression.h:81
ROOT::kLZMA
@ kLZMA
Deprecated name, do not use:
Definition: Compression.h:113
ROOT::ECompressionAlgorithm
ECompressionAlgorithm
Definition: Compression.h:105
ROOT::kZSTD
@ kZSTD
Deprecated name, do not use:
Definition: Compression.h:119
ROOT::RCompressionSetting::EAlgorithm::kZLIB
@ kZLIB
Use ZLIB compression.
Definition: Compression.h:90
ROOT::RCompressionSetting::ELevel::kDefaultLZ4
@ kDefaultLZ4
Compression level reserved for LZ4 compression algorithm (trade-off between file ratio/decompression ...
Definition: Compression.h:72
ROOT::RCompressionSetting::ELevel::EValues
EValues
Note: this is only temporarily a struct and will become a enum class hence the name convention used.
Definition: Compression.h:61
ROOT::RCompressionSetting::EAlgorithm::kUseGlobal
@ kUseGlobal
Use the global compression algorithm.
Definition: Compression.h:88
ROOT::kOldCompressionAlgo
@ kOldCompressionAlgo
Deprecated name, do not use:
Definition: Compression.h:115
ROOT::kUseGlobalCompressionSetting
@ kUseGlobalCompressionSetting
Deprecated name, do not use:
Definition: Compression.h:107
ROOT::RCompressionSetting::ELevel::kDefaultZLIB
@ kDefaultZLIB
Compression level reserved for ZLIB compression algorithm (fastest compression)
Definition: Compression.h:70
RtypesCore.h
ROOT::CompressionSettings
int CompressionSettings(RCompressionSetting::EAlgorithm algorithm, int compressionLevel)
ROOT::RCompressionSetting::ELevel::kInherit
@ kInherit
Some objects use this value to denote that the compression algorithm should be inherited from the par...
Definition: Compression.h:64
ROOT::RCompressionSetting::ELevel::kDefaultLZMA
@ kDefaultLZMA
Compression level reserved for LZMA compression algorithm (slowest compression with smallest files)
Definition: Compression.h:78
ROOT::RCompressionSetting::EAlgorithm::kUndefined
@ kUndefined
Undefined compression algorithm (must be kept the last of the list in case a new algorithm is added).
Definition: Compression.h:100
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::RCompressionSetting::EAlgorithm::kInherit
@ kInherit
Some objects use this value to denote that the compression algorithm should be inherited from the par...
Definition: Compression.h:86
ROOT::RCompressionSetting::EAlgorithm::kLZ4
@ kLZ4
Use LZ4 compression.
Definition: Compression.h:96