Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

base::Expression Class Reference

Inheritance diagram for base::Expression:

Inheritance graph
[legend]
Collaboration diagram for base::Expression:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Expression ()
 Expression (Real constant)
 Expression (const Expression &e)
 Expression (const String &exprString)
 construct from string - e.g. '2.3*cos(p[0])+p[2]/(4*p[1])'

virtual String className () const
Real evaluate (const Vector &params) const
Expression differentiate (Expression withRespectTo) const
void simplify ()
 simplify the expression (constant sub-expression evaluation, common sub-expression elimination etc.)

void operationCounts (Int &addsub, Int &multdiv, Int &trig) const
 calculate operation counts for evaluating the expression (added to args)

String toString () const
Expressionoperator= (const Expression &e)
Expressionoperator+= (const Expression &e)
Expressionoperator-= (const Expression &e)
Expressionoperator *= (const Expression &e)
Expressionoperator/= (const Expression &e)
Expressionnegate ()
Expressionsin ()
Expressioncos ()
virtual void serialize (Serializer &s)
 read or write object state to Serializer

virtual bool isSameKindAs (const Object &) const

Static Public Member Functions

template<class BaseClass, class DerivedClass> void registerSerializableInstantiator (const SerializableInstantiator &instantiator)
void registerSerializableInstantiator (const String &baseClassTypeName, const String &derivedClassTypeName, const SerializableInstantiator &instantiator)
template<class BaseClass> const SerializableInstantiator & getSerializableInstantiator (const String &derivedClassTypeName)
const SerializableInstantiator & getSerializableInstantiator (const String &baseClassTypeName, const String &derivedClassTypeName)

Static Public Attributes

VariableIndexer p
 p[i] is an Expression that evaluates to the variable params[i]


Protected Member Functions

 Expression (ref< ExpressionNode > expr)
ref< ExpressionNodesimplifyConstantExpressions (ref< ExpressionNode > expr)
 evaluate and replace constant expression subtrees with a single ConstantExpression


Static Protected Member Functions

bool peek (const String &s, Int pos, String next)
bool peek (const String &s, Int pos, String::value_type c)
SInt index (const String &s, Int &pos)
Real real (const String &s, Int &pos)
Expression expression (const String &s, Int &pos)
Expression term (const String &s, Int &pos)
Expression prod (const String &s, Int &pos)

Protected Attributes

ref< ExpressionNodeexpr
 root of ExpressionNode tree

Serializable::SerializableDerivedInstantiator<
SumExpression
sumInstantiator
Serializable::SerializableDerivedInstantiator<
DifferenceExpression
differenceInstantiator
Serializable::SerializableDerivedInstantiator<
ProductExpression
productInstantiator
Serializable::SerializableDerivedInstantiator<
QuotientExpression
quotientInstantiator
Serializable::SerializableDerivedInstantiator<
NegateExpression
negateInstantiator
Serializable::SerializableDerivedInstantiator<
SinExpression
sinInstantiator
Serializable::SerializableDerivedInstantiator<
CosExpression
cosInstantiator
Serializable::SerializableDerivedInstantiator<
ConstantExpression
constantInstantiator
Serializable::SerializableDerivedInstantiator<
VariableExpression
variableInstantiator

Friends

class VariableIndexer
void base::setIdentity (ExpressionMatrix &A)

Constructor & Destructor Documentation

base::Expression::Expression  ) 
 

base::Expression::Expression Real  constant  ) 
 

base::Expression::Expression const Expression e  ) 
 

base::Expression::Expression const String exprString  ) 
 

construct from string - e.g. '2.3*cos(p[0])+p[2]/(4*p[1])'

base::Expression::Expression ref< ExpressionNode expr  )  [inline, protected]
 

Definition at line 108 of file Expression.


Member Function Documentation

virtual String base::Expression::className  )  const [inline, virtual]
 

return the name of the object's class type. Must be defined by derived classes.

Implements base::Object.

Definition at line 82 of file Expression.

References base::String.

Expression& base::Expression::cos  ) 
 

Referenced by base::cos().

Expression base::Expression::differentiate Expression  withRespectTo  )  const
 

Real base::Expression::evaluate const Vector params  )  const
 

Referenced by base::ParametricTrajectoryRep::eval().

Expression base::Expression::expression const String s,
Int pos
[static, protected]
 

const SerializableInstantiator& base::Serializable::getSerializableInstantiator const String baseClassTypeName,
const String derivedClassTypeName
[static, inherited]
 

