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