torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::router::RouteTreeNode Class Reference

An object that holds more complete path information for routing and tracing. More...

#include <RouteTreeNode.hpp>

+ Inheritance diagram for torc::router::RouteTreeNode:
+ Collaboration diagram for torc::router::RouteTreeNode:

Public Member Functions

 RouteTreeNode ()
 Null Constructor. More...
 
 RouteTreeNode (Tilewire inSource, Tilewire inSink, boost::int32_t inCost, RouteTreeNode *inParent)
 Public Constructor. More...
 
 RouteTreeNode (Arc inArc, boost::int32_t inCost, RouteTreeNode *inParent)
 Public Constructor. More...
 
 ~RouteTreeNode ()
 Destructor. More...
 
void addChildren (const std::vector< RouteTreeNode * > &newChildren)
 Add children to the node. More...
 
void makeParent (const Tilewire &inSource, const Tilewire &inSink)
 Allocate a new node and make it the parent of this node. More...
 
boost::uint16_t getNumChildren ()
 Get the number of children. More...
 
RouteTreeNodegetChild (unsigned int index)
 Get a child by index, returns 0 for invalid index. More...
 
void normalizeDepth ()
 Normalize depth of nodes. More...
 
const ArcgetArc () const
 Get the associated Arc. More...
 
const TilewiregetSourceTilewire () const
 Get the source Tilewire. More...
 
const TilewiregetSinkTilewire () const
 Get the sink Tilewire. More...
 
const boost::int32_t getCost () const
 Get the heuristic node cost. More...
 
void setCost (boost::int32_t inHeuristicCost)
 Set the heuristic node cost. More...
 
const boost::int32_t getPathCost () const
 Get the path cost. More...
 
void setPathCost (boost::int32_t inPathCost)
 Set the path cost. More...
 
const boost::int32_t getDepth () const
 Get the node depth. More...
 
void setDepth (boost::int32_t inDepth)
 Set the node depth. More...
 
RouteNodegetParent () const
 Get the node's parent. More...
 
RouteNodegetTop ()
 Return the top node by tracing parent pointers. More...
 
bool operator< (const RouteNode *rhs) const
 

Protected Types

typedef architecture::Tilewire Tilewire
 Imported type name. More...
 
typedef architecture::Arc Arc
 Imported type name. More...
 

Protected Member Functions

void adjustDepth (int adjustment)
 Recursively adjust node depths. More...
 

Protected Attributes

RouteTreeNodemOnlyChild
 Pointer to a child node that is the only one. More...
 
std::vector< RouteTreeNode * > * mChildren
 Pointer to a vector of child nodes that is dynamically allocated. More...
 
architecture::Arc mArc
 Arc that this node describes. More...
 
boost::int32_t mCost
 Cost associated with this arc. More...
 
boost::int32_t mPathCost
 Path cost for this arc. More...
 
boost::int32_t mDepth
 Depth of node from the source. More...
 
RouteNodemParent
 Pointer to parent node. More...
 

Private Types

typedef std::vector
< RouteTreeNode * >::iterator 
RouteTreeNodeIterator
 

Detailed Description

An object that holds more complete path information for routing and tracing.

Todo:
Have to justify the packing decision, and its impact on memory footprint versus performance.

A RouteTreeNode contains children pointers to allow tracing of arcs through a device to recover complete nets from the device usage information.

Definition at line 37 of file RouteTreeNode.hpp.

Member Typedef Documentation

typedef architecture::Arc torc::router::RouteNode::Arc
protectedinherited

Imported type name.

Definition at line 46 of file RouteNode.hpp.

typedef std::vector<RouteTreeNode*>::iterator torc::router::RouteTreeNode::RouteTreeNodeIterator
private

Definition at line 39 of file RouteTreeNode.hpp.

Imported type name.

Definition at line 44 of file RouteNode.hpp.

Constructor & Destructor Documentation

torc::router::RouteTreeNode::RouteTreeNode ( )
inline

Null Constructor.

Definition at line 50 of file RouteTreeNode.hpp.

50 : RouteNode(), mOnlyChild(0), mChildren(0) {}
std::vector< RouteTreeNode * > * mChildren
Pointer to a vector of child nodes that is dynamically allocated.
RouteTreeNode * mOnlyChild
Pointer to a child node that is the only one.
RouteNode()
Null Constructor.
Definition: RouteNode.hpp:62

+ Here is the caller graph for this function:

