Drake
BinaryExpressionCell Class Referenceabstract

Detailed Description

Represents the base class for binary expressions.

#include <drake/common/symbolic_expression_cell.h>

Public Member Functions

void HashAppendDetail (DelegatingHasher *) const override
 Sends all hash-relevant bytes for this ExpressionCell type into the given hasher, per the hash_append generic hashing concept – except for get_kind(), because Expression already sends that. More...
 
Variables GetVariables () const override
 Collects variables in expression. More...
 
bool EqualTo (const ExpressionCell &e) const override
 Checks structural equality. More...
 
bool Less (const ExpressionCell &e) const override
 Provides lexicographical ordering between expressions. More...
 
double Evaluate (const Environment &env) const override
 Evaluates under a given environment (by default, an empty environment). More...
 
const Expressionget_first_argument () const
 Returns the first argument. More...
 
const Expressionget_second_argument () const
 Returns the second argument. More...
 
 BinaryExpressionCell ()=delete
 Default constructor (DELETED). More...
 
BinaryExpressionCelloperator= (BinaryExpressionCell &&e)=delete
 Move-assigns (DELETED). More...
 
BinaryExpressionCelloperator= (const BinaryExpressionCell &e)=delete
 Copy-assigns (DELETED). More...
 
- Public Member Functions inherited from ExpressionCell
ExpressionKind get_kind () const
 Returns expression kind. More...
 
bool is_polynomial () const
 Checks if this symbolic expression is convertible to Polynomial. More...
 
bool is_expanded () const
 Checks if this symbolic expression is already expanded. More...
 
void set_expanded ()
 Sets this symbolic expression as already expanded. More...
 
virtual Expression Expand () const =0
 Expands out products and positive integer powers in expression. More...
 
virtual Expression Substitute (const Substitution &s) const =0
 Returns an Expression obtained by replacing all occurrences of the variables in s in the current expression cell with the corresponding expressions in s. More...
 
virtual Expression Differentiate (const Variable &x) const =0
 Differentiates this symbolic expression with respect to the variable var. More...
 
virtual std::ostream & Display (std::ostream &os) const =0
 Outputs string representation of expression into output stream os. More...
 
ExpressionCelloperator= (ExpressionCell &&e)=delete
 Move-assigns (DELETED). More...
 
ExpressionCelloperator= (const ExpressionCell &e)=delete
 Copy-assigns (DELETED). More...
 

Protected Member Functions

 BinaryExpressionCell (BinaryExpressionCell &&e)=default
 Move-constructs from an rvalue. More...
 
 BinaryExpressionCell (const BinaryExpressionCell &e)=default
 Copy-constructs from an lvalue. More...
 
 BinaryExpressionCell (ExpressionKind k, Expression e1, Expression e2, bool is_poly, bool is_expanded)
 Constructs BinaryExpressionCell of kind k with e1, e2, is_poly, and is_expanded. More...
 
virtual double DoEvaluate (double v1, double v2) const =0
 Returns the evaluation result f(v1, v2 ). More...
 
- Protected Member Functions inherited from ExpressionCell
 ExpressionCell ()=default
 Default constructor. More...
 
 ExpressionCell (ExpressionCell &&e)=default
 Move-constructs an ExpressionCell from an rvalue. More...
 
 ExpressionCell (const ExpressionCell &e)=default
 Copy-constructs an ExpressionCell from an lvalue. More...
 
 ExpressionCell (ExpressionKind k, bool is_poly, bool is_expanded)
 Constructs ExpressionCell of kind k with is_poly and is_expanded. More...
 
virtual ~ExpressionCell ()=default
 Default destructor. More...
 

Constructor & Destructor Documentation

◆ BinaryExpressionCell() [1/4]

Default constructor (DELETED).

◆ BinaryExpressionCell() [2/4]

BinaryExpressionCell ( BinaryExpressionCell &&  e)
protecteddefault

Move-constructs from an rvalue.

◆ BinaryExpressionCell() [3/4]

BinaryExpressionCell ( const BinaryExpressionCell e)
protecteddefault

Copy-constructs from an lvalue.

◆ BinaryExpressionCell() [4/4]

BinaryExpressionCell ( ExpressionKind  k,
Expression  e1,
Expression  e2,
bool  is_poly,
bool  is_expanded 
)
protected

Constructs BinaryExpressionCell of kind k with e1, e2, is_poly, and is_expanded.

Member Function Documentation

◆ DoEvaluate()

virtual double DoEvaluate ( double  v1,
double  v2 
) const
protectedpure virtual

Returns the evaluation result f(v1, v2 ).

◆ EqualTo()

bool EqualTo ( const ExpressionCell c) const
overridevirtual

Checks structural equality.

Implements ExpressionCell.

◆ Evaluate()

double Evaluate ( const Environment env) const
overridevirtual

Evaluates under a given environment (by default, an empty environment).

Exceptions
std::runtime_errorif NaN is detected during evaluation.

Implements ExpressionCell.

◆ get_first_argument()

const Expression& get_first_argument ( ) const

Returns the first argument.

◆ get_second_argument()

const Expression& get_second_argument ( ) const

Returns the second argument.

◆ GetVariables()

Variables GetVariables ( ) const
overridevirtual

Collects variables in expression.

Implements ExpressionCell.

◆ HashAppendDetail()

void HashAppendDetail ( DelegatingHasher ) const
overridevirtual

Sends all hash-relevant bytes for this ExpressionCell type into the given hasher, per the hash_append generic hashing concept – except for get_kind(), because Expression already sends that.

Implements ExpressionCell.

◆ Less()

bool Less ( const ExpressionCell c) const
overridevirtual

Provides lexicographical ordering between expressions.

Implements ExpressionCell.

◆ operator=() [1/2]

BinaryExpressionCell& operator= ( BinaryExpressionCell &&  e)
delete

Move-assigns (DELETED).

◆ operator=() [2/2]

BinaryExpressionCell& operator= ( const BinaryExpressionCell e)
delete

Copy-assigns (DELETED).


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