CMS 3D CMS Logo

ExpressionVar.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_ExpressionVar_h
2 #define CommonTools_Utils_ExpressionVar_h
3 
4 /* \class reco::parser::ExpressionVar
5  *
6  * Variable expression
7  *
8  * \author original version: Chris Jones, Cornell,
9  * adapted by Luca Lista, INFN
10  *
11  */
12 
16 
17 #include <vector>
18 
19 namespace reco {
20  namespace parser {
21 
23  class ExpressionVar : public ExpressionBase {
24  private: // Private Data Members
25  std::vector<MethodInvoker> methods_;
26  mutable std::vector<edm::ObjectWithDict> objects_;
27  mutable std::vector<bool> needsDestructor_;
29 
30  private: // Private Methods
31  void initObjects_();
32 
33  public: // Public Static Methods
35 
39 
43  static bool makeStorage(edm::ObjectWithDict& obj, const edm::TypeWithDict& retType);
44 
47  static void delStorage(edm::ObjectWithDict&);
48 
49  public: // Public Methods
50  ExpressionVar(const std::vector<MethodInvoker>& methods, method::TypeCode retType);
52  ~ExpressionVar() override;
53  double value(const edm::ObjectWithDict&) const override;
54  };
55 
59  private: // Private Data Members
60  std::vector<LazyInvoker> methods_;
61  mutable std::vector<edm::ObjectWithDict> objects_;
62 
63  public:
64  ExpressionLazyVar(const std::vector<LazyInvoker>& methods);
65  ~ExpressionLazyVar() override;
66  double value(const edm::ObjectWithDict&) const override;
67  };
68 
69  } // namespace parser
70 } // namespace reco
71 
72 #endif // CommonTools_Utils_ExpressionVar_h
static bool makeStorage(edm::ObjectWithDict &obj, const edm::TypeWithDict &retType)
std::vector< edm::ObjectWithDict > objects_
Definition: ExpressionVar.h:26
static double objToDouble(const edm::ObjectWithDict &obj, method::TypeCode type)
method::TypeCode retType_
Definition: ExpressionVar.h:28
ExpressionLazyVar(const std::vector< LazyInvoker > &methods)
ExpressionVar(const std::vector< MethodInvoker > &methods, method::TypeCode retType)
static bool isValidReturnType(method::TypeCode)
std::vector< MethodInvoker > methods_
Definition: ExpressionVar.h:25
double value(const edm::ObjectWithDict &) const override
static void delStorage(edm::ObjectWithDict &)
double value(const edm::ObjectWithDict &) const override
Evaluate an object&#39;s method or datamember (or chain of them) to get a number.
Definition: ExpressionVar.h:23
fixed size matrix
std::vector< edm::ObjectWithDict > objects_
Definition: ExpressionVar.h:61
std::vector< bool > needsDestructor_
Definition: ExpressionVar.h:27
std::vector< LazyInvoker > methods_
Definition: ExpressionVar.h:60