torc::router::RouteTreeNode::RouteTreeNode ( Tilewire  inSource,
Tilewire  inSink,
boost::int32_t  inCost,
RouteTreeNode inParent 
)
inline

Public Constructor.

Definition at line 52 of file RouteTreeNode.hpp.

54  : RouteNode(inSource, inSink, inCost, inCost, 0, inParent), mOnlyChild(0),
55  mChildren(0) {
56  if (inParent != 0) {
57  mDepth = inParent->getDepth() + 1;
58  } else {
59  mDepth = 0;
60  }
61  }
std::vector< RouteTreeNode * > * mChildren
Pointer to a vector of child nodes that is dynamically allocated.
RouteTreeNode * mOnlyChild
Pointer to a child node that is the only one.
boost::int32_t mDepth
Depth of node from the source.
Definition: RouteNode.hpp:56
RouteNode()
Null Constructor.
Definition: RouteNode.hpp:62

+ Here is the call graph for this function:

torc::router::RouteTreeNode::RouteTreeNode ( Arc  inArc,
boost::int32_t  inCost,
RouteTreeNode inParent 
)
inline

Public Constructor.

Definition at line 63 of file RouteTreeNode.hpp.

64  : RouteNode(inArc, inCost, inCost, 0, inParent), mOnlyChild(0), mChildren(0) {
65  if (inParent != 0) {
66  mDepth = inParent->getDepth() + 1;
67  } else {
68  mDepth = 0;
69  }
70  }
std::vector< RouteTreeNode * > * mChildren
Pointer to a vector of child nodes that is dynamically allocated.
RouteTreeNode * mOnlyChild
Pointer to a child node that is the only one.
boost::int32_t mDepth
Depth of node from the source.
Definition: RouteNode.hpp:56
RouteNode()
Null Constructor.
Definition: RouteNode.hpp:62

+ Here is the call graph for this function:

torc::router::RouteTreeNode::~RouteTreeNode ( )
inline

Destructor.

Definition at line 72 of file RouteTreeNode.hpp.

72  {
73  if (mOnlyChild != 0) { delete mOnlyChild; mOnlyChild = 0; }
74  if (mChildren != 0) {
75  RouteTreeNodeIterator p = mChildren->begin();
77  while (p < e) { delete *p, p++; }
78  delete mChildren; mChildren = 0;
79  }
80  }
std::vector< RouteTreeNode * > * mChildren
Pointer to a vector of child nodes that is dynamically allocated.
RouteTreeNode * mOnlyChild
Pointer to a child node that is the only one.
std::vector< RouteTreeNode * >::iterator RouteTreeNodeIterator

Member Function Documentation

void torc::router::RouteTreeNode::addChildren ( const std::vector< RouteTreeNode * > &  newChildren)
inline

Add children to the node.

Definition at line 85 of file RouteTreeNode.hpp.

85  {
86  boost::uint32_t size = newChildren.size();
87  if (size == 0) { return; }
88 
89  // no child or 1 child
90  if (mChildren == 0) {
91  // adding 1 child to a node with 0
92  if (mOnlyChild == 0 && size == 1) {
93  mOnlyChild = newChildren[0];
94  return;
95  }
96  // node will have more than 1 child, create vector
97  mChildren = new std::vector<RouteTreeNode*>();
98  // if the node had 1 child, move it to the vector
99  if (mOnlyChild != 0) {
100  mChildren->reserve(size+1);
101  mChildren->push_back(mOnlyChild);
102  mOnlyChild = 0;
103  // node had 0 children, reserve space for the new children
104  } else {
105  mChildren->reserve(size);
106  }
107  // already 2 or more children
108  } else {
109  mChildren->reserve(mChildren->size() + size);
110  }
111  // insert children into the node
112  mChildren->insert(mChildren->end(), newChildren.begin(), newChildren.end());
113  }
std::vector< RouteTreeNode * > * mChildren
Pointer to a vector of child nodes that is dynamically allocated.
RouteTreeNode * mOnlyChild
Pointer to a child node that is the only one.

+ Here is the caller graph for this function:

void torc::router::RouteTreeNode::adjustDepth ( int  adjustment)
inlineprotected

Recursively adjust node depths.

Definition at line 143 of file RouteTreeNode.hpp.

