ATLAS Offline Software
Loading...
Searching...
No Matches
ExpressionEvaluator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef EXPRESSION_EVALUATOR_H
6#define EXPRESSION_EVALUATOR_H
7
8#include "CLHEP/Evaluator/Evaluator.h"
9
10#include <string>
11#include <vector>
12#include <map>
13
14namespace AGDD {
15
16typedef std::map< std::string, double> ConstantsTable;
17typedef std::map< std::string, double> PhysicalConstantsTable;
18typedef std::map< std::string, std::string> ExpressionsTable;
19
21{
22public:
25
26 bool RegisterConstant( std::string& c, double v );
27 bool RegisterPhysConstant( std::string&, const std::string&, const std::string& );
28 bool RegisterExpression( std::string& c, const std::string& v );
29 bool RegisterArray( std::string& c, const std::vector<double>& v );
30 bool RegisterVariable( const std::string& var_name, double value);
31
32 double EvaluateString(const std::string& str);
33 bool is_delimiter(char c);
34 bool is_real_variable(const std::string& var_name);
35 double Eval( const std::string& expr );
36 double Eval( const char* expr );
37
38 static std::string trim(const std::string&);
39 static std::vector<std::string> tokenize(const std::string&,const std::string&);
40
41 void setFileCurrentlyParsed(const std::string& set)
42 {
44 }
45
46private:
47 HepTool::Evaluator m_calc;
51 std::vector<std::string> m_real_vars;
52};
53
54} // namespace AGDD
55
56#endif // EXPRESSION_EVALUATOR_H
57
double EvaluateString(const std::string &str)
std::vector< std::string > m_real_vars
double Eval(const std::string &expr)
PhysicalConstantsTable m_PCTable
static std::vector< std::string > tokenize(const std::string &, const std::string &)
bool is_real_variable(const std::string &var_name)
bool RegisterVariable(const std::string &var_name, double value)
static std::string trim(const std::string &)
bool RegisterPhysConstant(std::string &, const std::string &, const std::string &)
bool RegisterArray(std::string &c, const std::vector< double > &v)
void setFileCurrentlyParsed(const std::string &set)
bool RegisterConstant(std::string &c, double v)
bool RegisterExpression(std::string &c, const std::string &v)
STL class.
std::map< std::string, double > PhysicalConstantsTable
std::map< std::string, double > ConstantsTable
std::map< std::string, std::string > ExpressionsTable