Function.h
Go to the documentation of this file.
1 #ifndef _utl_Function_h_
2 #define _utl_Function_h_
3 
4 #include <string>
5 #include <vector>
6 
7 #include <utl/SymbolTable.h>
8 #include <utl/MathExpressionGrammar.h>
9 #include <utl/ExpressionParser.h>
10 #include <utl/AugerUnits.h>
11 
12 #include <utl/Branch.h>
13 
14 
15 namespace utl {
16 
27  class Function {
28  public:
29  Function() {}
30  Function(const std::string& function, const std::vector<std::string>& vars);
31  Function(const std::string& function, const std::string& var);
32 
33  const std::string& GetFunction() const { return fFunction; }
34 
36  const utl::SymbolTable& GetVariables() const { return fFunc.GetVariables(); }
37 
38  double operator()() const { return fFunc.Evaluate(fFunction); } // for convenience and special use
39  double operator()(const double& var) const;
40  double operator()(const std::vector<double>& vars) const;
41 
42 
43  //friend class utl::Branch; // only Branch is allowed to call default ctor
44 
45  private:
46  std::string fFunction;
47  std::vector<std::string> fVariableNames;
48  // mutable SymbolTable *fVariables;
50  };
51 
52 }
53 
54 
55 #endif
std::string fFunction
Definition: Function.h:46
double operator()() const
Definition: Function.h:38
FunctionParser fFunc
Definition: Function.h:49
const utl::SymbolTable & GetVariables() const
Definition: Function.h:36
std::map< std::string, double > SymbolTable
Definition: SymbolTable.h:10
std::vector< std::string > fVariableNames
Definition: Function.h:47
Evaluate functions given in a string. The real work is done by the ExpressionParser class...
Definition: Function.h:27
const std::string & GetFunction() const
Definition: Function.h:33
utl::SymbolTable & GetVariables()
Definition: Function.h:35
SymbolTable & GetVariables()

, generated on Tue Sep 26 2023.