Public Member Functions | Protected Member Functions | Private Attributes
Sundance::BinaryExpr Class Reference

BinaryExpr is a base class for binary expressions, e.g., sums and products. More...

Inheritance diagram for Sundance::BinaryExpr:
Sundance::ExprWithChildren Sundance::EvaluatableExpr Sundance::ScalarExpr Sundance::EvaluatorFactory Sundance::FuncSetAccumulator Sundance::ObjectWithClassVerbosity< EvaluatableExpr > Sundance::ExprBase Sundance::DefaultObjectWithVerbosity Sundance::Handleable< ExprBase > Sundance::ObjectWithVerbosityBase Sundance::ProductExpr Sundance::SumExpr

List of all members.

Public Member Functions

 BinaryExpr (const RCP< ScalarExpr > &left, const RCP< ScalarExpr > &right, int sign)
 construct with left and right operands
virtual ~BinaryExpr ()
 virtual dtor
virtual std::ostream & toText (std::ostream &os, bool paren) const
 Write a simple text description suitable for output to a terminal.
virtual XMLObject toXML () const
 Write in XML.
Expr left () const
Expr right () const
int sign () const
const EvaluatableExpr * leftEvaluatable () const
 Downcast the left expr to an evaluatable expr.
const EvaluatableExpr * rightEvaluatable () const
 Downcast the right expr to an evaluatable expr.
const ScalarExpr * leftScalar () const
 Downcast the left expr to a scalar expr.
const ScalarExpr * rightScalar () const
 Downcast the right expr to a scalar expr.
virtual bool lessThan (const ScalarExpr *other) const
 Ordering operator for use in transforming exprs to standard form.

Protected Member Functions

virtual bool parenthesizeSelf () const =0
virtual bool parenthesizeOperands () const =0
virtual const std::string & xmlTag () const =0
virtual const std::string & opChar () const =0

Private Attributes

int sign_

Detailed Description

BinaryExpr is a base class for binary expressions, e.g., sums and products.

It provides a number of helper methods.

Definition at line 46 of file SundanceBinaryExpr.hpp.


Constructor & Destructor Documentation

BinaryExpr::BinaryExpr ( const RCP< ScalarExpr > &  left,
const RCP< ScalarExpr > &  right,
int  sign 
)

construct with left and right operands

Definition at line 41 of file SundanceBinaryExpr.cpp.

virtual Sundance::BinaryExpr::~BinaryExpr ( ) [inline, virtual]

virtual dtor

Definition at line 54 of file SundanceBinaryExpr.hpp.


Member Function Documentation

Expr Sundance::BinaryExpr::left ( ) const [inline]
const EvaluatableExpr* Sundance::BinaryExpr::leftEvaluatable ( ) const [inline]
const ScalarExpr* Sundance::BinaryExpr::leftScalar ( ) const [inline]
bool BinaryExpr::lessThan ( const ScalarExpr *  other) const [virtual]

Ordering operator for use in transforming exprs to standard form.

Reimplemented from Sundance::ExprWithChildren.

Definition at line 48 of file SundanceBinaryExpr.cpp.

References sign_.

virtual const std::string& Sundance::BinaryExpr::opChar ( ) const [protected, pure virtual]

Implemented in Sundance::ProductExpr, and Sundance::SumExpr.

Referenced by toText().

virtual bool Sundance::BinaryExpr::parenthesizeOperands ( ) const [protected, pure virtual]

Implemented in Sundance::ProductExpr, and Sundance::SumExpr.

Referenced by toText().

virtual bool Sundance::BinaryExpr::parenthesizeSelf ( ) const [protected, pure virtual]

Implemented in Sundance::ProductExpr, and Sundance::SumExpr.

Referenced by toText().

Expr Sundance::BinaryExpr::right ( ) const [inline]
const EvaluatableExpr* Sundance::BinaryExpr::rightEvaluatable ( ) const [inline]
const ScalarExpr* Sundance::BinaryExpr::rightScalar ( ) const [inline]
int Sundance::BinaryExpr::sign ( ) const [inline]
std::ostream & BinaryExpr::toText ( std::ostream &  os,
bool  paren 
) const [virtual]

Write a simple text description suitable for output to a terminal.

Implements Sundance::ExprBase.

Definition at line 58 of file SundanceBinaryExpr.cpp.

References Sundance::ScalarExpr::isHungryDiffOp(), leftScalar(), opChar(), parenthesizeOperands(), parenthesizeSelf(), rightScalar(), Sundance::Expr::showAllParens(), and Sundance::ExprBase::toText().

XMLObject BinaryExpr::toXML ( ) const [virtual]

Write in XML.

Implements Sundance::ExprBase.

Definition at line 77 of file SundanceBinaryExpr.cpp.

References left(), right(), and xmlTag().

virtual const std::string& Sundance::BinaryExpr::xmlTag ( ) const [protected, pure virtual]

Implemented in Sundance::ProductExpr, and Sundance::SumExpr.

Referenced by toXML().


Member Data Documentation

Definition at line 106 of file SundanceBinaryExpr.hpp.

Referenced by lessThan(), and sign().

Site Contact