SeExpr

Classes | Public Member Functions | Private Attributes | List of all members
SeExpr2::ExprFuncNode Class Reference

Node that calls a function. More...

`#include <ExprNode.h>`

Inheritance diagram for SeExpr2::ExprFuncNode:

## Classes
struct | Data
| base class for custom instance data More...

## Public Member Functions
| ExprFuncNode (const Expression *expr, const char *name)
virtual | ~ExprFuncNode ()
virtual ExprType | prep (bool wantScalar, ExprVarEnvBuilder &envBuilder)
virtual int | buildInterpreter (Interpreter *interpreter) const
| builds an interpreter. Returns the location index for the evaluated data More...
virtual LLVM_VALUE | codegen (LLVM_BUILDER) LLVM_BODY
const char * | name () const
bool | checkArg (int argIndex, ExprType type, ExprVarEnvBuilder &envBuilder)
bool | isStrArg (int n) const
std::string | getStrArg (int n) const
void | setData (Data *data) const
| associate blind data with this node (subsequently owned by this object) More...
Data * | getData () const
| get associated blind data (returns 0 if none) More...
int | promote (int i) const
const ExprFunc * | func () const
Public Member Functions inherited from SeExpr2::ExprNode
| ExprNode (const Expression *expr)
| ExprNode (const Expression *expr, const ExprType &type)
virtual | ~ExprNode ()
bool | isVec () const
| True if node has a vector result. More...
const Expression * | expr () const
| Access expression. More...
std::string | toString () const
| Access to original string representation of current expression. More...
const ExprType & | type () const
| The type of the node. More...
void | addError (const std::string &error) const
| Register error. This will allow users and sophisticated editors to highlight where in code problem was. More...
| ExprNode (const Expression *expr, ExprNode *a)
| ExprNode (const Expression *expr, ExprNode *a, const ExprType &type)
| ExprNode (const Expression *expr, ExprNode *a, ExprNode *b)
| ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, const ExprType &type)
| ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, ExprNode *c)
| ExprNode (const Expression *expr, ExprNode *a, ExprNode *b, ExprNode *c, const ExprType &type)
const ExprNode * | parent () const
| Access parent node - root node has no parent. More...
int | numChildren () const
| Number of children. More...
const ExprNode * | child (size_t i) const
| Get 0 indexed child. More...
ExprNode * | child (size_t i)
| Get 0 indexed child. More...
void | swapChildren (size_t i, size_t j)
| Swap children, do not use unless you know what you are doing. More...
void | removeLastChild ()
| Remove last child and delete the entry. More...
void | addChild (ExprNode *child)
| Add a child to the child list (for parser use only) More...
void | addChildren (ExprNode *surrogate)
| Transfer children from surrogate parent (for parser use only) More...
void | setPosition (const short int startPos, const short int endPos)
| Remember the line and column position in the input string. More...
short int | startPos () const
| Access start position in input string. More...
short int | endPos () const
| Access end position in input string. More...
short int | length () const
| Access length of input string. More...
bool | checkCondition (bool check, const std::string &message, bool &error)
| Checks the boolean value and records an error string with node if it is false. More...
bool | checkIsValue (const ExprType &type, bool &error)
| Checks if the type is a value (i.e. string or float[d]) More...
bool | checkIsFP (const ExprType &type, bool &error)
| Checks if the type is a float[d] for any d. More...
bool | checkIsFP (int d, const ExprType &type, bool &error)
| Checks if the type is a float[d] for a specific d. More...
bool | checkTypesCompatible (const ExprType &first, const ExprType &second, bool &error)
| types match (true if they do) More...

## Private Attributes
std::string | _name
const ExprFunc * | _func
const ExprLocalFunctionNode * | _localFunc
std::vector< int > | _promote
Data * | _data

## Additional Inherited Members
Protected Member Functions inherited from SeExpr2::ExprNode
void | setType (const ExprType &t)
| Set type of parameter. More...
void | setTypeWithChildLife (const ExprType &t)
| Set's the type to the argument but uses the children to determine lifetime. More...
Protected Attributes inherited from SeExpr2::ExprNode
const Expression * | _expr
| Owning expression (node can't modify) More...
ExprNode * | _parent
| Parent node (null if this the the root) More...
std::vector< ExprNode * > | _children
| List of children. More...
bool | _isVec
| True if node has a vector result. More...
ExprType | _type
int | _maxChildDim
unsigned short int | _startPos
| Position line and collumn. More...
unsigned short int | _endPos

## Detailed Description

Node that calls a function.

Definition at line 517 of file ExprNode.h.

## Constructor & Destructor Documentation

## ◆ ExprFuncNode()

SeExpr2::ExprFuncNode::ExprFuncNode | ( | const Expression * | expr,
|  | const char * | name
| ) |  |
| inline

Definition at line 519 of file ExprNode.h.

References SeExpr2::Expression::addFunc(), SeExpr2::ExprNode::expr(), and name().

## ◆ ~ExprFuncNode()

virtual SeExpr2::ExprFuncNode::~ExprFuncNode | ( |  | ) |
| inline virtual

Definition at line 523 of file ExprNode.h.

References SeExpr2::ExprFuncNode::Data::_cleanup, and _data.

## Member Function Documentation

## ◆ buildInterpreter()

int SeExpr2::ExprFuncNode::buildInterpreter | ( | Interpreter * | interpreter | ) | const
| virtual

builds an interpreter. Returns the location index for the evaluated data

Reimplemented from SeExpr2::ExprNode.

Definition at line 568 of file ExprNode.cpp.

References _func, _localFunc, SeExpr2::ExprFuncX::buildInterpreter(), SeExpr2::ExprLocalFunctionNode::buildInterpreterForCall(), and SeExpr2::ExprFunc::funcx().

## ◆ checkArg()

bool SeExpr2::ExprFuncNode::checkArg | ( | int | argIndex,
|  | ExprType | type,
|  | ExprVarEnvBuilder & | envBuilder
| ) |  |

Definition at line 578 of file ExprNode.cpp.

References _promote, SeExpr2::ExprNode::addError(), SeExpr2::ExprNode::child(), SeExpr2::ExprType::dim(), SeExpr2::ExprType::isFP(), SeExpr2::ExprType::isLifeCompatible(), SeExpr2::ExprNode::prep(), SeExpr2::ExprType::toString(), SeExpr2::ExprNode::type(), and SeExpr2::ExprType::valuesCompatible().

Referenced by SeExpr2::RandFuncX::prep(), BasicExpression::DummyFuncX::prep(), SeExpr2::MapFuncX::prep(), SeExpr2::TriplanarFuncX::prep(), SeExpr2::ExprLocalFunctionNode::prep(), SeExpr2::CurveFuncX::prep(), SeExpr2::CCurveFuncX::prep(), SeExpr2::GetVar::prep(), and SeExpr2::PrintFuncX::prep().

## ◆ codegen()

virtual LLVM_VALUE SeExpr2::ExprFuncNode::codegen | ( | LLVM_BUILDER |  | ) |
| virtual

Reimplemented from SeExpr2::ExprNode.

## ◆ func()

const ExprFunc* SeExpr2::ExprFuncNode::func | ( |  | ) | const
| inline

Definition at line 591 of file ExprNode.h.

References _data.

Referenced by SeExpr2LLVMEvalCustomFunction().

## ◆ getData()

Data* SeExpr2::ExprFuncNode::getData | ( |  | ) | const
| inline

get associated blind data (returns 0 if none)

Definition at line 589 of file ExprNode.h.

## ◆ getStrArg()

std::string SeExpr2::ExprFuncNode::getStrArg | ( | int | n | ) | const
| inline

Definition at line 564 of file ExprNode.h.

References SeExpr2::ExprNode::child(), and SeExpr2::ExprNode::numChildren().

Referenced by SeExpr2::GetVar::prep().

## ◆ isStrArg()

bool SeExpr2::ExprFuncNode::isStrArg | ( | int | n | ) | const
| inline

Definition at line 563 of file ExprNode.h.

References SeExpr2::ExprNode::child().

## ◆ name()

const char* SeExpr2::ExprFuncNode::name | ( |  | ) | const
| inline

Definition at line 533 of file ExprNode.h.

References _name.

Referenced by ExprFuncNode().

## ◆ prep()

ExprType SeExpr2::ExprFuncNode::prep | ( | bool | dontNeedScalar,
|  | ExprVarEnvBuilder & | envBuilder
| ) |  |
| virtual

Prepare the node (for parser use only). See the discussion at the start of SeExprNode.cpp for more info.

Default is to call prep on children (giving AnyType as desired type). If all children return valid types, returns NoneType. Otherwise, returns ErrorType. Note: Ignores wanted type.

Reimplemented from SeExpr2::ExprNode.

Definition at line 533 of file ExprNode.cpp.

References SeExpr2::ExprNode::_expr, _func, _localFunc, _name, _promote, SeExpr2::ExprNode::_type, SeExpr2::ExprNode::checkCondition(), SeExpr2::ExprVarEnvBuilder::current(), SeExpr2::ExprVarEnv::findFunction(), SeExpr2::ExprFunc::funcx(), SeExpr2::ExprFunc::lookup(), SeExpr2::ExprFunc::maxArgs(), SeExpr2::ExprFunc::minArgs(), SeExpr2::ExprNode::numChildren(), SeExpr2::ExprFuncX::prep(), SeExpr2::ExprNode::prep(), SeExpr2::Expression::resolveFunc(), SeExpr2::ExprNode::setTypeWithChildLife(), and SeExpr2::ExprNode::type().

## ◆ promote()

int SeExpr2::ExprFuncNode::promote | ( | int | i | ) | const
| inline

Definition at line 590 of file ExprNode.h.

Referenced by SeExpr2::ExprFuncSimple::buildInterpreter(), and SeExpr2::ExprLocalFunctionNode::buildInterpreterForCall().

## ◆ setData()

void SeExpr2::ExprFuncNode::setData | ( | Data * | data | ) | const
| inline

associate blind data with this node (subsequently owned by this object)

Definition at line 583 of file ExprNode.h.

References _data.

Referenced by SeExpr2::ExprFuncSimple::buildInterpreter(), and SeExpr2LLVMEvalCustomFunction().

## Member Data Documentation

## ◆ _data

Data* SeExpr2::ExprFuncNode::_data
| mutable private

Definition at line 601 of file ExprNode.h.

Referenced by func(), setData(), and ~ExprFuncNode().

## ◆ _func

const ExprFunc* SeExpr2::ExprFuncNode::_func
| private

Definition at line 595 of file ExprNode.h.

Referenced by buildInterpreter(), and prep().

## ◆ _localFunc

const ExprLocalFunctionNode* SeExpr2::ExprFuncNode::_localFunc
| private

Definition at line 596 of file ExprNode.h.

Referenced by buildInterpreter(), and prep().

## ◆ _name

std::string SeExpr2::ExprFuncNode::_name
| private

Definition at line 594 of file ExprNode.h.

Referenced by name(), and prep().

## ◆ _promote

std::vector<int> SeExpr2::ExprFuncNode::_promote
| mutable private

Definition at line 600 of file ExprNode.h.

Referenced by checkArg(), and prep().

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

- /build/seexpr/src/SeExpr/src/SeExpr2/ExprNode.h
- /build/seexpr/src/SeExpr/src/SeExpr2/ExprNode.cpp