ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Evaluator.cc File Reference
#include "CLHEP/Evaluator/Evaluator.h"
#include <iostream>
#include <sstream>
#include <cmath>
#include "CLHEP/Evaluator/stack.icc"
#include "CLHEP/Evaluator/string.icc"
#include "CLHEP/Evaluator/hash_map.icc"
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
+ Include dependency graph for Evaluator.cc:

Go to the source code of this file.

Classes

struct  Item
 
struct  Struct
 

Namespaces

namespace  HepTool
 

Macros

#define EVAL   HepTool::Evaluator
 
#define REMOVE_BLANKS
 
#define SKIP_BLANKS
 
#define EVAL_EXIT(STATUS, POSITION)   endp = POSITION; return STATUS
 
#define MAX_N_PAR   5
 

Typedefs

typedef void(* voidfuncptr )()
 
typedef char * pchar
 
typedef hash_map< string, Itemdic_type
 

Enumerations

enum  {
  ENDL, LBRA, OR, AND,
  EQ, NE, GE, GT,
  LE, LT, PLUS, MINUS,
  UNARY_PLUS, UNARY_MINUS, MULT, DIV,
  POW, RBRA, VALUE
}
 

Functions

static int engine (pchar, pchar, double &, pchar &, const dic_type &)
 
static int variable (const string &name, double &result, const dic_type &dictionary)
 
static int function (const string &name, stack< double > &par, double &result, const dic_type &dictionary)
 
static int operand (pchar begin, pchar end, double &result, pchar &endp, const dic_type &dictionary)
 
static int maker (int op, stack< double > &val)
 
static void setItem (const char *prefix, const char *name, const Item &item, Struct *s)
 

Variables

static const char sss [MAX_N_PAR+2] = "012345"
 

Macro Definition Documentation

#define EVAL   HepTool::Evaluator

Definition at line 48 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 48 of file Evaluator.cc

#define EVAL_EXIT (   STATUS,
  POSITION 
)    endp = POSITION; return STATUS

Definition at line 60 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 60 of file Evaluator.cc

Referenced by operand().

#define MAX_N_PAR   5

Definition at line 61 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 61 of file Evaluator.cc

Referenced by HepTool::Evaluator::findFunction(), function(), and HepTool::Evaluator::removeFunction().

#define REMOVE_BLANKS
Value:
for(pointer=name;;pointer++) if (!isspace(*pointer)) break; \
for(n=strlen(pointer);n>0;n--) if (!isspace(*(pointer+n-1))) break

Definition at line 50 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 50 of file Evaluator.cc

Referenced by HepTool::Evaluator::findFunction(), HepTool::Evaluator::findVariable(), HepTool::Evaluator::removeFunction(), HepTool::Evaluator::removeVariable(), and setItem().

#define SKIP_BLANKS
Value:
for(;;pointer++) { \
c = (pointer > end) ? '\0' : *pointer; \
if (!isspace(c)) break; \
}

Definition at line 54 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 54 of file Evaluator.cc

Referenced by operand().

Typedef Documentation

typedef hash_map<string,Item> dic_type

Definition at line 37 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 37 of file Evaluator.cc

typedef char* pchar

Definition at line 36 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 36 of file Evaluator.cc

typedef void(* voidfuncptr)()

Definition at line 20 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 20 of file Evaluator.cc

Enumeration Type Documentation

anonymous enum
Enumerator:
ENDL 
LBRA 
OR 
AND 
EQ 
NE 
GE 
GT 
LE 
LT 
PLUS 
MINUS 
UNARY_PLUS 
UNARY_MINUS 
MULT 
DIV 
POW 
RBRA 
VALUE 

Definition at line 65 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 65 of file Evaluator.cc

Function Documentation

static int engine ( pchar  begin,
pchar  end,
double &  result,
pchar endp,
const dic_type dictionary 
)
static
static int function ( const string &  name,
stack< double > &  par,
double &  result,
const dic_type dictionary 
)
static

Definition at line 108 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 108 of file Evaluator.cc

References Item::function, MAX_N_PAR, G4InuclParticleNames::pp, and sss.

static int maker ( int  op,
stack< double > &  val 
)
static

Definition at line 285 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 285 of file Evaluator.cc

References AND, DIV, EQ, GE, GT, LE, LT, MINUS, MULT, NE, OR, PLUS, POW, UNARY_MINUS, UNARY_PLUS, and val2.

static int operand ( pchar  begin,
pchar  end,
double &  result,
pchar endp,
const dic_type dictionary 
)
static

Definition at line 163 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 163 of file Evaluator.cc

References c, engine, EVAL_EXIT, pos(), SKIP_BLANKS, and variable().

Referenced by any_cast(), G4MultiUnion::CreatePolyhedron(), and G4BooleanSolid::StackPolyhedron().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void setItem ( const char *  prefix,
const char *  name,
const Item item,
Struct s 
)
static

Definition at line 551 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 551 of file Evaluator.cc

References n, REMOVE_BLANKS, Struct::theDictionary, and Struct::theStatus.

Referenced by HepTool::Evaluator::setFunction(), and HepTool::Evaluator::setVariable().

+ Here is the caller graph for this function:

static int variable ( const string &  name,
double &  result,
const dic_type dictionary 
)
static

Definition at line 70 of file Evaluator.cc.

View newest version in sPHENIX GitHub at line 70 of file Evaluator.cc

References engine, Item::EXPRESSION, Item::expression, Item::VARIABLE, Item::variable, and Item::what.

Referenced by operand().

+ Here is the caller graph for this function:

Variable Documentation