philsupertramp/game-math
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
MathNode Class Referenceabstract

#include <MathNode.h>

Inheritance diagram for MathNode:
Operand Operator Number Symbolic Function

Public Member Functions

 MathNode (const std::string &val)
 
 MathNode (const MathNode &other)
 
virtual double Evaluate () const =0
 
std::string GetString () const
 
bool operator== (MathNode *rhs)
 

Public Attributes

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< MathNodeleft = nullptr
 next node on left side More...
 
std::shared_ptr< MathNoderight = nullptr
 next node on right side More...
 
char * value {}
 char representation of value More...
 

Protected Attributes

size_t valSize = 0
 helper to store size of value More...
 

Friends

bool operator== (const MathNode &lhs, const MathNode &rhs)
 
std::ostream & operator<< (std::ostream &ostr, const MathNode &other)
 
std::ostream & operator<< (std::ostream &ostr, MathNode *other)
 

Detailed Description

Base node type of Abstract syntax tree implementation

Constructor & Destructor Documentation

◆ MathNode() [1/2]

MathNode::MathNode ( const std::string &  val)
inlineexplicit

Default constructor

Parameters
val

◆ MathNode() [2/2]

MathNode::MathNode ( const MathNode other)
inline

Copy constructor

Parameters
other

Member Function Documentation

◆ Evaluate()

virtual double MathNode::Evaluate ( ) const
pure virtual

Interface function for evaluation of node, needs to be implemented to add new type of node

Returns

Implemented in Symbolic, Number, Operator, and Function.

◆ GetString()

std::string MathNode::GetString ( ) const
inline

Getter for string representation of node

Returns

◆ operator==()

bool MathNode::operator== ( MathNode rhs)
inline

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream &  ostr,
const MathNode other 
)
friend

beautified output operator

Parameters
ostr
other
Returns

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream &  ostr,
MathNode other 
)
friend

beautified output operator

Parameters
ostr
other
Returns

◆ operator==

bool operator== ( const MathNode lhs,
const MathNode rhs 
)
friend

Member Data Documentation

◆ connectionType

NodeConnectionType MathNode::connectionType = NodeConnectionType::ConnectionType_Dual

type of connection allowed for this node

◆ hasParentheses

bool MathNode::hasParentheses = false

helper to determine if node is within parentheses

◆ isNegative

bool MathNode::isNegative = false

helper to determine whether a node is negated or not

◆ left

std::shared_ptr<MathNode> MathNode::left = nullptr

next node on left side

◆ right

std::shared_ptr<MathNode> MathNode::right = nullptr

next node on right side

◆ type

MathNodeType MathNode::type

node type representation

◆ valSize

size_t MathNode::valSize = 0
protected

helper to store size of value

◆ value

char* MathNode::value {}

char representation of value


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