te::fe::BinaryOperator Class Referenceabstract

This class can be used to represent binary operation expressions. More...

#include <BinaryOperator.h>

Inheritance diagram for te::fe::BinaryOperator:
te::fe::Expression te::common::BaseVisitable< Visitor > te::fe::Add te::fe::Div te::fe::Mul te::fe::Sub

Public Types

typedef void ReturnType
 
typedef Visitor VisitorType
 

Public Member Functions

virtual ReturnType accept (VisitorType &guest) const=0
 It call the visit method from the guest object. More...
 
Initializer Methods

Methods related to instantiation and destruction.

 BinaryOperator (const char *opName=0)
 It initializes a new BinaryOperator. More...
 
 BinaryOperator (const char *opName, Expression *first, Expression *second)
 It initializes a new BinaryOperator. More...
 
virtual ~BinaryOperator ()
 Virtual destructor. More...
 
Accessor methods

Methods used to get or set properties.

const char * getName () const
 It returns the operator name. More...
 
void setFirst (Expression *first)
 It sets the first operand. More...
 
ExpressiongetFirst () const
 It returns the first operand. More...
 
void setSecond (Expression *second)
 It sets the second operand. More...
 
ExpressiongetSecond () const
 It returns the second operand. More...
 
Expression Re-implementation

Methods re-implemented from Expression.

virtual Expressionclone () const
 It returns a clone of this object. More...
 

Private Attributes

Expressionm_first
 First operand (an expression). (Mandatory) More...
 
const char * m_opName
 The operator name. (Mandatory) More...
 
Expressionm_second
 Second operand (an expression). (Mandatory) More...
 

Detailed Description

This class can be used to represent binary operation expressions.

The BinaryOperator class can be used to encode the fundamental arithmetic operations of addition, subtraction, multiplication and division. Arithmetic operators are binary operators meaning that they accept two arguments and evaluate to a single result.
The following operators are defined in the Filter Encoding specification:

Of course, you can extend the list of supported binary operators.

See also
Expression

Definition at line 66 of file BinaryOperator.h.

Member Typedef Documentation

◆ ReturnType

typedef void te::common::BaseVisitable< Visitor , void >::ReturnType
inherited

Definition at line 58 of file BaseVisitable.h.

◆ VisitorType

typedef Visitor te::common::BaseVisitable< Visitor , void >::VisitorType
inherited

Definition at line 57 of file BaseVisitable.h.

Constructor & Destructor Documentation

◆ BinaryOperator() [1/2]

te::fe::BinaryOperator::BinaryOperator ( const char *  opName = 0)

It initializes a new BinaryOperator.

Parameters
opNameThe operator name.
Note
The BinaryOperator will not take the ownership of the given name.

◆ BinaryOperator() [2/2]

te::fe::BinaryOperator::BinaryOperator ( const char *  opName,
Expression first,
Expression second 
)

It initializes a new BinaryOperator.

Parameters
opNameThe operator name.
firstThe first operand.
secondThe second operand.
Note
The BinaryOperator will not take the ownership of the given name.
It will take the ownership of the first and second operands.

◆ ~BinaryOperator()

virtual te::fe::BinaryOperator::~BinaryOperator ( )
virtual

Virtual destructor.

Member Function Documentation

◆ accept()

virtual ReturnType te::common::BaseVisitable< Visitor , void >::accept ( VisitorType guest) const
pure virtualinherited

It call the visit method from the guest object.

Parameters
guestThe guest or visitor.
Returns
Any valid value define by the template type R.

◆ clone()

virtual Expression* te::fe::BinaryOperator::clone ( ) const
virtual

It returns a clone of this object.

Returns
A clone of this object.

Implements te::fe::Expression.

◆ getFirst()

Expression* te::fe::BinaryOperator::getFirst ( ) const

It returns the first operand.

Returns
The first operand.

◆ getName()

const char* te::fe::BinaryOperator::getName ( ) const
inline

It returns the operator name.

Returns
The operator name.

Definition at line 114 of file BinaryOperator.h.

◆ getSecond()

Expression* te::fe::BinaryOperator::getSecond ( ) const

It returns the second operand.

Returns
The second operand.

◆ setFirst()

void te::fe::BinaryOperator::setFirst ( Expression first)

It sets the first operand.

Parameters
firstThe first operand.
Note
The binary operator will take the ownership of the first operand.

◆ setSecond()

void te::fe::BinaryOperator::setSecond ( Expression second)

It sets the second operand.

Parameters
secondThe second operand.
Note
It will take the ownership of the second operand.

Member Data Documentation

◆ m_first

Expression* te::fe::BinaryOperator::m_first
private

First operand (an expression). (Mandatory)

Definition at line 162 of file BinaryOperator.h.

◆ m_opName

const char* te::fe::BinaryOperator::m_opName
private

The operator name. (Mandatory)

Definition at line 161 of file BinaryOperator.h.

◆ m_second

Expression* te::fe::BinaryOperator::m_second
private

Second operand (an expression). (Mandatory)

Definition at line 163 of file BinaryOperator.h.


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