AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
autopas::RuleSyntax::BinaryOperator Struct Reference

A binary operator in the rule language. More...

#include <RuleBasedProgramTree.h>

Inheritance diagram for autopas::RuleSyntax::BinaryOperator:
Inheritance graph
[legend]
Collaboration diagram for autopas::RuleSyntax::BinaryOperator:
Collaboration graph
[legend]

Public Types

enum  Operator {
  LESS , GREATER , AND , OR ,
  ADD , SUB , MUL , DIV
}
 Enum of all binary operators.
 

Public Member Functions

 BinaryOperator (Operator op, std::shared_ptr< Expression > left, std::shared_ptr< Expression > right)
 Constructs a binary operator in the rule language.
 
Type getType () const override
 
void generateCode (CodeGenerationContext &context, RuleVM::Program &program) const override
 Generates code for evaluating this expression at runtime.
 
- Public Member Functions inherited from autopas::RuleSyntax::Expression
virtual ~Expression ()=default
 Virtual default constructor.
 
virtual Type getType () const =0
 
virtual void generateCode (CodeGenerationContext &context, RuleVM::Program &program) const =0
 Generates code for evaluating this expression at runtime.
 

Public Attributes

std::shared_ptr< Expressionleft
 The left subexpression of the operator.
 
Operator op
 The operator to apply.
 
std::shared_ptr< Expressionright
 The right subexpression of the operator.
 

Detailed Description

A binary operator in the rule language.

Constructor & Destructor Documentation

◆ BinaryOperator()

autopas::RuleSyntax::BinaryOperator::BinaryOperator ( BinaryOperator::Operator  op,
std::shared_ptr< Expression left,
std::shared_ptr< Expression right 
)

Constructs a binary operator in the rule language.

Parameters
op
left
right

Member Function Documentation

◆ generateCode()

void autopas::RuleSyntax::BinaryOperator::generateCode ( CodeGenerationContext context,
RuleVM::Program program 
) const
overridevirtual

Generates code for evaluating this expression at runtime.

Value is put on top of the stack. May consume part of the stack.

Parameters
contextThe context to generate the code in.
programThe program to append the code to.

Implements autopas::RuleSyntax::Expression.

◆ getType()

Type autopas::RuleSyntax::BinaryOperator::getType ( ) const
overridevirtual
Returns
the type of the expression.

Implements autopas::RuleSyntax::Expression.


The documentation for this struct was generated from the following files: