CMS 3D CMS Logo

ClhepEvaluator.h
Go to the documentation of this file.
1 #ifndef ClhepEvaluator_h
2 #define ClhepEvaluator_h
3 
4 #include <vector>
5 #include <string>
6 #include "CLHEP/Evaluator/Evaluator.h"
7 
9 public:
11 
13 
14  void set(const std::string& ns, const std::string& name, const std::string& exprValue);
15 
16  double eval(const std::string& ns, const std::string& expr);
17 
18  bool isDefined(const std::string& ns, //< current namespace
19  const std::string& name //< name of the variable inside current namespace
20  );
21 
23  const std::vector<std::string>& variables() const { return variables_; }
24  const std::vector<std::string>& values() const { return values_; }
25 
27 
28  double eval(const char* expression);
29 
31  void set(const std::string& name, const std::string& value);
32 
33  void clear();
34 
35 private:
36  void prepare(const std::string& ns, // input
37  const std::string& name, // input
38  const std::string& exprValue, // input
39  std::string& nameResult, // output
40  std::string& valResult) const; // output
41 
42  void throwex(const std::string& ns,
43  const std::string& name,
44  const std::string& expr,
45  const std::string& reason,
46  int idx = 0) const;
47 
48  void checkname(const std::string& name) const;
49 
50  HepTool::Evaluator evaluator_;
51  std::vector<std::string> variables_;
52  std::vector<std::string> values_;
53 };
54 
55 #endif
bool isDefined(const std::string &ns, const std::string &name)
std::vector< std::string > variables_
void prepare(const std::string &ns, const std::string &name, const std::string &exprValue, std::string &nameResult, std::string &valResult) const
void checkname(const std::string &name) const
std::vector< std::string > values_
const std::vector< std::string > & variables() const
access to the clhep-implementation of the dictionary variables
HepTool::Evaluator evaluator_
void throwex(const std::string &ns, const std::string &name, const std::string &expr, const std::string &reason, int idx=0) const
double eval(const std::string &ns, const std::string &expr)
const std::vector< std::string > & values() const