Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

vpr::ProfileIterator Class Reference

An iterator to navigate through the Profile tree. More...

#include <ProfileIterator.h>

Collaboration diagram for vpr::ProfileIterator:

Collaboration graph
[legend]
List of all members.

Public Methods

void first (void)
 Access the first child of the parent. More...

void next (void)
 Access the next child of the parent. More...

ProfileIterator * getChild (void)
ProfileIterator * getSibling (void)
bool isDone (void)
 Tells if the there are no more children to iterate through. More...

void enterChild (int index)
 Make the given child the new parent. More...

void enterLargestChild (void)
 Make the largest child the new parent. More...

void enterParent (void)
 Make the current parent's parent the new parent. More...

const char * getCurrentName (void)
int getCurrentTotalCalls (void)
float getCurrentTotalTime (void)
const char * getCurrentParentName (void)
void printTree (ProfileNode *node)
const ProfileNode::NodeHistoryRange getNodeHistoryRange ()
int getCurrentParentTotalCalls (void)
float getCurrentParentTotalTime (void)

Protected Methods

 ProfileIterator (ProfileNode *start)

Protected Attributes

ProfileNodemCurrentParent
ProfileNodemCurrentChild

Friends

class ProfileManager

Detailed Description

An iterator to navigate through the Profile tree.

Definition at line 18 of file ProfileIterator.h.


Constructor & Destructor Documentation

vpr::ProfileIterator::ProfileIterator ProfileNode   start [protected]
 

Definition at line 6 of file ProfileIterator.cpp.

References mCurrentChild, and mCurrentParent.

Referenced by getChild, and getSibling.

00007 {
00008    mCurrentParent = start;
00009    mCurrentChild = mCurrentParent->getChild();
00010 }


Member Function Documentation

void vpr::ProfileIterator::first void   
 

Access the first child of the parent.

Definition at line 12 of file ProfileIterator.cpp.

References mCurrentChild, and mCurrentParent.

00013 {
00014    mCurrentChild = mCurrentParent->getChild();
00015 }

void vpr::ProfileIterator::next void   
 

Access the next child of the parent.

Definition at line 17 of file ProfileIterator.cpp.

References mCurrentChild, and mCurrentParent.

Referenced by enterChild.

00018 {
00019       ProfileNode* temp;
00020       temp = mCurrentParent;
00021       mCurrentParent = mCurrentChild; 
00022       mCurrentChild = mCurrentChild->getChild();
00023       if(mCurrentChild == NULL)
00024       {
00025          mCurrentChild = mCurrentParent;
00026          mCurrentParent = temp;
00027          mCurrentChild->getSibling();
00028       }
00029 }

ProfileIterator* vpr::ProfileIterator::getChild void    [inline]
 

Definition at line 32 of file ProfileIterator.h.

References mCurrentChild, and ProfileIterator.

00032 {return new ProfileIterator(mCurrentChild->getChild());}

ProfileIterator* vpr::ProfileIterator::getSibling void    [inline]
 

Definition at line 34 of file ProfileIterator.h.

References mCurrentChild, and ProfileIterator.

00034 {return new ProfileIterator(mCurrentChild->getSibling());}

bool vpr::ProfileIterator::isDone void   
 

Tells if the there are no more children to iterate through.

Returns:
true is returned if the next child is NULL. false is returned if there is a valid next child.

Definition at line 31 of file ProfileIterator.cpp.

References mCurrentChild.

00032 {
00033    return mCurrentChild == NULL;
00034 }

void vpr::ProfileIterator::enterChild int    index
 

Make the given child the new parent.

Definition at line 36 of file ProfileIterator.cpp.

References enterParent, mCurrentChild, mCurrentParent, and next.

