HAPI::Expression Class Reference

Expression is the ancestor of all expression classes. More...

Inheritance diagram for HAPI::Expression:
HAPI::CompositeExpression HAPI::ConstantExpression HAPI::NodeExpression HAPI::AbsExpression HAPI::AddExpression HAPI::AndExpression HAPI::BetaDistribution HAPI::BinomialDistribution HAPI::CeilExpression HAPI::CosExpression HAPI::CoshExpression HAPI::DistributionDistribution HAPI::DivideExpression HAPI::EqualsExpression HAPI::ExpExpression HAPI::ExponentialDistribution HAPI::FloorExpression HAPI::GammaDistribution HAPI::GeometricDistribution HAPI::GreaterThanExpression HAPI::GreaterThanOrEqualsExpression HAPI::IfExpression HAPI::LessThanExpression HAPI::LessThanOrEqualsExpression HAPI::Log10Expression HAPI::Log2Expression HAPI::LogExpression HAPI::LogNormalDistribution HAPI::MaxExpression HAPI::MinExpression HAPI::ModExpression HAPI::MultiplyExpression HAPI::NegateExpression HAPI::NegativeBinomialDistribution HAPI::NoisyOrDistribution HAPI::NormalDistribution HAPI::NotEqualsExpression HAPI::NotExpression HAPI::OrExpression HAPI::PERTDistribution HAPI::PoissonDistribution HAPI::PowerExpression HAPI::SinExpression HAPI::SinhExpression HAPI::SqrtExpression HAPI::SubtractExpression HAPI::TanExpression HAPI::TanhExpression HAPI::TriangularDistribution HAPI::TruncateExpression HAPI::UniformDistribution HAPI::WeibullDistribution HAPI::BooleanExpression HAPI::LabelExpression HAPI::NumberExpression

List of all members.

Public Member Functions

virtual Expressionclone () const =0
 Clone this Expression.
 Expression (const Expression &exprSrc)
 Create a new expression from an existing expression.
virtual bool isCompositeExpression () const =0
 Test whether this Expression is an instance of CompositeExpression.
virtual bool isConstantExpression () const =0
 Test whether this Expression is an instance of ConstantExpression.
virtual bool isNodeExpression () const =0
 Test whether this Expression is an instance of NodeExpression.
Expressionoperator= (const Expression &rightExpr)
 Assignment operator.
std::string toString ()
 Return a string representation of this expression.

Static Public Member Functions

static ExpressionstringToExpression (const std::string &str, const Class &cls)
 Equivalent to stringToExpression (string, Domain) except that it takes a Class as second argument.
static ExpressionstringToExpression (const std::string &str, const Domain &dom)
 Create an Expression from a given string.

Detailed Description

Expression is the ancestor of all expression classes.

Expression classes are used to build expressions for discrete chance node tables and utility tables (see also class Model).


Constructor & Destructor Documentation

HAPI::Expression::Expression ( const Expression exprSrc  ) 

Create a new expression from an existing expression.

Parameters:
exprSrc the existing expression

Member Function Documentation

virtual Expression* HAPI::Expression::clone (  )  const [pure virtual]
static Expression* HAPI::Expression::stringToExpression ( const std::string &  str,
const Domain dom 
) [static]

Create an Expression from a given string.

To ease the creation of complex expressions, it is possible to specify these as strings, instead of building them with objects.

Example: The following code

Expression *result=new IfExpression (new BooleanExpression (true), new NumberExpression (1), new DistributionDistribution (new NumberExpression (1), new NumberExpression (2)));

can be written like this:

Expression *result = Expression::stringToExpression ("if (true, 1, Distribution (1,2)) ", domain);

Parameters:
str The string containing a textual representation of the expression
dom The domain in which the Expression is generated
std::string HAPI::Expression::toString (  ) 

Return a string representation of this expression.

Returns:
String describing the expression

Copyright Hugin Expert A/S 1993-2010