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

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 
10 namespace HepTool {
11 
26 class Evaluator {
27  public:
28 
39  enum {
40  OK,
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 
256 private:
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 */
HepTool::Evaluator::findFunction
bool findFunction(const char *name, int npar) const
Definition: Evaluator.cc:733
HepTool::Evaluator::ERROR_SYNTAX_ERROR
@ ERROR_SYNTAX_ERROR
Definition: CLHEP/Evaluator/Evaluator.h:45
HepTool::Evaluator::ERROR_NOT_A_NAME
@ ERROR_NOT_A_NAME
Definition: CLHEP/Evaluator/Evaluator.h:44
HepTool::Evaluator::removeVariable
void removeVariable(const char *name)
Definition: Evaluator.cc:744
HepTool::Evaluator::Evaluator
Evaluator()
Definition: Evaluator.cc:597
HepTool::Evaluator::ERROR_CALCULATION_ERROR
@ ERROR_CALCULATION_ERROR
Definition: CLHEP/Evaluator/Evaluator.h:51
HepTool::Evaluator::~Evaluator
~Evaluator()
Definition: Evaluator.cc:607
HepTool::Evaluator::ERROR_UNEXPECTED_SYMBOL
@ ERROR_UNEXPECTED_SYMBOL
Definition: CLHEP/Evaluator/Evaluator.h:47
HepTool::Evaluator::status
int status() const
Definition: Evaluator.cc:632
HepTool::Evaluator::clear
void clear()
Definition: Evaluator.cc:763
HepTool::Evaluator::ERROR_UNKNOWN_VARIABLE
@ ERROR_UNKNOWN_VARIABLE
Definition: CLHEP/Evaluator/Evaluator.h:48
HepTool::Evaluator::WARNING_EXISTING_VARIABLE
@ WARNING_EXISTING_VARIABLE
Definition: CLHEP/Evaluator/Evaluator.h:41
HepTool::Evaluator::WARNING_EXISTING_FUNCTION
@ WARNING_EXISTING_FUNCTION
Definition: CLHEP/Evaluator/Evaluator.h:42
HepTool
Definition: CLHEP/Evaluator/Evaluator.h:10
HepTool::Evaluator::setVariable
void setVariable(const char *name, double value)
Definition: Evaluator.cc:688
HepTool::Evaluator::findVariable
bool findVariable(const char *name) const
Definition: Evaluator.cc:722
HepTool::Evaluator::error_name
std::string error_name() const
Definition: Evaluator.cc:651
HepTool::Evaluator::setFunction
void setFunction(const char *name, double(*fun)())
Definition: Evaluator.cc:697
HepTool::Evaluator::ERROR_EMPTY_PARAMETER
@ ERROR_EMPTY_PARAMETER
Definition: CLHEP/Evaluator/Evaluator.h:50
HepTool::Evaluator::setSystemOfUnits
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)
Definition: setSystemOfUnits.cc:10
HepTool::Evaluator::error_position
int error_position() const
Definition: Evaluator.cc:637
HepTool::Evaluator::OK
@ OK
Definition: CLHEP/Evaluator/Evaluator.h:40
HepTool::Evaluator::setStdMath
void setStdMath()
Definition: setStdMath.cc:31
HepTool::Evaluator::ERROR_UNKNOWN_FUNCTION
@ ERROR_UNKNOWN_FUNCTION
Definition: CLHEP/Evaluator/Evaluator.h:49
HepTool::Evaluator::evaluate
double evaluate(const char *expression)
Definition: Evaluator.cc:612
HepTool::Evaluator::print_error
void print_error() const
Definition: Evaluator.cc:642
name
user code seldom needs to call this function directly ZMerrno whether or not they are still recorded ZMerrno whether or not they are still since the user counter was last ZMerrno name() gives the(string) name of the latest recorded exception
HepTool::Evaluator::WARNING_BLANK_STRING
@ WARNING_BLANK_STRING
Definition: CLHEP/Evaluator/Evaluator.h:43
HepTool::Evaluator::ERROR_UNPAIRED_PARENTHESIS
@ ERROR_UNPAIRED_PARENTHESIS
Definition: CLHEP/Evaluator/Evaluator.h:46
HepTool::Evaluator::removeFunction
void removeFunction(const char *name, int npar)
Definition: Evaluator.cc:753