Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
Evaluator.h
이 파일의 문서화 페이지로 가기
1 // -*- C++ -*-
2 // $Id:$
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 */
static constexpr double kelvin
Definition: G4SIunits.hh:281
const XML_Char * name
Definition: expat.h:151
static constexpr double kilogram
Definition: G4SIunits.hh:177
bool findFunction(const char *name, int npar) const
Definition: Evaluator.cc:735
std::string error_name() const
Definition: Evaluator.cc:653
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 setFunction(const char *name, double(*fun)())
Definition: Evaluator.cc:699
static constexpr double second
Definition: G4SIunits.hh:157
const XML_Char int const XML_Char * value
Definition: expat.h:331
int status() const
Definition: Evaluator.cc:634
static constexpr double ampere
Definition: G4SIunits.hh:189
bool findVariable(const char *name) const
Definition: Evaluator.cc:724
void setVariable(const char *name, double value)
Definition: Evaluator.cc:690
int error_position() const
Definition: Evaluator.cc:639
static constexpr double meter
Definition: G4SIunits.hh:82
double evaluate(const char *expression)
Definition: Evaluator.cc:614
void print_error() const
Definition: Evaluator.cc:644
static constexpr double candela
Definition: G4SIunits.hh:317
void removeVariable(const char *name)
Definition: Evaluator.cc:746
void removeFunction(const char *name, int npar)
Definition: Evaluator.cc:755
static constexpr double mole
Definition: G4SIunits.hh:286
Evaluator & operator=(const Evaluator &)