CMS 3D CMS Logo

formulaEvaluatorBase.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_formulaEvaluatorBase_h
2 #define CommonTools_Utils_formulaEvaluatorBase_h
3 // -*- C++ -*-
4 //
5 // Package: CommonTools/Utils
6 // Class : reco::formula::EvaluatorBase
7 //
18 //
19 // Original Author: Christopher Jones
20 // Created: Wed, 23 Sep 2015 16:26:00 GMT
21 //
22 
23 // system include files
24 
25 // user include files
26 
27 // forward declarations
28 
29 namespace reco {
30  namespace formula {
32  {
33 
34  public:
35  enum class Precedence {
36  kIdentity = 1,
37  kComparison=2,
38  kPlusMinus = 3,
39  kMultDiv = 4,
40  kPower = 5,
41  kFunction = 6, //default
42  kParenthesis = 7,
44  };
45 
46  EvaluatorBase();
48  virtual ~EvaluatorBase();
49 
50  // ---------- const member functions ---------------------
51  //inputs are considered to be 'arrays' which have already been validated to
52  // be of the appropriate length
53  virtual double evaluate(double const* iVariables, double const* iParameters) const = 0;
54 
55  unsigned int precedence() const { return m_precedence; }
56  void setPrecedenceToParenthesis() { m_precedence = static_cast<unsigned int>(Precedence::kParenthesis); }
57 
58  private:
59  EvaluatorBase(const EvaluatorBase&) = delete;
60 
61  const EvaluatorBase& operator=(const EvaluatorBase&) = delete;
62 
63  // ---------- member data --------------------------------
64  unsigned int m_precedence;
65  };
66  }
67 }
68 
69 
70 #endif
const EvaluatorBase & operator=(const EvaluatorBase &)=delete
virtual double evaluate(double const *iVariables, double const *iParameters) const =0
unsigned int precedence() const
fixed size matrix