00037 {
00038    mCurrentChild = mCurrentParent->getChild();
00039    while ( (mCurrentChild != NULL) && (index != 0) ) {
00040       index--;
00041       mCurrentChild = mCurrentChild->getSibling();
00042    }
00043 
00044    if ( mCurrentChild != NULL ) {
00045       mCurrentParent = mCurrentChild;
00046       mCurrentChild = mCurrentParent->getChild();
00047    }
00048    if(mCurrentChild == NULL)
00049    {
00050       enterParent();
00051       next();
00052    }
00053 }

void vpr::ProfileIterator::enterLargestChild void   
 

Make the largest child the new parent.

void vpr::ProfileIterator::enterParent void   
 

Make the current parent's parent the new parent.

Definition at line 55 of file ProfileIterator.cpp.

References mCurrentChild, and mCurrentParent.

Referenced by enterChild.

00056 {
00057    if ( mCurrentParent->getParent() != NULL ) {
00058       mCurrentParent = mCurrentParent->getParent();
00059    }
00060    mCurrentChild = mCurrentParent->getChild();
00061 }

const char* vpr::ProfileIterator::getCurrentName void    [inline]
 

Returns:
Current childs name is returned.

Definition at line 62 of file ProfileIterator.h.

References mCurrentChild.

00062 { return mCurrentChild->getName(); }

int vpr::ProfileIterator::getCurrentTotalCalls void    [inline]
 

Returns:
Current childs number of total calls is returned.

Definition at line 67 of file ProfileIterator.h.

References mCurrentChild.

00067 { return mCurrentChild->getTotalCalls(); }

float vpr::ProfileIterator::getCurrentTotalTime void    [inline]
 

Returns:
Current childs total exectuion time is returned.

Definition at line 72 of file ProfileIterator.h.

References mCurrentChild.

00072 { return mCurrentChild->getTotalTime(); }

const char* vpr::ProfileIterator::getCurrentParentName void    [inline]
 

Returns:
Current child's parent name is returned.

Definition at line 77 of file ProfileIterator.h.

References mCurrentParent.

00077 { return mCurrentParent->getName(); }

void vpr::ProfileIterator::printTree ProfileNode   node [inline]
 

Returns:
tree structure is printed out

Definition at line 82 of file ProfileIterator.h.

00082 {node->printTree(node);}

const ProfileNode::NodeHistoryRange vpr::ProfileIterator::getNodeHistoryRange   [inline]
 

Definition at line 87 of file ProfileIterator.h.

References mCurrentChild.

00087 { return mCurrentChild->getNodeHistoryRange();}

int vpr::ProfileIterator::getCurrentParentTotalCalls void    [inline]
 

Returns:
Current child's parent number of total calls is returned.

Definition at line 92 of file ProfileIterator.h.

References mCurrentParent.

00092 { return mCurrentParent->getTotalCalls(); }

float vpr::ProfileIterator::getCurrentParentTotalTime void    [inline]
 

Returns:
Current child's parent total execution time is returned.

Definition at line 97 of file ProfileIterator.h.

References mCurrentParent.

00097 { return mCurrentParent->getTotalTime(); }


Friends And Related Function Documentation

friend class ProfileManager [friend]
 

Definition at line 105 of file ProfileIterator.h.


Member Data Documentation

ProfileNode* vpr::ProfileIterator::mCurrentParent [protected]
 

Definition at line 101 of file ProfileIterator.h.

Referenced by enterChild, enterParent, first, getCurrentParentName, getCurrentParentTotalCalls, getCurrentParentTotalTime, next, and ProfileIterator.

ProfileNode* vpr::ProfileIterator::mCurrentChild [protected]
 

Definition at line 102 of file ProfileIterator.h.

Referenced by enterChild, enterParent, first, getChild, getCurrentName, getCurrentTotalCalls, getCurrentTotalTime, getNodeHistoryRange, getSibling, isDone, next, and ProfileIterator.


The documentation for this class was generated from the following files:
Generated on Sun May 2 14:47:10 2004 for VR Juggler Portable Runtime by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002