CMS 3D CMS Logo

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