Planeshift
Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

MathExpression Class Reference

The base expression class. More...

#include <mathscript.h>

List of all members.

Classes

struct  PropertyRef

Public Member Functions

virtual double Evaluate (MathEnvironment *env) const
size_t GetOpcode () const
void SetOpcode (size_t newOpcode)
virtual ~MathExpression ()

Static Public Member Functions

static MathExpressionCreate (const char *expression, const char *name="")
 Empty destructor.

Protected Types

enum  {
  MATH_NONE = 0, MATH_COND = 1, MATH_EXP = 2, MATH_LOOP = 4,
  MATH_ASSIGN = 8, MATH_BREAK = 16, MATH_WHILE = MATH_COND | MATH_EXP | MATH_LOOP, MATH_IF = MATH_COND | MATH_EXP,
  MATH_ELSE = MATH_COND, MATH_DO = MATH_EXP | MATH_LOOP
}

Protected Member Functions

 MathExpression ()
bool Parse (const char *expression)

Protected Attributes

FunctionParser fp
const char * name
size_t opcode
csSet< PropertyRefpropertyRefs
 properties that have to be resolved prior to evaluation
csSet< csString > requiredObjs
 a subset of requiredVars which are known to be objects; for type checking
csSet< csString > requiredVars
 variables required to execute this expression

Detailed Description

The base expression class.

It is able to perform basic operations (e.g. "atan(a,b)") and also holds additional information about the type of the operator this expression represents. All other possible statements must derive from this.

Definition at line 330 of file mathscript.h.


Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
MATH_NONE 
MATH_COND 
MATH_EXP 
MATH_LOOP 
MATH_ASSIGN 
MATH_BREAK 
MATH_WHILE 
MATH_IF 
MATH_ELSE 
MATH_DO 

Definition at line 333 of file mathscript.h.


Constructor & Destructor Documentation

MathExpression::MathExpression ( ) [protected]
virtual MathExpression::~MathExpression ( ) [inline, virtual]

Definition at line 380 of file mathscript.h.


Member Function Documentation

static MathExpression* MathExpression::Create ( const char *  expression,
const char *  name = "" 
) [static]

Empty destructor.

virtual double MathExpression::Evaluate ( MathEnvironment env) const [virtual]

Reimplemented in MathStatement, EmptyMathStatement, and MathScript.

size_t MathExpression::GetOpcode ( ) const [inline]

Definition at line 385 of file mathscript.h.

bool MathExpression::Parse ( const char *  expression) [protected]
void MathExpression::SetOpcode ( size_t  newOpcode) [inline]

Definition at line 390 of file mathscript.h.


Member Data Documentation

FunctionParser MathExpression::fp [mutable, protected]

Definition at line 375 of file mathscript.h.

const char* MathExpression::name [protected]

Reimplemented in MathScript.

Definition at line 377 of file mathscript.h.

size_t MathExpression::opcode [protected]

Definition at line 348 of file mathscript.h.

properties that have to be resolved prior to evaluation

Definition at line 374 of file mathscript.h.

csSet<csString> MathExpression::requiredObjs [protected]

a subset of requiredVars which are known to be objects; for type checking

Definition at line 373 of file mathscript.h.

csSet<csString> MathExpression::requiredVars [protected]

variables required to execute this expression

Definition at line 372 of file mathscript.h.


The documentation for this class was generated from the following file: