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

Node that calls a function. More...

#include <ExprNode.h>

Inheritance diagram for KSeExpr::ExprFuncNode:
KSeExpr::ExprNode

Classes

struct  Data
 base class for custom instance data More...
 

Public Member Functions

 ExprFuncNode (const Expression *expr, const char *name)
 
 ExprFuncNode (const ExprFuncNode &)=default
 
ExprFuncNodeoperator= (const ExprFuncNode &)=default
 
 ExprFuncNode (ExprFuncNode &&)=default
 
ExprFuncNodeoperator= (ExprFuncNode &&)=default
 
 ~ExprFuncNode () override
 
ExprType prep (bool wantScalar, ExprVarEnvBuilder &envBuilder) override
 
int buildInterpreter (Interpreter *interpreter) const override
 builds an interpreter. Returns the location index for the evaluated data More...
 
LLVM_VALUE codegen (LLVM_BUILDER) LLVM_BODY
 
const char * name () const
 
bool checkArg (int argIndex, const 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...
 
DatagetData () const
 get associated blind data (returns 0 if none) More...
 
int promote (int i) const
 
const ExprFuncfunc () const
 
- Public Member Functions inherited from KSeExpr::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 Expressionexpr () const
 Access expression. More...
 
std::string toString () const
 Access to original string representation of current expression. More...
 
const ExprTypetype () const
 The type of the node. More...
 
void addError (const ErrorCode error, const std::vector< std::string > &ids={}) 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 ExprNodeparent () const
 Access parent node - root node has no parent. More...
 
int numChildren () const
 Number of children. More...
 
const ExprNodechild (size_t i) const
 Get 0 indexed child. More...
 
ExprNodechild (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...
 
unsigned short int startPos () const
 Access start position in input string. More...
 
unsigned short int endPos () const
 Access end position in input string. More...
 
unsigned short int length () const
 Access length of input string. More...
 
bool checkCondition (bool check, const ErrorCode message, const std::vector< std::string > &ids, bool &error) const
 Checks the boolean value and records an error string with node if it is false. More...
 
bool checkIsValue (const ExprType &type, bool &error) const
 Checks if the type is a value (i.e. string or float[d]) More...
 
bool checkIsFP (const ExprType &type, bool &error) const
 Checks if the type is a float[d] for any d. More...
 
bool checkIsFP (int d, const ExprType &type, bool &error) const
 Checks if the type is a float[d] for a specific d. More...
 
bool checkTypesCompatible (const ExprType &first, const ExprType &second, bool &error) const
 types match (true if they do) More...
 

Private Attributes

std::string _name
 
const ExprFunc_func {nullptr}
 
const ExprLocalFunctionNode_localFunc {nullptr}
 
std::vector< int > _promote
 
Data_data {nullptr}
 

Additional Inherited Members

- Protected Member Functions inherited from KSeExpr::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 KSeExpr::ExprNode
const Expression_expr {nullptr}
 Owning expression (node can't modify) More...
 
ExprNode_parent {nullptr}
 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 653 of file ExprNode.h.

Constructor & Destructor Documentation

◆ ExprFuncNode() [1/3]

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

Definition at line 656 of file ExprNode.h.

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

◆ ExprFuncNode() [2/3]

KSeExpr::ExprFuncNode::ExprFuncNode ( const ExprFuncNode )
default

◆ ExprFuncNode() [3/3]

KSeExpr::ExprFuncNode::ExprFuncNode ( ExprFuncNode &&  )
default

◆ ~ExprFuncNode()

KSeExpr::ExprFuncNode::~ExprFuncNode ( )
inlineoverride

Definition at line 667 of file ExprNode.h.

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

Member Function Documentation

◆ buildInterpreter()

int KSeExpr::ExprFuncNode::buildInterpreter ( Interpreter interpreter) const
overridevirtual

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

Reimplemented from KSeExpr::ExprNode.

Definition at line 620 of file ExprNode.cpp.

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

◆ checkArg()

bool KSeExpr::ExprFuncNode::checkArg ( int  argIndex,
const ExprType type,
ExprVarEnvBuilder envBuilder 
)

◆ codegen()

LLVM_VALUE KSeExpr::ExprFuncNode::codegen ( LLVM_BUILDER  )
virtual

Reimplemented from KSeExpr::ExprNode.

◆ func()

const ExprFunc* KSeExpr::ExprFuncNode::func ( ) const
inline

Definition at line 762 of file ExprNode.h.

References _func.

Referenced by KSeExprLLVMEvalCustomFunction().

◆ getData()

Data* KSeExpr::ExprFuncNode::getData ( ) const
inline

get associated blind data (returns 0 if none)

Definition at line 754 of file ExprNode.h.

References _data.

◆ getStrArg()

std::string KSeExpr::ExprFuncNode::getStrArg ( int  n) const
inline

◆ isStrArg()

bool KSeExpr::ExprFuncNode::isStrArg ( int  n) const
inline

Definition at line 711 of file ExprNode.h.

References KSeExpr::ExprNode::child().

◆ name()

const char* KSeExpr::ExprFuncNode::name ( ) const
inline

Definition at line 678 of file ExprNode.h.

References _name.

Referenced by ExprFuncNode().

◆ operator=() [1/2]

ExprFuncNode& KSeExpr::ExprFuncNode::operator= ( const ExprFuncNode )
default

◆ operator=() [2/2]

ExprFuncNode& KSeExpr::ExprFuncNode::operator= ( ExprFuncNode &&  )
default

◆ prep()

ExprType KSeExpr::ExprFuncNode::prep ( bool  dontNeedScalar,
ExprVarEnvBuilder envBuilder 
)
overridevirtual

◆ promote()

int KSeExpr::ExprFuncNode::promote ( int  i) const
inline

◆ setData()

void KSeExpr::ExprFuncNode::setData ( Data data) const
inline

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

Definition at line 744 of file ExprNode.h.

References _data.

Referenced by KSeExpr::ExprFuncSimple::buildInterpreter(), and KSeExprLLVMEvalCustomFunction().

Member Data Documentation

◆ _data

Data* KSeExpr::ExprFuncNode::_data {nullptr}
mutableprivate

Definition at line 775 of file ExprNode.h.

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

◆ _func

const ExprFunc* KSeExpr::ExprFuncNode::_func {nullptr}
private

Definition at line 769 of file ExprNode.h.

Referenced by buildInterpreter(), func(), and prep().

◆ _localFunc

const ExprLocalFunctionNode* KSeExpr::ExprFuncNode::_localFunc {nullptr}
private

Definition at line 770 of file ExprNode.h.

Referenced by buildInterpreter(), and prep().

◆ _name

std::string KSeExpr::ExprFuncNode::_name
private

Definition at line 768 of file ExprNode.h.

Referenced by name(), and prep().

◆ _promote

std::vector<int> KSeExpr::ExprFuncNode::_promote
mutableprivate

Definition at line 774 of file ExprNode.h.

Referenced by checkArg(), prep(), and promote().


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