ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ExpressionParsing::NTUPUnitInterpreter Class Reference

#include <NTUPUnitInterpreter.h>

Inheritance diagram for ExpressionParsing::NTUPUnitInterpreter:
Collaboration diagram for ExpressionParsing::NTUPUnitInterpreter:

Public Member Functions

 NTUPUnitInterpreter ()
 
virtual ~NTUPUnitInterpreter ()
 
bool isKnownUnit (const std::string &unitname) const
 
double unitValue (const std::string &unitname) const
 

Private Member Functions

virtual const std::map< std::string, double > & unitMap () const
 

Private Attributes

std::map< std::string, double > m_unitStringToValue
 

Detailed Description

Definition at line 18 of file NTUPUnitInterpreter.h.

Constructor & Destructor Documentation

◆ NTUPUnitInterpreter()

ExpressionParsing::NTUPUnitInterpreter::NTUPUnitInterpreter ( )

Definition at line 15 of file NTUPUnitInterpreter.cxx.

16  {
17  m_unitStringToValue["keV"] = 0.001;
18  m_unitStringToValue["MeV"] = 1.;
19  m_unitStringToValue["GeV"] = 1000.;
20  m_unitStringToValue["TeV"] = 1000000.;
21 
22  m_unitStringToValue["mm"] = 1.;
23  m_unitStringToValue["cm"] = 10.;
24  }

◆ ~NTUPUnitInterpreter()

ExpressionParsing::NTUPUnitInterpreter::~NTUPUnitInterpreter ( )
virtual

Definition at line 26 of file NTUPUnitInterpreter.cxx.

27  {
28  }

Member Function Documentation

◆ isKnownUnit()

bool ExpressionParsing::IUnitInterpreter::isKnownUnit ( const std::string &  unitname) const
inherited

Definition at line 17 of file IUnitInterpreter.cxx.

18  {
19  return (unitMap().count(unitname) > 0);
20  }

◆ unitMap()

const std::map< std::string, double > & ExpressionParsing::NTUPUnitInterpreter::unitMap ( ) const
privatevirtual

Implements ExpressionParsing::IUnitInterpreter.

Definition at line 30 of file NTUPUnitInterpreter.cxx.

31  {
32  return m_unitStringToValue;
33  }

◆ unitValue()

double ExpressionParsing::IUnitInterpreter::unitValue ( const std::string &  unitname) const
inherited

Definition at line 22 of file IUnitInterpreter.cxx.

23  {
24  typedef std::map<std::string, double>::const_iterator Iterator;
25  const std::map<std::string, double> &theMap = unitMap();
26  for (Iterator it = theMap.begin(); it != theMap.end(); ++it) {
27  if (it->first == unitname) {
28  return it->second;
29  }
30  }
31 
32  throw std::runtime_error("Trying to access unknown unit: "+unitname);
33  }

Member Data Documentation

◆ m_unitStringToValue

std::map<std::string, double> ExpressionParsing::NTUPUnitInterpreter::m_unitStringToValue
private

Definition at line 27 of file NTUPUnitInterpreter.h.


The documentation for this class was generated from the following files:
ExpressionParsing::IUnitInterpreter::unitMap
virtual const std::map< std::string, double > & unitMap() const =0
ExpressionParsing::NTUPUnitInterpreter::m_unitStringToValue
std::map< std::string, double > m_unitStringToValue
Definition: NTUPUnitInterpreter.h:27
skel.it
it
Definition: skel.GENtoEVGEN.py:396
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85