The Gaudi Framework  v31r0 (aeb156f0)
RootHistCnv::RootCompressionSettings Class Reference

Simple class to decode a ROOT compression settings string, of the form '<Alg>:<level>' into the integer code to pass to ROOT. More...

#include <src/RootCompressionSettings.h>

Public Member Functions

 RootCompressionSettings (const std::string &settings)
 Standard constructor. More...
 
int level () const
 Get the level. More...
 

Private Attributes

int m_level
 The cached ROOT compression level int. More...
 

Detailed Description

Simple class to decode a ROOT compression settings string, of the form '<Alg>:<level>' into the integer code to pass to ROOT.

Author
Chris Jones
Date
2013-10-24

Definition at line 19 of file RootCompressionSettings.h.

Constructor & Destructor Documentation

RootHistCnv::RootCompressionSettings::RootCompressionSettings ( const std::string settings)

Standard constructor.

Definition at line 19 of file RootCompressionSettings.cpp.

20  : m_level( ROOT::CompressionSettings( ROOT::kZLIB, 1 ) ) {
21  const std::string::size_type idx = settings.find( ':' );
22  if ( idx != std::string::npos ) {
23  // Get compression algorithm type
24  const std::string alg = settings.substr( 0, idx );
25  ROOT::ECompressionAlgorithm alg_code = ROOT::kUseGlobalSetting;
26  if ( alg == "ZLIB" ) {
27  alg_code = ROOT::kZLIB;
28  } else if ( alg == "LZMA" ) {
29  alg_code = ROOT::kLZMA;
30  } else {
31  throw std::runtime_error( "ERROR: Unknown ROOT compression algorithm:" + alg );
32  }
33 
34  // get compression level
35  const std::string slev = settings.substr( idx + 1 );
36  const int ilev = std::stoi( slev );
37 
38  // set the level
39  m_level = ROOT::CompressionSettings( alg_code, ilev );
40  }
41 }
STL class.
T find(T...args)
T substr(T...args)
T stoi(T...args)
int m_level
The cached ROOT compression level int.

Member Function Documentation

int RootHistCnv::RootCompressionSettings::level ( ) const
inline

Get the level.

Definition at line 28 of file RootCompressionSettings.h.

28 { return m_level; }
int m_level
The cached ROOT compression level int.

Member Data Documentation

int RootHistCnv::RootCompressionSettings::m_level
private

The cached ROOT compression level int.

Definition at line 21 of file RootCompressionSettings.h.


The documentation for this class was generated from the following files: