AnimatLab  2
Test
StdUtils::CStdPostFixEval Class Reference

Standard post fix evaluation class. More...

#include <StdPostFixEval.h>

+ Collaboration diagram for StdUtils::CStdPostFixEval:

Public Member Functions

 CStdPostFixEval ()
 Default constructor. More...
 
virtual ~CStdPostFixEval ()
 Destructor. More...
 
void AddVariable (std::string strVarName)
 Adds a variable. More...
 
void Equation (std::string strVal)
 Sets the post-fix Equation. More...
 
std::string Equation ()
 Gets the post-fix equation. More...
 
void SetVariable (std::string strVarName, double dblVal)
 Sets the value of a variable. More...
 
double Solution ()
 Gets the solution. More...
 
double Solve ()
 Solves the equation using the defined variable values. More...
 

Protected Member Functions

void FillInVariables (CStdArray< std::string > &aryPostFix)
 Fill in variables. More...
 
CStdVariableFindVariable (std::string strVarName)
 Searches for the a variable with the specified name. More...
 
void GetParams (double &dblLeft, double &dblRight, int iNumParams)
 Gets the parameters. More...
 
void SavePostFixInArray (std::string &strEqu)
 Saves a post fix in array. More...
 

Protected Attributes

CStdArray< std::string > m_aryPostFix
 internal array used to store the equation parts.
 
CStdStack< double > m_aryStack
 Stack of equation parts.
 
CStdPtrArray< CStdVariablem_aryVariables
 Array of variables.
 
double m_dblSolution
 The double solution value.
 
std::string m_strEquation
 The post-fix equation.
 

Detailed Description

Standard post fix evaluation class.

This evaluates a post-fix equation.

Author
dcofer
Date
5/3/2011

Definition at line 19 of file StdPostFixEval.h.

Constructor & Destructor Documentation

StdUtils::CStdPostFixEval::CStdPostFixEval ( )

Default constructor.

Author
dcofer
Date
5/3/2011

Definition at line 18 of file StdPostFixEval.cpp.

References m_dblSolution.

StdUtils::CStdPostFixEval::~CStdPostFixEval ( )
virtual

Destructor.

Author
dcofer
Date
5/3/2011

Definition at line 29 of file StdPostFixEval.cpp.

Member Function Documentation

void StdUtils::CStdPostFixEval::AddVariable ( std::string  strVarName)

Adds a variable.

Author
dcofer
Date
5/3/2011
Parameters
strVarNameName of the variable.

Definition at line 81 of file StdPostFixEval.cpp.

References FindVariable(), m_aryVariables, and StdUtils::CStdVariable::m_strVariable.

Referenced by AnimatSim::ExternalStimuli::CurrentStimulus::CurrentEquation(), AnimatSim::ExternalStimuli::MotorStimulus::Equation(), AnimatSim::ExternalStimuli::PropertyControlStimulus::Equation(), and AnimatSim::ExternalStimuli::ExternalInputStimulus::InputEquation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void StdUtils::CStdPostFixEval::Equation ( std::string  strVal)

Sets the post-fix Equation.

Author
dcofer
Date
5/3/2011
Parameters
strValThe new equation.

Definition at line 64 of file StdPostFixEval.cpp.

References m_strEquation, SavePostFixInArray(), and StdUtils::Std_Replace().

Referenced by AnimatSim::ExternalStimuli::CurrentStimulus::CurrentEquation(), AnimatSim::ExternalStimuli::MotorStimulus::Equation(), AnimatSim::ExternalStimuli::PropertyControlStimulus::Equation(), and AnimatSim::ExternalStimuli::ExternalInputStimulus::InputEquation().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string StdUtils::CStdPostFixEval::Equation ( )

Gets the post-fix equation.

Author
dcofer
Date
5/3/2011
Returns
post-fix equation.

Definition at line 53 of file StdPostFixEval.cpp.

References m_strEquation.

void StdUtils::CStdPostFixEval::FillInVariables ( CStdArray< std::string > &  aryPostFix)
protected

Fill in variables.

Author
dcofer
Date
5/3/2011
Parameters
[in,out]aryPostFixThe post-fix array.

Definition at line 142 of file StdPostFixEval.cpp.

References FindVariable(), and StdUtils::CStdVariable::m_dblValue.

Referenced by Solve().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CStdVariable * StdUtils::CStdPostFixEval::FindVariable ( std::string  strVarName)
protected

Searches for the a variable with the specified name.

Author
dcofer
Date
5/3/2011
Parameters
strVarNameName of the variable.
Returns
Pointer to found variable.

Definition at line 120 of file StdPostFixEval.cpp.

References m_aryVariables, and StdUtils::CStdVariable::m_strVariable.

Referenced by AddVariable(), FillInVariables(), and SetVariable().

+ Here is the caller graph for this function:

void StdUtils::CStdPostFixEval::GetParams ( double &  dblLeft,
double &  dblRight,
int  iNumParams 
)
protected

Gets the parameters.

Author
dcofer
Date
5/3/2011
Parameters
[in,out]dblLeftThe double left.
[in,out]dblRightThe double right.
iNumParamsNumber of parameters.

Definition at line 332 of file StdPostFixEval.cpp.

References m_aryStack.

Referenced by Solve().

+ Here is the caller graph for this function:

void StdUtils::CStdPostFixEval::SavePostFixInArray ( std::string &  strEqu)
protected

Saves a post fix in array.

Author
dcofer
Date
5/3/2011
Parameters
[in,out]strEquThe equation.

Definition at line 297 of file StdPostFixEval.cpp.

References m_aryPostFix.

Referenced by Equation().

+ Here is the caller graph for this function:

void StdUtils::CStdPostFixEval::SetVariable ( std::string  strVarName,
double  dblVal 
)
double StdUtils::CStdPostFixEval::Solution ( )

Gets the solution.

Author
dcofer
Date
5/3/2011
Returns
solution of the equation.

Definition at line 42 of file StdPostFixEval.cpp.

References m_dblSolution.

double StdUtils::CStdPostFixEval::Solve ( )

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