143  {
144  mDepth += adjustment;
145  if (mOnlyChild != 0) mOnlyChild->adjustDepth(adjustment);
146  else if (mChildren != 0) {
147  RouteTreeNodeIterator p = mChildren->begin();
148  RouteTreeNodeIterator e = mChildren->end();
149  while (p < e) {
150  (*p)->adjustDepth(adjustment);
151  p++;
152  }
153  }
154  }
std::vector< RouteTreeNode * > * mChildren
Pointer to a vector of child nodes that is dynamically allocated.
RouteTreeNode * mOnlyChild
Pointer to a child node that is the only one.
std::vector< RouteTreeNode * >::iterator RouteTreeNodeIterator
void adjustDepth(int adjustment)
Recursively adjust node depths.
boost::int32_t mDepth
Depth of node from the source.
Definition: RouteNode.hpp:56

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const Arc& torc::router::RouteNode::getArc ( ) const
inlineinherited

Get the associated Arc.

Definition at line 80 of file RouteNode.hpp.

80 { return mArc; }
architecture::Arc mArc
Arc that this node describes.
Definition: RouteNode.hpp:50

+ Here is the caller graph for this function:

RouteTreeNode* torc::router::RouteTreeNode::getChild ( unsigned int  index)
inline

Get a child by index, returns 0 for invalid index.

Definition at line 129 of file RouteTreeNode.hpp.

129  {
130  if (mOnlyChild != 0 && index == 0) return mOnlyChild;
131  if (mChildren != 0 && index < mChildren->size()) return (*mChildren)[index];
132  return 0;
133  }
std::vector< RouteTreeNode * > * mChildren
Pointer to a vector of child nodes that is dynamically allocated.
RouteTreeNode * mOnlyChild
Pointer to a child node that is the only one.

+ Here is the caller graph for this function:

const boost::int32_t torc::router::RouteNode::getCost ( ) const
inlineinherited

Get the heuristic node cost.

Definition at line 86 of file RouteNode.hpp.

86 { return mCost; }
boost::int32_t mCost
Cost associated with this arc.
Definition: RouteNode.hpp:52

+ Here is the caller graph for this function:

const boost::int32_t torc::router::RouteNode::getDepth ( ) const
inlineinherited

Get the node depth.

Definition at line 94 of file RouteNode.hpp.

94 { return mDepth; }
boost::int32_t mDepth
Depth of node from the source.
Definition: RouteNode.hpp:56

+ Here is the caller graph for this function:

boost::uint16_t torc::router::RouteTreeNode::getNumChildren ( )
inline

Get the number of children.

Definition at line 123 of file RouteTreeNode.hpp.

123  {
124  if (mOnlyChild != 0) return 1;
125  else if (mChildren == 0) return 0;
126  return mChildren->size();
127  }
std::vector< RouteTreeNode * > * mChildren
Pointer to a vector of child nodes that is dynamically allocated.
RouteTreeNode * mOnlyChild
Pointer to a child node that is the only one.

+ Here is the caller graph for this function:

RouteNode* torc::router::RouteNode::getParent ( ) const
inlineinherited

Get the node's parent.

Definition at line 98 of file RouteNode.hpp.

98 { return mParent; }
RouteNode * mParent
Pointer to parent node.
Definition: RouteNode.hpp:58

+ Here is the caller graph for this function:

const boost::int32_t torc::router::RouteNode::getPathCost ( ) const
inlineinherited

Get the path cost.

Definition at line 90 of file RouteNode.hpp.

90 { return mPathCost; }
boost::int32_t mPathCost
Path cost for this arc.
Definition: RouteNode.hpp:54

+ Here is the caller graph for this function:

const Tilewire& torc::router::RouteNode::getSinkTilewire ( void  ) const
inlineinherited

Get the sink Tilewire.

Definition at line 84 of file RouteNode.hpp.

84 { return mArc.getSinkTilewire(); }
const Tilewire & getSinkTilewire(void) const
Returns the sink tilewire.
Definition: Arc.hpp:47
architecture::Arc mArc
Arc that this node describes.
Definition: RouteNode.hpp:50

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const Tilewire& torc::router::RouteNode::getSourceTilewire ( ) const
inlineinherited

Get the source Tilewire.

Definition at line 82 of file RouteNode.hpp.

82 { return mArc.getSourceTilewire(); }
const Tilewire & getSourceTilewire(void) const
Returns the source tilewire.
Definition: Arc.hpp:45
architecture::Arc mArc
Arc that this node describes.
Definition: RouteNode.hpp:50

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RouteNode* torc::router::RouteNode::getTop ( )
inlineinherited

