philsupertramp/game-math
|
#include <Operator.h>
Public Member Functions | |
Function (const std::string &val, const std::function< double(double)> &fun) | |
Function (const std::string &val, const std::function< double(double, double)> &fun) | |
double | Evaluate () const override |
Public Member Functions inherited from Operator | |
Operator (const std::string &name, std::function< double(double, double)> fun, OperatorPriority operatorPriority) | |
Operator (const Operator &other) | |
double | Evaluate () const override |
Public Member Functions inherited from MathNode | |
MathNode (const std::string &val) | |
MathNode (const MathNode &other) | |
virtual double | Evaluate () const =0 |
std::string | GetString () const |
bool | operator== (MathNode *rhs) |
Additional Inherited Members | |
Public Attributes inherited from Operator | |
std::function< double(double, double)> | op |
Operator implementation, this will be evaluated during Evaluate calls. More... | |
OperatorPriority | priority |
Operator priority, used to create AST. More... | |
Public Attributes inherited from MathNode | |
bool | isNegative = false |
helper to determine whether a node is negated or not More... | |
bool | hasParentheses = false |
helper to determine if node is within parentheses More... | |
MathNodeType | type |
node type representation More... | |
NodeConnectionType | connectionType = NodeConnectionType::ConnectionType_Dual |
type of connection allowed for this node More... | |
std::shared_ptr< MathNode > | left = nullptr |
next node on left side More... | |
std::shared_ptr< MathNode > | right = nullptr |
next node on right side More... | |
char * | value {} |
char representation of value More... | |
Protected Attributes inherited from MathNode | |
size_t | valSize = 0 |
helper to store size of value More... | |
Function representation as node.
Current implementation represents single operand functions, like
\[ \sqrt{x} \quad \text{ or } \quad \log{x} \]
|
inline |
Single operand default constructor
val | string representation |
fun | single value evaluation function |
|
inline |
Two operand default constructor
val | string representation |
fun | two value evaluation function |
TODO: enable parsing for this kind of function!
|
inlineoverridevirtual |
evaluates op(left, right)
TODO: whenever enabled comment out. else if(connectionType == NodeConnectionType::ConnectionType_Dual) return op(left->Evaluate(), right->Evaluate());
Reimplemented from Operator.