ATLAS Offline Software
Public Member Functions | Private Member Functions | List of all members
ExpressionParsing::IUnitInterpreter Class Referenceabstract

#include <IUnitInterpreter.h>

Inheritance diagram for ExpressionParsing::IUnitInterpreter:
Collaboration diagram for ExpressionParsing::IUnitInterpreter:

Public Member Functions

virtual ~IUnitInterpreter ()
 
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 =0
 

Detailed Description

Definition at line 19 of file IUnitInterpreter.h.

Constructor & Destructor Documentation

◆ ~IUnitInterpreter()

virtual ExpressionParsing::IUnitInterpreter::~IUnitInterpreter ( )
inlinevirtual

Definition at line 21 of file IUnitInterpreter.h.

21 { }

Member Function Documentation

◆ isKnownUnit()

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

Definition at line 17 of file IUnitInterpreter.cxx.

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

◆ unitMap()

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

◆ unitValue()

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

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  }

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