OpenASIP  2.0
Classes | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
GraphNode Class Reference

#include <GraphNode.hh>

Inheritance diagram for GraphNode:
Inheritance graph
Collaboration diagram for GraphNode:
Collaboration graph

Classes

class  Comparator
 

Public Member Functions

 GraphNode (int nodeID)
 
 GraphNode ()
 
virtual ~GraphNode ()
 
virtual GraphNodeclone () const
 
int nodeID () const
 
virtual std::string toString () const
 
virtual std::string dotString () const
 

Private Attributes

int nodeID_
 

Static Private Attributes

static int idCounter_ = 0
 

Detailed Description

Node of the graph-based program representation.

Definition at line 42 of file GraphNode.hh.

Constructor & Destructor Documentation

◆ GraphNode() [1/2]

GraphNode::GraphNode ( int  nodeID)
inline

Definition at line 45 of file GraphNode.hh.

45 : nodeID_(nodeID) {}

◆ GraphNode() [2/2]

GraphNode::GraphNode ( )

Definition at line 37 of file GraphNode.cc.

37 : nodeID_(idCounter_++) {}

Referenced by clone().

◆ ~GraphNode()

GraphNode::~GraphNode ( )
virtual

Definition at line 39 of file GraphNode.cc.

39 { }

Member Function Documentation

◆ clone()

GraphNode * GraphNode::clone ( ) const
virtual

Clones node. Needed for dynamic binding, when copying instances through the base class.

Returns
Dynamically allocated copy of the node.

Reimplemented in TerminalNode, ConstantNode, and OperationNode.

Definition at line 48 of file GraphNode.cc.

48  {
49  return new GraphNode(*this);
50 }

References GraphNode().

Here is the call graph for this function:

◆ dotString()

std::string GraphNode::dotString ( ) const
virtual

Returns the string that should be placed in the node's properties section in the GraphViz Dot string.

This can be overridden in the derived class to add different properties (e.g., colors, etc.) to different type of nodes. The default implementation only sets the label property.

Returns
String describing the Dot properties of the Node.

Reimplemented in MoveNode, ProgramDependenceNode, and MIDDGNode.

Definition at line 76 of file GraphNode.cc.

76  {
77  return std::string("label=\"") + toString() + "\"";
78 }

References toString().

Referenced by MoveNode::dotString().

Here is the call graph for this function:

◆ nodeID()

int GraphNode::nodeID ( ) const
inline

◆ toString()

std::string GraphNode::toString ( ) const
virtual

Returns a node description as a string.

Used for printing graph into .dot file. This is used for a label in the default dotString() implementation.

Returns
The node ID as a string.

Reimplemented in MoveNode, ControlDependenceNode, ProgramDependenceNode, BasicBlockNode, TerminalNode, OperationNode, and ConstantNode.

Definition at line 61 of file GraphNode.cc.

61  {
62  return Conversion::toString(nodeID());
63 }

References nodeID(), and Conversion::toString().

Referenced by dotString(), and OperationDAGConverter::writeNode().

Here is the call graph for this function:

Member Data Documentation

◆ idCounter_

int GraphNode::idCounter_ = 0
staticprivate

Definition at line 64 of file GraphNode.hh.

◆ nodeID_

int GraphNode::nodeID_
private

Definition at line 63 of file GraphNode.hh.


The documentation for this class was generated from the following files:
GraphNode::idCounter_
static int idCounter_
Definition: GraphNode.hh:64
GraphNode::nodeID
int nodeID() const
GraphNode::toString
virtual std::string toString() const
Definition: GraphNode.cc:61
Conversion::toString
static std::string toString(const T &source)
GraphNode::nodeID_
int nodeID_
Definition: GraphNode.hh:63
GraphNode::GraphNode
GraphNode()
Definition: GraphNode.cc:37