CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

CLHEP/Evaluator/Evaluator.h
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: Evaluator.h,v 1.2 2010/07/20 17:00:49 garren Exp $
3// ---------------------------------------------------------------------------
4
5#ifndef HEP_EVALUATOR_H
6#define HEP_EVALUATOR_H
7
8#include <string>
9
10namespace HepTool {
11
26class Evaluator {
27 public:
28
39 enum {
52 };
53
57 Evaluator();
58
62 ~Evaluator();
63
76 double evaluate(const char * expression);
77
81 int status() const;
82
86 int error_position() const;
87
91 void print_error() const;
95 std::string error_name() const;
96
105 void setVariable(const char * name, double value);
106
116 void setVariable(const char * name, const char * expression);
117
126 void setFunction(const char * name, double (*fun)());
127
136 void setFunction(const char * name, double (*fun)(double));
137
146 void setFunction(const char * name, double (*fun)(double,double));
147
156 void setFunction(const char * name, double (*fun)(double,double,double));
157
166 void setFunction(const char * name,
167 double (*fun)(double,double,double,double));
168
177 void setFunction(const char * name,
178 double (*fun)(double,double,double,double,double));
179
186 bool findVariable(const char * name) const;
187
195 bool findFunction(const char * name, int npar) const;
196
202 void removeVariable(const char * name);
203
210 void removeFunction(const char * name, int npar);
211
215 void clear();
216
220 void setStdMath();
221
248 void setSystemOfUnits(double meter = 1.0,
249 double kilogram = 1.0,
250 double second = 1.0,
251 double ampere = 1.0,
252 double kelvin = 1.0,
253 double mole = 1.0,
254 double candela = 1.0);
255
256private:
257 void * p; // private data
258 Evaluator(const Evaluator &); // copy constructor is not allowed
259 Evaluator & operator=(const Evaluator &); // assignment is not allowed
260};
261
262} // namespace HepTool
263
264#endif /* HEP_EVALUATOR_H */
int error_position() const
Definition: Evaluator.cc:637
bool findFunction(const char *name, int npar) const
Definition: Evaluator.cc:733
void setSystemOfUnits(double meter=1.0, double kilogram=1.0, double second=1.0, double ampere=1.0, double kelvin=1.0, double mole=1.0, double candela=1.0)
void print_error() const
Definition: Evaluator.cc:642
double evaluate(const char *expression)
Definition: Evaluator.cc:612
std::string error_name() const
Definition: Evaluator.cc:651
void removeVariable(const char *name)
Definition: Evaluator.cc:744
void removeFunction(const char *name, int npar)
Definition: Evaluator.cc:753
void setFunction(const char *name, double(*fun)())
Definition: Evaluator.cc:697
void setVariable(const char *name, double value)
Definition: Evaluator.cc:688
int status() const
Definition: Evaluator.cc:632
bool findVariable(const char *name) const
Definition: Evaluator.cc:722