Return the top node by tracing parent pointers.

Definition at line 100 of file RouteNode.hpp.

100  {
101  RouteNode* top = this;
102  while (top->mParent != 0) top = top->mParent;
103  return top;
104  }
RouteNode()
Null Constructor.
Definition: RouteNode.hpp:62

+ Here is the caller graph for this function:

void torc::router::RouteTreeNode::makeParent ( const Tilewire inSource,
const Tilewire inSink 
)
inline

Allocate a new node and make it the parent of this node.

Definition at line 115 of file RouteTreeNode.hpp.

115  {
116  //mArc = Arc(inSource, inSink); // DON'T WANT TO DO THIS
117  //mParent = new RouteTreeNode(mArc.getSourceTilewire(), Tilewire::sInvalid, 0, 0);
118  mParent = new RouteTreeNode(inSource, inSink, 0, 0);
119  ((RouteTreeNode*)mParent)->mOnlyChild = this;
120  ((RouteTreeNode*)mParent)->mDepth = mDepth - 1;
121  }
boost::int32_t mDepth
Depth of node from the source.
Definition: RouteNode.hpp:56
RouteNode * mParent
Pointer to parent node.
Definition: RouteNode.hpp:58
RouteTreeNode()
Null Constructor.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::router::RouteTreeNode::normalizeDepth ( )
inline

Normalize depth of nodes.

Definition at line 135 of file RouteTreeNode.hpp.

135  {
136  RouteTreeNode* top = (RouteTreeNode*) getTop();
137  int topDepth = top->mDepth;
138  if (topDepth == 0) return;
139  top->adjustDepth(-topDepth);
140  }
boost::int32_t mDepth
Depth of node from the source.
Definition: RouteNode.hpp:56
RouteNode * getTop()
Return the top node by tracing parent pointers.
Definition: RouteNode.hpp:100
RouteTreeNode()
Null Constructor.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool torc::router::RouteNode::operator< ( const RouteNode rhs) const
inlineinherited

Definition at line 105 of file RouteNode.hpp.

105  {
106  return (mCost < rhs->mCost);
107  }
boost::int32_t mCost
Cost associated with this arc.
Definition: RouteNode.hpp:52
void torc::router::RouteNode::setCost ( boost::int32_t  inHeuristicCost)
inlineinherited

Set the heuristic node cost.

Definition at line 88 of file RouteNode.hpp.

88 { mCost = inHeuristicCost; }
boost::int32_t mCost
Cost associated with this arc.
Definition: RouteNode.hpp:52

+ Here is the caller graph for this function:

void torc::router::RouteNode::setDepth ( boost::int32_t  inDepth)
inlineinherited

Set the node depth.

Definition at line 96 of file RouteNode.hpp.

96 { mDepth = inDepth; }
boost::int32_t mDepth
Depth of node from the source.
Definition: RouteNode.hpp:56
void torc::router::RouteNode::setPathCost ( boost::int32_t  inPathCost)
inlineinherited

Set the path cost.

Definition at line 92 of file RouteNode.hpp.

92 { mPathCost = inPathCost; }
boost::int32_t mPathCost
Path cost for this arc.
Definition: RouteNode.hpp:54

Field Documentation

architecture::Arc torc::router::RouteNode::mArc
protectedinherited

Arc that this node describes.

Definition at line 50 of file RouteNode.hpp.

std::vector<RouteTreeNode*>* torc::router::RouteTreeNode::mChildren
protected

Pointer to a vector of child nodes that is dynamically allocated.

Definition at line 45 of file RouteTreeNode.hpp.

boost::int32_t torc::router::RouteNode::mCost
protectedinherited

Cost associated with this arc.

Definition at line 52 of file RouteNode.hpp.

boost::int32_t torc::router::RouteNode::mDepth
protectedinherited

Depth of node from the source.

Definition at line 56 of file RouteNode.hpp.

RouteTreeNode* torc::router::RouteTreeNode::mOnlyChild
protected

Pointer to a child node that is the only one.

Definition at line 43 of file RouteTreeNode.hpp.

RouteNode* torc::router::RouteNode::mParent
protectedinherited

Pointer to parent node.

Definition at line 58 of file RouteNode.hpp.

boost::int32_t torc::router::RouteNode::mPathCost
protectedinherited

Path cost for this arc.

Definition at line 54 of file RouteNode.hpp.


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