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>

Collaboration diagram for RootHistCnv::RootCompressionSettings:

Public Member Functions

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

Private Attributes

std::string m_compSettings
 The compression settings string. More...
 
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 21 of file RootCompressionSettings.cpp.

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

Destructor.

Definition at line 28 of file RootCompressionSettings.h.

28 { }

Member Function Documentation

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

Get the level.

Definition at line 33 of file RootCompressionSettings.h.

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

Member Data Documentation

std::string RootHistCnv::RootCompressionSettings::m_compSettings
private

The compression settings string.

Definition at line 38 of file RootCompressionSettings.h.

int RootHistCnv::RootCompressionSettings::m_level
private

The cached ROOT compression level int.

Definition at line 41 of file RootCompressionSettings.h.


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