OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Expression Class Reference

#include <Expression.h>

Collaboration diagram for Expression:
Collaboration graph
[legend]

Public Member Functions

 Expression ()
 
 Expression (std::string expr)
 
 Expression (std::string expr, functionDictionary_t known_expr_funcs)
 
virtual ~Expression ()
 
std::set< std::string > getReqVars () const
 
std::set< std::string > getReqFuncs () const
 
std::string toString () const
 
functionDictionary_t getRegFuncs () const
 
Expressions::OperatorType_t getOpType () const
 get operator type present (if expression is constraint) More...
 
Expressions::Result_t evaluate (variableDictionary_t vars)
 evaluate an expression given a value dictionary of free variables More...
 

Private Types

typedef std::string::const_iterator iterator_type
 

Private Member Functions

void determineConstrOperator ()
 
void parse ()
 

Private Attributes

client::ast::expression ast_
 
std::set< std::string > vars_
 
std::set< std::string > funcs_
 
std::string expr_
 
functionDictionary_t known_expr_funcs_
 
Expressions::OperatorType_t type_
 

Detailed Description

Definition at line 94 of file Expression.h.

Member Typedef Documentation

◆ iterator_type

typedef std::string::const_iterator Expression::iterator_type
private

Definition at line 155 of file Expression.h.

Constructor & Destructor Documentation

◆ Expression() [1/3]

Expression::Expression ( )
inline

Definition at line 98 of file Expression.h.

◆ Expression() [2/3]

Expression::Expression ( std::string  expr)
inline

Definition at line 101 of file Expression.h.

References determineConstrOperator(), known_expr_funcs_, and parse().

Here is the call graph for this function:

◆ Expression() [3/3]

Expression::Expression ( std::string  expr,
functionDictionary_t  known_expr_funcs 
)
inline

Definition at line 110 of file Expression.h.

References determineConstrOperator(), known_expr_funcs_, and parse().

Here is the call graph for this function:

◆ ~Expression()

virtual Expression::~Expression ( )
inlinevirtual

Definition at line 120 of file Expression.h.

Member Function Documentation

◆ determineConstrOperator()

void Expression::determineConstrOperator ( )
inlineprivate

◆ evaluate()

Expressions::Result_t Expression::evaluate ( variableDictionary_t  vars)
inline

evaluate an expression given a value dictionary of free variables

Definition at line 133 of file Expression.h.

References ast_, end(), expr_, known_expr_funcs_, client::code_gen::StackEvaluator::registerFunctions(), client::code_gen::StackEvaluator::registerVariables(), and client::code_gen::StackEvaluator::result().

Referenced by Individual::checkConstraints(), and OpalSimulation::collectResults().

Here is the call graph for this function:

◆ getOpType()

Expressions::OperatorType_t Expression::getOpType ( ) const
inline

get operator type present (if expression is constraint)

Definition at line 130 of file Expression.h.

References type_.

◆ getRegFuncs()

functionDictionary_t Expression::getRegFuncs ( ) const
inline

Definition at line 127 of file Expression.h.

References known_expr_funcs_.

Referenced by OpalSimulation::collectResults().

◆ getReqFuncs()

std::set< std::string > Expression::getReqFuncs ( ) const
inline

Definition at line 125 of file Expression.h.

References funcs_.

◆ getReqVars()

std::set< std::string > Expression::getReqVars ( ) const
inline

Definition at line 124 of file Expression.h.

References vars_.

Referenced by Individual::checkConstraints(), and OpalSimulation::getVariableDictionary().

◆ parse()

void Expression::parse ( )
inlineprivate

Definition at line 186 of file Expression.h.

References ast_, end(), endl(), expr_, funcs_, client::code_gen::requirements::functions(), client::code_gen::requirements::variables(), and vars_.

Referenced by Expression().

Here is the call graph for this function:

◆ toString()

std::string Expression::toString ( ) const
inline

Definition at line 126 of file Expression.h.

References expr_.

Referenced by OpalSimulation::collectResults().

Member Data Documentation

◆ ast_

client::ast::expression Expression::ast_
private

Definition at line 156 of file Expression.h.

Referenced by evaluate(), and parse().

◆ expr_

std::string Expression::expr_
private

Definition at line 161 of file Expression.h.

Referenced by determineConstrOperator(), evaluate(), parse(), and toString().

◆ funcs_

std::set<std::string> Expression::funcs_
private

Definition at line 159 of file Expression.h.

Referenced by getReqFuncs(), and parse().

◆ known_expr_funcs_

functionDictionary_t Expression::known_expr_funcs_
private

Definition at line 162 of file Expression.h.

Referenced by evaluate(), Expression(), and getRegFuncs().

◆ type_

Expressions::OperatorType_t Expression::type_
private

Definition at line 164 of file Expression.h.

Referenced by determineConstrOperator(), and getOpType().

◆ vars_

std::set<std::string> Expression::vars_
private

Definition at line 158 of file Expression.h.

Referenced by getReqVars(), and parse().


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