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:
Inheritance graph
[legend]
Collaboration diagram for ExprNode:
Collaboration graph
[legend]

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 ( )

default constructor.

Definition at line 154 of file OSnLNode.cpp.

ExprNode::~ExprNode ( )
virtual

default destructor.

Definition at line 167 of file OSnLNode.cpp.

Member Function Documentation

std::string ExprNode::getTokenNumber ( )
virtual
Returns
the value of inodeInt

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

Definition at line 208 of file OSnLNode.cpp.

virtual std::string ExprNode::getTokenName ( )
pure 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.

Definition at line 221 of file OSnLNode.cpp.

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.

Definition at line 259 of file OSnLNode.cpp.

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.

Definition at line 266 of file OSnLNode.cpp.

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.

Definition at line 282 of file OSnLNode.cpp.

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.

Definition at line 289 of file OSnLNode.cpp.

virtual ExprNode* ExprNode::cloneExprNode ( )
pure virtual
bool ExprNode::IsEqual ( ExprNode that)
virtual

A function to check for the equality of two objects.

Definition at line 308 of file OSnLNode.cpp.

Member Data Documentation

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.

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.

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.

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.

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.

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 files: