OpendTect  7.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Math::Expression Class Referenceabstract

Parsed Math expression. More...

Public Types

enum  VarType { Variable , Constant , Recursive }
 

Public Member Functions

virtual ~Expression ()
 
virtual Expressionclone () const =0
 
void dump (BufferString &str) const
 
int firstOccurVarName (const char *) const
 
virtual const char * fullVariableExpression (int) const
 
int getConstIdx (int varidx) const
 
VarType getType (int varidx) const
 
virtual double getValue () const =0
 
int indexOfUnVarName (const char *nm) const
 
bool isRecursive () const
 
int nrLevels () const
 
int nrUniqueVarNames () const
 
virtual int nrVariables () const
 
virtual void setVariableValue (int, double)
 
const char * type () const
 
const char * uniqueVarName (int idx) const
 

Protected Member Functions

 Expression (int nrinputs)
 
void addIfOK (const char *)
 
void copyInput (Expression *target) const
 
void doDump (BufferString &, int nrtabs) const
 
virtual void dumpSpecifics (BufferString &, int nrtabs) const
 
int nrInputs () const
 
bool setInput (int, Expression *)
 

Protected Attributes

ObjectSet< Expressioninputs_
 
bool isrecursive_
 
ObjectSet< TypeSet< int > > variablenr_
 
ObjectSet< TypeSet< int > > variableobj_
 
BufferStringSet varnms_
 

Friends

class ExpressionParser
 

Detailed Description

Parsed Math expression.

A Expression can be queried about its variables with getNrVariables(), and each variable's name can be queried with getVariableStr( int ).

When a calculations should be done, all variables must be set with setVariable( int, double ). Then, the calculation can be done with getValue().

Member Enumeration Documentation

◆ VarType

Enumerator
Variable 
Constant 
Recursive 

Constructor & Destructor Documentation

◆ ~Expression()

virtual Math::Expression::~Expression ( )
virtual

◆ Expression()

Math::Expression::Expression ( int  nrinputs)
protected

Member Function Documentation

◆ addIfOK()

void Math::Expression::addIfOK ( const char *  )
protected

◆ clone()

virtual Expression* Math::Expression::clone ( ) const
pure virtual

◆ copyInput()

void Math::Expression::copyInput ( Expression target) const
protected

◆ doDump()

void Math::Expression::doDump ( BufferString ,
int  nrtabs 
) const
protected

◆ dump()

void Math::Expression::dump ( BufferString str) const
inline

◆ dumpSpecifics()

virtual void Math::Expression::dumpSpecifics ( BufferString ,
int  nrtabs 
) const
inlineprotectedvirtual

◆ firstOccurVarName()

int Math::Expression::firstOccurVarName ( const char *  ) const

◆ fullVariableExpression()

virtual const char* Math::Expression::fullVariableExpression ( int  ) const
virtual

◆ getConstIdx()

int Math::Expression::getConstIdx ( int  varidx) const

◆ getType()

VarType Math::Expression::getType ( int  varidx) const

◆ getValue()

virtual double Math::Expression::getValue ( ) const
pure virtual

◆ indexOfUnVarName()

int Math::Expression::indexOfUnVarName ( const char *  nm) const
inline

◆ isRecursive()

bool Math::Expression::isRecursive ( ) const
inline

◆ nrInputs()

int Math::Expression::nrInputs ( ) const
inlineprotected

◆ nrLevels()

int Math::Expression::nrLevels ( ) const

◆ nrUniqueVarNames()

int Math::Expression::nrUniqueVarNames ( ) const
inline

◆ nrVariables()

virtual int Math::Expression::nrVariables ( ) const
virtual

◆ setInput()

bool Math::Expression::setInput ( int  ,
Expression  
)
protected

◆ setVariableValue()

virtual void Math::Expression::setVariableValue ( int  ,
double   
)
virtual

◆ type()

const char* Math::Expression::type ( ) const

◆ uniqueVarName()

const char* Math::Expression::uniqueVarName ( int  idx) const
inline

Friends And Related Function Documentation

◆ ExpressionParser

friend class ExpressionParser
friend

Member Data Documentation

◆ inputs_

ObjectSet<Expression> Math::Expression::inputs_
protected

◆ isrecursive_

bool Math::Expression::isrecursive_
protected

◆ variablenr_

ObjectSet<TypeSet<int> > Math::Expression::variablenr_
protected

◆ variableobj_

ObjectSet<TypeSet<int> > Math::Expression::variableobj_
protected

◆ varnms_

BufferStringSet Math::Expression::varnms_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024