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

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

#include <RuleBasedProgramTree.h>

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

Public Types

enum  Operator { NOT }
 Enum of all unary operators.
 

Public Member Functions

 UnaryOperator (Operator op, std::shared_ptr< Expression > child)
 Constructs an UnaryOperator.
 
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< Expressionchild
 Subexpression of unary operator.
 
Operator op
 Unary operator to apply.
 

Detailed Description

A unary operator in the rule language.

Constructor & Destructor Documentation

◆ UnaryOperator()

autopas::RuleSyntax::UnaryOperator::UnaryOperator ( UnaryOperator::Operator  op,
std::shared_ptr< Expression child 
)

Constructs an UnaryOperator.

Parameters
op
child

Member Function Documentation

◆ generateCode()

void autopas::RuleSyntax::UnaryOperator::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::UnaryOperator::getType ( ) const
overridevirtual
Returns
the type of the expression.

Implements autopas::RuleSyntax::Expression.


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