Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "ROOT/RConfig.hxx"
17
18#include <string>
19
20namespace ROOT {
21
22/// The global settings depend on a global variable named R__ZipMode which can be
23/// modified by a global function named R__SetZipMode. Both are defined in Bits.h.
24///
25/// - The default is to use the global setting and the default of the global
26/// setting is to use the ZLIB compression algorithm.
27/// - The LZMA algorithm (from the XZ package) is also available. The LZMA
28/// compression usually results in greater compression factors, but takes
29/// more CPU time and memory when compressing. LZMA memory usage is particularly
30/// high for compression levels 8 and 9.
31/// - Finally, the LZ4 package results in worse compression ratios
32/// than ZLIB but achieves much faster decompression rates.
33///
34/// The current algorithms support level 1 to 9. The higher the level the greater
35/// the compression and more CPU time and memory resources used during compression.
36/// Level 0 means no compression.
37///
38/// Recommendation for the compression algorithm's levels:
39/// - ZLIB is recommended to be used with compression level 1 [101]
40/// - LZMA is recommended to be used with compression level 7-8 (higher is better,
41/// since in the case of LZMA we don't care about compression/decompression speed)
42/// [207 - 208]
43/// - LZ4 is recommended to be used with compression level 4 [404]
44/// - ZSTD is recommended to be used with compression level 5 [505]
45
47 struct EDefaults { /// Note: this is only temporarily a struct and will become a enum class hence the name convention
48 /// used.
49 enum EValues {
50 /// Use the global compression setting for this process; may be affected by rootrc.
52 /// Use the compile-time default setting
54 /// Use the default analysis setting; fast reading but poor compression ratio
56 /// Use the new recommended general-purpose setting; it is a best trade-off between compression
57 /// ratio/decompression speed
59 /// Use the setting that results in the smallest files; very slow read and write
61 };
62 };
63 struct ELevel { /// Note: this is only temporarily a struct and will become a enum class hence the name convention
64 /// used.
65 enum EValues {
66 /// Some objects use this value to denote that the compression algorithm
67 /// should be inherited from the parent object
69 /// Compression level reserved for "uncompressed state"
71 /// Compression level reserved when we are not sure what to use (1 is for the fastest compression)
73 /// Compression level reserved for ZLIB compression algorithm (fastest compression)
75 /// Compression level reserved for LZ4 compression algorithm (trade-off between file ratio/decompression speed)
77 /// Compression level reserved for ZSTD compression algorithm (trade-off between file ratio/decompression
78 /// speed)
80 /// Compression level reserved for old ROOT compression algorithm
82 /// Compression level reserved for LZMA compression algorithm (slowest compression with smallest files)
83 kDefaultLZMA = 7
84 };
85 };
86 struct EAlgorithm { /// Note: this is only temporarily a struct and will become a enum class hence the name
87 /// convention used.
88 enum EValues {
89 /// Some objects use this value to denote that the compression algorithm
90 /// should be inherited from the parent object (e.g., TBranch should get the algorithm from the TTree)
92 /// Use the global compression algorithm
94 /// Use ZLIB compression
96 /// Use LZMA compression
98 /// Use the old compression algorithm
100 /// Use LZ4 compression
102 /// Use ZSTD compression
104 /// Undefined compression algorithm (must be kept the last of the list in case a new algorithm is added).
106 };
107 };
108
109 static std::string AlgorithmToString(EAlgorithm::EValues algorithm);
110};
111
112// clang-format off
113enum R__DEPRECATED(6, 34, "Use RCompressionSetting::EAlgorithm instead") ECompressionAlgorithm {
114 kUseGlobalCompressionSetting = static_cast<int>(RCompressionSetting::EAlgorithm::kUseGlobal),
115 kUseGlobalSetting = static_cast<int>(RCompressionSetting::EAlgorithm::kUseGlobal),
116 kZLIB = static_cast<int>(RCompressionSetting::EAlgorithm::kZLIB),
117 kLZMA = static_cast<int>(RCompressionSetting::EAlgorithm::kLZMA),
118 kOldCompressionAlgo = static_cast<int>(RCompressionSetting::EAlgorithm::kOldCompressionAlgo),
119 kLZ4 = static_cast<int>(RCompressionSetting::EAlgorithm::kLZ4),
120 kZSTD = static_cast<int>(RCompressionSetting::EAlgorithm::kZSTD),
121 kUndefinedCompressionAlgorithm = static_cast<int>(RCompressionSetting::EAlgorithm::kUndefined)
122};
123
125
126int CompressionSettings(ROOT::ECompressionAlgorithm algorithm, int compressionLevel)
127 R__DEPRECATED(6, 34, "Use the overload accepting RCompressionSetting::EAlgorithm instead");
128// clang-format on
129
130} // namespace ROOT
131
132#endif
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition RConfig.hxx:504
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
int Use the overload accepting RCompressionSetting::EAlgorithm instead
int CompressionSettings(RCompressionSetting::EAlgorithm::EValues algorithm, int compressionLevel)
EValues
Note: this is only temporarily a struct and will become a enum class hence the name convention used.
Definition Compression.h:88
@ kUseGlobal
Use the global compression algorithm.
Definition Compression.h:93
@ kOldCompressionAlgo
Use the old compression algorithm.
Definition Compression.h:99
@ kUndefined
Undefined compression algorithm (must be kept the last of the list in case a new algorithm is added).
@ kInherit
Some objects use this value to denote that the compression algorithm should be inherited from the par...
Definition Compression.h:91
EValues
Note: this is only temporarily a struct and will become a enum class hence the name convention used.
Definition Compression.h:49
@ kUseAnalysis
Use the default analysis setting; fast reading but poor compression ratio.
Definition Compression.h:55
@ kUseGlobal
Use the global compression setting for this process; may be affected by rootrc.
Definition Compression.h:51
@ kUseCompiledDefault
Use the compile-time default setting.
Definition Compression.h:53
@ kUseSmallest
Use the setting that results in the smallest files; very slow read and write.
Definition Compression.h:60
@ kUseGeneralPurpose
Use the new recommended general-purpose setting; it is a best trade-off between compression ratio/dec...
Definition Compression.h:58
EValues
Note: this is only temporarily a struct and will become a enum class hence the name convention used.
Definition Compression.h:65
@ kInherit
Some objects use this value to denote that the compression algorithm should be inherited from the par...
Definition Compression.h:68
@ kUseMin
Compression level reserved when we are not sure what to use (1 is for the fastest compression)
Definition Compression.h:72
@ kDefaultOld
Compression level reserved for old ROOT compression algorithm.
Definition Compression.h:81
@ kUncompressed
Compression level reserved for "uncompressed state".
Definition Compression.h:70
@ kDefaultLZMA
Compression level reserved for LZMA compression algorithm (slowest compression with smallest files)
Definition Compression.h:83
@ kDefaultZSTD
Compression level reserved for ZSTD compression algorithm (trade-off between file ratio/decompression...
Definition Compression.h:79
@ kDefaultZLIB
Compression level reserved for ZLIB compression algorithm (fastest compression)
Definition Compression.h:74
@ kDefaultLZ4
Compression level reserved for LZ4 compression algorithm (trade-off between file ratio/decompression ...
Definition Compression.h:76
The global settings depend on a global variable named R__ZipMode which can be modified by a global fu...
Definition Compression.h:46
static std::string AlgorithmToString(EAlgorithm::EValues algorithm)