ExprNode Class Reference

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]

List of all members.

Public Member Functions

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

Public Attributes

int inodeInt
 inodeInt is the unique integer assigned to the OSnLNode or OSnLMNode in OSParameters.h.
int inodeType
 inodeType essentially tracks whether the number of children are known or not.
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
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
OSnLNode ** m_mChildren
 m_mChildren holds all the operands, that is, nodes that the current node operates on.
OSnLMNode ** m_mMatrixChildren
 m_mMatrixChildren holds all the matrix-valued operands, if any.

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 OSnLNodeNumber, OSnLNodeE, OSnLNodePI, OSnLNodeVariable, OSnLMNodeMatrixReference, OSnLMNodeMatrixVar, OSnLMNodeMatrixObj, and OSnLMNodeMatrixCon.

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 OSnLNodeNumber, OSnLNodeE, OSnLNodePI, OSnLNodeVariable, OSnLMNodeMatrixLowerTriangle, OSnLMNodeMatrixUpperTriangle, OSnLMNodeMatrixReference, OSnLMNodeMatrixVar, OSnLMNodeMatrixObj, and OSnLMNodeMatrixCon.

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 OSnLNode, and OSnLMNode.

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:
a pointer prefixVector to a vector of pointers of ExprNodes
Returns:
a vector of pointers to ExprNode in prefix.

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 OSnLNode, and OSnLMNode.

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:
a pointer postfixVector to a vector of pointers of ExprNodes
Returns:
a vector of pointers to ExprNodes in postfix.

Definition at line 289 of file OSnLNode.cpp.

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

Member Data Documentation

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

Definition at line 62 of file OSnLNode.h.

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 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 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 holds all the operands, that is, nodes that the current node operates on.

Definition at line 84 of file OSnLNode.h.

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:

Generated on 5 Jul 2015 by  doxygen 1.6.1