CValue Class Reference
[Mathematical computations]

This class is the base class from which other classes are derived. More...

#include <compute.h>

Inheritance diagram for CValue:

CNumber COperation CVariable CAddition CCos CDivision CExp CLn COpposite CPow CProduct CSin CSqrt CSubstraction CTan

List of all members.

Public Types

enum  TYPE_VARIABLE { TYPE_X, TYPE_Y, TYPE_Z }

Public Member Functions

virtual CValueGetCopy () const =0
virtual float Compute (const CVector3f &) const =0
virtual CValueDerive (TYPE_VARIABLE Type) const =0
virtual void Print (std::ostream &) const =0
virtual void Compile (std::vector< char > &v, int &i) const =0
virtual ~CValue ()
virtual bool IsConstant (float *pNumber=NULL) const

Static Public Member Functions

static CValueGetNewAddition (CValue *pLeftOperand, CValue *pRightOperand)
static CValueGetNewSubstraction (CValue *pLeftOperand, CValue *pRightOperand)
static CValueGetNewProduct (CValue *pLeftOperand, CValue *pRightOperand)
static CValueGetNewDivision (CValue *pLeftOperand, CValue *pRightOperand)
static CValueGetNewOpposite (CValue *pLeftOperand)
static CValueGetNewSqrt (CValue *pLeftOperand)
static CValueGetNewSin (CValue *pLeftOperand)
static CValueGetNewCos (CValue *pLeftOperand)
static CValueGetNewTan (CValue *pLeftOperand)
static CValueGetNewExp (CValue *pLeftOperand)
static CValueGetNewLn (CValue *pLeftOperand)
static CValueGetNewPow (CValue *pLeftOperand, CValue *pRightOperand)

Protected Member Functions

virtual bool IsMultAbsorbElem () const
virtual bool IsMultNeutralElem () const
virtual bool IsAddNeutralElem () const


Detailed Description

This class is the base class from which other classes are derived.

By containing pointers to other CValue objects, it helps building a tree representing a mathematical expression.

Definition at line 34 of file compute.h.


Member Enumeration Documentation

enum CValue::TYPE_VARIABLE

This enum represents the variables x, y or z.

Enumerator:
TYPE_X 
TYPE_Y 
TYPE_Z 

Definition at line 40 of file compute.h.


Constructor & Destructor Documentation

virtual CValue::~CValue (  )  [inline, virtual]

Virtual desctructor (for inheritance).

Definition at line 76 of file compute.h.


Member Function Documentation

virtual CValue* CValue::GetCopy (  )  const [pure virtual]

This pure virtual function returns a copy of the tree represented by this object.

Implemented in COperation, CAddition, CSubstraction, CProduct, CDivision, COpposite, CSqrt, CSin, CCos, CTan, CExp, CLn, CPow, CVariable, and CNumber.

Referenced by CMathExpression::CMathExpression(), CLn::Derive(), CPow::Derive(), CExp::Derive(), CTan::Derive(), CCos::Derive(), CSin::Derive(), CSqrt::Derive(), CDivision::Derive(), CProduct::Derive(), CPow::GetCopy(), CLn::GetCopy(), CExp::GetCopy(), CTan::GetCopy(), CCos::GetCopy(), CSin::GetCopy(), CSqrt::GetCopy(), COpposite::GetCopy(), CDivision::GetCopy(), CProduct::GetCopy(), CSubstraction::GetCopy(), CAddition::GetCopy(), and CMathExpression::operator=().

virtual float CValue::Compute ( const CVector3f  )  const [pure virtual]

This pure virtual function returns the numerical value of the CValue object.

Implemented in COperation, CAddition, CSubstraction, CProduct, CDivision, COpposite, CSqrt, CSin, CCos, CTan, CExp, CLn, CPow, CVariable, and CNumber.

Referenced by CPow::Compute(), CLn::Compute(), CExp::Compute(), CTan::Compute(), CCos::Compute(), CSin::Compute(), CSqrt::Compute(), COpposite::Compute(), CDivision::Compute(), CProduct::Compute(), CSubstraction::Compute(), CAddition::Compute(), and CMathExpression::GetValue().

virtual CValue* CValue::Derive ( TYPE_VARIABLE  Type  )  const [pure virtual]

This pure virtual function returns a newly allocated pointer to the CValue object representing the derivative of the object.

Implemented in COperation, CAddition, CSubstraction, CProduct, CDivision, COpposite, CSqrt, CSin, CCos, CTan, CExp, CLn, CPow, CVariable, and CNumber.

Referenced by CLn::Derive(), CPow::Derive(), CExp::Derive(), CTan::Derive(), CCos::Derive(), CSin::Derive(), CSqrt::Derive(), COpposite::Derive(), CDivision::Derive(), CProduct::Derive(), CSubstraction::Derive(), CAddition::Derive(), and CMathExpression::GetDerivative().

virtual void CValue::Print ( std::ostream &   )  const [pure virtual]

This pure virtual function fills the stream with the expression of the CValue object.

Implemented in COperation, CAddition, CSubstraction, CProduct, CDivision, COpposite, CSqrt, CSin, CCos, CTan, CExp, CLn, CPow, CVariable, and CNumber.

Referenced by CMathExpression::GetString(), CPow::Print(), CLn::Print(), CExp::Print(), CTan::Print(), CCos::Print(), CSin::Print(), CSqrt::Print(), COpposite::Print(), CDivision::Print(), CProduct::Print(), CSubstraction::Print(), CAddition::Print(), and CMathExpression::Print().

virtual void CValue::Compile ( std::vector< char > &  v,
int &  i 
) const [pure virtual]

This pure virtual function fills the vector with code to compute the formula.

Implemented in COperation, CAddition, CSubstraction, CProduct, CDivision, COpposite, CSqrt, CSin, CCos, CTan, CExp, CLn, CPow, CVariable, and CNumber.

Referenced by CPow::Compile(), CLn::Compile(), CExp::Compile(), CTan::Compile(), CCos::Compile(), CSin::Compile(), CSqrt::Compile(), COpposite::Compile(), CDivision::Compile(), CProduct::Compile(), CSubstraction::Compile(), CAddition::Compile(), and CMathExpression::Compile().

virtual bool CValue::IsConstant ( float *  pNumber = NULL  )  const [inline, virtual]

This function is used to know if the object can be evaluated to a constant. It is overloaded only in the CNumber class, where Number is set to the value of the object.

Reimplemented in CNumber.

Definition at line 97 of file compute.h.

Referenced by CPow::Compile(), CPow::Derive(), GetNewAddition(), GetNewCos(), GetNewDivision(), GetNewExp(), GetNewLn(), GetNewOpposite(), GetNewPow(), GetNewProduct(), GetNewSin(), GetNewSqrt(), GetNewSubstraction(), and GetNewTan().

virtual bool CValue::IsMultAbsorbElem (  )  const [inline, protected, virtual]

This function is used to know if the object is the absorbing element of the multiplication, which is 0. It is overloaded only in the CNumber class.

Reimplemented in CNumber.

Definition at line 106 of file compute.h.

Referenced by GetNewDivision(), GetNewPow(), and GetNewProduct().

virtual bool CValue::IsMultNeutralElem (  )  const [inline, protected, virtual]

This function is used to know if the object is the neutral element of the multiplication, which is 1. It is overloaded only in the CNumber class.

Reimplemented in CNumber.

Definition at line 113 of file compute.h.

Referenced by GetNewDivision(), GetNewPow(), and GetNewProduct().

virtual bool CValue::IsAddNeutralElem (  )  const [inline, protected, virtual]

This function is used to know if the object is the neutral element of the addition, which is 0. It is overloaded only in the CNumber class.

Reimplemented in CNumber.

Definition at line 120 of file compute.h.

Referenced by GetNewAddition(), and GetNewSubstraction().


The documentation for this class was generated from the following files:
Generated on Fri Dec 5 03:20:33 2008 for Mathematical Ray-tracer by  doxygen 1.5.4