OS  2.10.1
Public Member Functions | Public Attributes | List of all members
ExprNode Class Referenceabstract

A generic class from which we derive both OSnLNode and OSnLMNode. More...

#include <OSnLNode.h>

+ Inheritance diagram for ExprNode:
+ Collaboration diagram for ExprNode:

Public Member Functions

 ExprNode ()
 default constructor. More...
 
virtual ~ExprNode ()
 default destructor. More...
 
virtual std::string getTokenNumber ()
 
virtual std::string getTokenName ()=0
 
virtual std::string getNonlinearExpressionInXML ()
 The following method writes an OSnLNode or OSnLMNode in OSiL format. More...
 
virtual std::vector< ExprNode * > getPrefixFromExpressionTree ()
 Get a vector of pointers to OSnLNodes and OSnLMNodes that correspond to the (scalar-valued or matrix-valued) expression tree in prefix format. More...
 
virtual std::vector< ExprNode * > preOrderOSnLNodeTraversal (std::vector< ExprNode *> *prefixVector)
 Called by getPrefixFromExpressionTree(). More...
 
virtual std::vector< ExprNode * > getPostfixFromExpressionTree ()
 Get a vector of pointers to ExprNodes that correspond to the expression tree in postfix format. More...
 
virtual std::vector< ExprNode * > postOrderOSnLNodeTraversal (std::vector< ExprNode *> *postfixVector)
 Called by getPostfixFromExpressionTree(). More...
 
virtual ExprNodecloneExprNode ()=0
 Create or clone a node of this type. More...
 
virtual bool IsEqual (ExprNode *that)
 A function to check for the equality of two objects. More...
 

Public Attributes

int inodeInt
 inodeInt is the unique integer assigned to the OSnLNode or OSnLMNode in OSParameters.h. More...
 
int inodeType
 inodeType essentially tracks whether the number of children are known or not. More...
 
unsigned int inumberOfChildren
 inumberOfChildren is the number of OSnLNode child elements If this number is not fixed, e.g., for a sum node, it is temporarily set to 0 More...
 
unsigned int inumberOfMatrixChildren
 inumberOfMatrixChildren is the number of OSnLMNode child elements If this number is not fixed, e.g., for a matrixProduct node, it is temporarily set to 0 More...
 
OSnLNode ** m_mChildren
 m_mChildren holds all the operands, that is, nodes that the current node operates on. More...
 
OSnLMNode ** m_mMatrixChildren
 m_mMatrixChildren holds all the matrix-valued operands, if any. More...
 

Detailed Description

A generic class from which we derive both OSnLNode and OSnLMNode.

Author
Horand Gassmann, Jun Ma, Kipp Martin
Version
2.9, 10/Sep/2014

Definition at line 56 of file OSnLNode.h.

Constructor & Destructor Documentation

◆ ExprNode()

ExprNode::ExprNode ( )

default constructor.

◆ ~ExprNode()

virtual ExprNode::~ExprNode ( )
virtual

default destructor.

Member Function Documentation

◆ getTokenNumber()

virtual std::string ExprNode::getTokenNumber ( )
virtual

◆ getTokenName()

virtual std::string ExprNode::getTokenName ( )
pure virtual

◆ getNonlinearExpressionInXML()

virtual std::string ExprNode::getNonlinearExpressionInXML ( )
virtual

The following method writes an OSnLNode or OSnLMNode in OSiL format.

It is used by OSiLWriter to assist in writing an OSiL file from a corresponding OSInstance.

Returns
the ExprNode and its children as an OSiL string.

Reimplemented in OSnLMNodeMatrixCon, OSnLMNodeMatrixObj, OSnLMNodeMatrixVar, OSnLMNodeMatrixReference, OSnLMNodeMatrixUpperTriangle, OSnLMNodeMatrixLowerTriangle, OSnLNodeVariable, OSnLNodePI, OSnLNodeE, and OSnLNodeNumber.

◆ getPrefixFromExpressionTree()

virtual std::vector<ExprNode*> ExprNode::getPrefixFromExpressionTree ( )
virtual

Get a vector of pointers to OSnLNodes and OSnLMNodes that correspond to the (scalar-valued or matrix-valued) expression tree in prefix format.

Returns
the expression tree as a vector of ExprNodes in prefix.

Reimplemented in OSnLMNode, and OSnLNode.

◆ preOrderOSnLNodeTraversal()

virtual std::vector<ExprNode*> ExprNode::preOrderOSnLNodeTraversal ( std::vector< ExprNode *> *  prefixVector)
virtual

Called by getPrefixFromExpressionTree().

This method calls itself recursively and generates a vector of pointers to ExprNode in prefix

Parameters
apointer prefixVector to a vector of pointers of ExprNodes
Returns
a vector of pointers to ExprNode in prefix.

Reimplemented in OSnLMNode, and OSnLNode.

◆ getPostfixFromExpressionTree()

virtual std::vector<ExprNode*> ExprNode::getPostfixFromExpressionTree ( )
virtual

Get a vector of pointers to ExprNodes that correspond to the expression tree in postfix format.

Returns
the expression tree as a vector of ExprNodes in postfix.

Reimplemented in OSnLMNode, and OSnLNode.

◆ postOrderOSnLNodeTraversal()

virtual std::vector<ExprNode*> ExprNode::postOrderOSnLNodeTraversal ( std::vector< ExprNode *> *  postfixVector)
virtual

Called by getPostfixFromExpressionTree().

This method calls itself recursively and generates a vector of pointers to ExprNodes in postfix.

Parameters
apointer postfixVector to a vector of pointers of ExprNodes
Returns
a vector of pointers to ExprNodes in postfix.

Reimplemented in OSnLMNode, and OSnLNode.

◆ cloneExprNode()

virtual ExprNode* ExprNode::cloneExprNode ( )
pure virtual

◆ IsEqual()

virtual bool ExprNode::IsEqual ( ExprNode that)
virtual

A function to check for the equality of two objects.

Member Data Documentation

◆ inodeInt

int ExprNode::inodeInt

inodeInt is the unique integer assigned to the OSnLNode or OSnLMNode in OSParameters.h.

Definition at line 62 of file OSnLNode.h.

◆ inodeType

int ExprNode::inodeType

inodeType essentially tracks whether the number of children are known or not.

For most nodes this is known, in which case inodeType is set to inumberOfChildren. For some nodes the number of children is not known a priori, e.g., a sum node, then inodeType is set to -1.

Definition at line 69 of file OSnLNode.h.

◆ inumberOfChildren

unsigned int ExprNode::inumberOfChildren

inumberOfChildren is the number of OSnLNode child elements If this number is not fixed, e.g., for a sum node, it is temporarily set to 0

Definition at line 74 of file OSnLNode.h.

◆ inumberOfMatrixChildren

unsigned int ExprNode::inumberOfMatrixChildren

inumberOfMatrixChildren is the number of OSnLMNode child elements If this number is not fixed, e.g., for a matrixProduct node, it is temporarily set to 0

Definition at line 79 of file OSnLNode.h.

◆ m_mChildren

OSnLNode** ExprNode::m_mChildren

m_mChildren holds all the operands, that is, nodes that the current node operates on.

Definition at line 84 of file OSnLNode.h.

◆ m_mMatrixChildren

OSnLMNode** ExprNode::m_mMatrixChildren

m_mMatrixChildren holds all the matrix-valued operands, if any.

Definition at line 89 of file OSnLNode.h.


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