ATLAS Offline Software
ExpressionParser.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // ExpressionParser.h, (c) ATLAS Detector software
8 // Author: Thomas Gillam (thomas.gillam@cern.ch)
9 // ExpressionParsing library
11 
12 #ifndef EXPRESSION_PARSER_H
13 #define EXPRESSION_PARSER_H
14 
19 
22 
23 #include <sstream>
24 #include <stdexcept>
25 
26 namespace ExpressionParsing {
27  class VirtualMachine;
28 
30  {
31  public:
33  ExpressionParser(IProxyLoader *proxyLoader);
34  ExpressionParser(IUnitInterpreter *unitInterpreter);
35  ExpressionParser(IProxyLoader *proxyLoader, IUnitInterpreter *unitInterpreter);
37 
40 
41  bool loadExpression(const std::string &expression);
42  StackElement evaluate() const;
43  bool evaluateAsBool() const;
44  double evaluateAsDouble() const;
45  std::vector<int> evaluateAsVector() const;
46  std::vector<std::string> getVariables() const;
47 
48  private:
49  void setup();
50 
51  private:
54  std::vector<StackElement> m_code;
55  VirtualMachine *m_vm;
56  };
57 }
58 
59 #endif // EXPRESSION_PARSER_H
StackElement.h
ExpressionParsing::ExpressionParser::evaluate
StackElement evaluate() const
Definition: ExpressionParser.cxx:99
ExpressionParsing::ExpressionParser::getVariables
std::vector< std::string > getVariables() const
Definition: ExpressionParser.cxx:89
ExpressionParsing::IUnitInterpreter
Definition: IUnitInterpreter.h:19
AuxVectorBase.h
Manage index tracking and synchronization of auxiliary data.
ExpressionParsing::ExpressionParser::m_proxyLoader
IProxyLoader * m_proxyLoader
Definition: ExpressionParser.h:52
ExpressionParsing::IProxyLoader
Definition: IProxyLoader.h:19
ExpressionParsing::ExpressionParser::loadExpression
bool loadExpression(const std::string &expression)
Definition: ExpressionParser.cxx:61
HION12.expression
string expression
Definition: HION12.py:56
ExpressionParsing::ExpressionParser::~ExpressionParser
~ExpressionParser()
Definition: ExpressionParser.cxx:49
ExpressionParsing::ExpressionParser::ExpressionParser
ExpressionParser(const ExpressionParser &)=delete
ExpressionParsing
Namespace holding all the expression evaluation code.
Definition: ExpressionParser.h:26
ExpressionParsing::ExpressionParser::operator=
ExpressionParser & operator=(const ExpressionParser &)=delete
ExpressionParsing::ExpressionParser::evaluateAsVector
std::vector< int > evaluateAsVector() const
Definition: ExpressionParser.cxx:118
ExpressionParsing::ExpressionParser::evaluateAsBool
bool evaluateAsBool() const
Definition: ExpressionParser.cxx:104
MultipleProxyLoader.h
ExpressionParsing::ExpressionParser::ExpressionParser
ExpressionParser()
Definition: ExpressionParser.cxx:21
ExpressionParsing::ExpressionParser::evaluateAsDouble
double evaluateAsDouble() const
Definition: ExpressionParser.cxx:111
ExpressionParsing::StackElement
Class describing a single element in a text expression.
Definition: StackElement.h:50
ReadDecorHandle.h
Handle class for reading a decoration on an object.
ExpressionParsing::ExpressionParser
Definition: ExpressionParser.h:30
ExpressionParsing::ExpressionParser::m_code
std::vector< StackElement > m_code
Definition: ExpressionParser.h:54
IProxyLoader.h
ExpressionParsing::ExpressionParser::m_vm
VirtualMachine * m_vm
Definition: ExpressionParser.h:55
ExpressionParsing::ExpressionParser::setup
void setup()
Definition: ExpressionParser.cxx:56
IUnitInterpreter.h
ExpressionParsing::ExpressionParser::m_unitInterpreter
IUnitInterpreter * m_unitInterpreter
Definition: ExpressionParser.h:53