template<class BaseClass>
const SerializableInstantiator& base::Serializable::getSerializableInstantiator const String derivedClassTypeName  )  [inline, static, inherited]
 

Definition at line 71 of file Serializable.

References base::String.

SInt base::Expression::index const String s,
Int pos
[static, protected]
 

virtual bool base::Object::isSameKindAs const Object  )  const [inline, virtual, inherited]
 

Definition at line 47 of file Object.

Expression& base::Expression::negate  ) 
 

Referenced by base::operator-().

void base::Expression::operationCounts Int addsub,
Int multdiv,
Int trig
const
 

calculate operation counts for evaluating the expression (added to args)

Expression& base::Expression::operator *= const Expression e  ) 
 

Expression& base::Expression::operator+= const Expression e  ) 
 

Expression& base::Expression::operator-= const Expression e  ) 
 

Expression& base::Expression::operator/= const Expression e  ) 
 

Expression& base::Expression::operator= const Expression e  )  [inline]
 

Definition at line 96 of file Expression.

References expr.

bool base::Expression::peek const String s,
Int  pos,
String::value_type  c
[inline, static, protected]
 

Definition at line 118 of file Expression.

References base::Int, and base::String.

bool base::Expression::peek const String s,
Int  pos,
String  next
[static, protected]
 

Expression base::Expression::prod const String s,
Int pos
[static, protected]
 

Real base::Expression::real const String s,
Int pos
[static, protected]
 

void base::Serializable::registerSerializableInstantiator const String baseClassTypeName,
const String derivedClassTypeName,
const SerializableInstantiator instantiator
[static, inherited]
 

template<class BaseClass, class DerivedClass>
void base::Serializable::registerSerializableInstantiator const SerializableInstantiator instantiator  )  [inline, static, inherited]
 

Definition at line 62 of file Serializable.

virtual void base::Expression::serialize Serializer s  )  [virtual]
 

read or write object state to Serializer

Implements base::Serializable.

void base::Expression::simplify  ) 
 

simplify the expression (constant sub-expression evaluation, common sub-expression elimination etc.)

ref<ExpressionNode> base::Expression::simplifyConstantExpressions ref< ExpressionNode expr  )  [protected]
 

evaluate and replace constant expression subtrees with a single ConstantExpression

Expression& base::Expression::sin  ) 
 

Referenced by base::sin().

Expression base::Expression::term const String s,
Int pos
[static, protected]
 

String base::Expression::toString  )  const
 

Referenced by base::operator<<().


Friends And Related Function Documentation

void base::setIdentity ExpressionMatrix A  )  [friend]
 

friend class VariableIndexer [friend]
 

Definition at line 74 of file Expression.


Member Data Documentation

Serializable::SerializableDerivedInstantiator<ConstantExpression> base::Expression::constantInstantiator [protected]
 

Definition at line 136 of file Expression.

Serializable::SerializableDerivedInstantiator<CosExpression> base::Expression::cosInstantiator [protected]
 

Definition at line 135 of file Expression.

Serializable::SerializableDerivedInstantiator<DifferenceExpression> base::Expression::differenceInstantiator [protected]
 

Definition at line 130 of file Expression.

ref<ExpressionNode> base::Expression::expr [protected]
 

root of ExpressionNode tree

Definition at line 111 of file Expression.

Referenced by operator=().

Serializable::SerializableDerivedInstantiator<NegateExpression> base::Expression::negateInstantiator [protected]
 

Definition at line 133 of file Expression.

VariableIndexer base::Expression::p [static]
 

p[i] is an Expression that evaluates to the variable params[i]

Definition at line 94 of file Expression.

Serializable::SerializableDerivedInstantiator<ProductExpression> base::Expression::productInstantiator [protected]
 

Definition at line 131 of file Expression.

Serializable::SerializableDerivedInstantiator<QuotientExpression> base::Expression::quotientInstantiator [protected]
 

Definition at line 132 of file Expression.

Serializable::SerializableDerivedInstantiator<SinExpression> base::Expression::sinInstantiator [protected]
 

Definition at line 134 of file Expression.

Serializable::SerializableDerivedInstantiator<SumExpression> base::Expression::sumInstantiator [protected]
 

Definition at line 129 of file Expression.

Serializable::SerializableDerivedInstantiator<VariableExpression> base::Expression::variableInstantiator [protected]
 

Definition at line 137 of file Expression.


The documentation for this class was generated from the following file:
Generated on Thu Jul 29 16:38:34 2004 for OpenSim by doxygen 1.3.6