| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

RootCompressionSettings.cpp
Go to the documentation of this file.
1 // STD
2 #include <stdexcept>
3
4 // local
5 #include "RootCompressionSettings.h"
6
7 // ROOT
8 #include "Compression.h"
9
10 //-----------------------------------------------------------------------------
11 // Implementation file for class : RootCompressionSettings
12 //
13 // 2013-10-24 : Chris Jones
14 //-----------------------------------------------------------------------------
15
16 //=============================================================================
17 // Standard constructor, initializes variables
18 //=============================================================================
19 RootHistCnv::RootCompressionSettings::RootCompressionSettings( const std::string& settings )
20 : m_level( ROOT::CompressionSettings( ROOT::kZLIB, 1 ) )
21 {
22 const std::string::size_type idx = settings.find( ':' );
23 if ( idx != std::string::npos ) {
24 // Get compression algorithm type
25 const std::string alg = settings.substr( 0, idx );
26 ROOT::ECompressionAlgorithm alg_code = ROOT::kUseGlobalSetting;
27 if ( alg == "ZLIB" ) {
28 alg_code = ROOT::kZLIB;
29 } else if ( alg == "LZMA" ) {
30 alg_code = ROOT::kLZMA;
31 } else {
32 throw std::runtime_error( "ERROR: Unknown ROOT compression algorithm:" + alg );
33 }
34
35 // get compression level
36 const std::string slev = settings.substr( idx + 1 );
37 const int ilev = std::stoi( slev );
38
39 // set the level
40 m_level = ROOT::CompressionSettings( alg_code, ilev );
41 }
42 }
43
44 //=============================================================================
RootCompressionSettings.h
ROOT
Definition: IMagneticFieldSvc.h:9
std::string
STL class.
std::runtime_error
STL class.
RootHistCnv::RootCompressionSettings::RootCompressionSettings
RootCompressionSettings(const std::string &settings)
Standard constructor.
Definition: RootCompressionSettings.cpp:19
std::string::find
T find(T...args)
std::string::substr
T substr(T...args)
std::stoi
T stoi(T...args)
RootHistCnv::RootCompressionSettings::m_level
int m_level
The cached ROOT compression level int.
Definition: RootCompressionSettings.h:23