Polaris: DDiterator Class Reference

DDiterator Class Reference

#include <DDgraph.h>

List of all members.

Public Member Functions

 DDiterator (RefList< Statement > *from_stmts, RefList< Statement > *to_stmts, DDgraph &ddgraph)
 The ownership of both RefLists is transfered to DDiterator.
 DDiterator (const Statement &from_stmt, const Expression &from_expr, const Statement &to_stmt, const Expression &to_expr, DDgraph &ddgraph)
 DDiterator (RefList< Statement > *from_stmts, const Statement &to_stmt, const Expression &to_expr, DDgraph &ddgraph)
 DDiterator (const Statement &from_stmt, const Expression &from_expr, RefList< Statement > *to_stmts, DDgraph &ddgraph)
 DDiterator (const DDiterator &other)
 This method copies the entire state (including current arc) of the iterator.
 ~DDiterator ()
 Release the current DVfield on exiting.
Boolean valid ()
Boolean end ()
 Used to check if there are more Nodes to iterate on.
DVfieldcurrent ()
 CC 06/15/98.
ActiveArccurrent_arc ()
 CC end.
Boolean current_valid ()
Boolean current_invalid ()
 tells whether or not this node is valid
DVfieldgrab ()
 Grab the current element after deleting or invalidating it from the list.
void modify (DVfield *other)
 Subsititude new_dv_field for the DVfield currently pointed by iterator.
void del ()
 Move operations: reset, set_to_last, next, prev, ++, -- -> When an iterator leaves one arc for another, the list DVfields will be overwritten to the old arc in a compacted form subject to its modification in the arc.
void reset ()
void set_to_last ()
 void prev();
void operator-- ()
 void next();
void operator++ ()
 Go to the next valid arc.

Friends

class DDgraphTester
 < DDiterator is initialized by one of the following options; (2 Statement lists) -> from-statements vs.


Constructor & Destructor Documentation

DDiterator::DDiterator RefList< Statement > *  from_stmts,
RefList< Statement > *  to_stmts,
DDgraph ddgraph
 

The ownership of both RefLists is transfered to DDiterator.

That means DDiterator will delete these lists later(Note: since they are RefLists, their elements<each Statement> won't be deleted, but the lists itself will be dissolved).

Definition at line 1817 of file DDgraph.cc.

References _IN_REFS, _OUT_REFS, _STMTS, Iterator< T >::current(), Iterator< T >::end(), Statement::in_refs(), and Statement::out_refs().

DDiterator::DDiterator const Statement from_stmt,
const Expression from_expr,
const Statement to_stmt,
const Expression to_expr,
DDgraph ddgraph
[inline]
 

Definition at line 1213 of file DDgraph.h.

References _EXPR, _FIRST, and DDgraph::compute_dvf_n_arc().

DDiterator::DDiterator RefList< Statement > *  from_stmts,
const Statement to_stmt,
const Expression to_expr,
DDgraph ddgraph
 

Definition at line 1867 of file DDgraph.cc.

References _EXPR, and _STMTS.

DDiterator::DDiterator const Statement from_stmt,
const Expression from_expr,
RefList< Statement > *  to_stmts,
DDgraph ddgraph
 

Definition at line 1889 of file DDgraph.cc.

References _EXPR, and _STMTS.

DDiterator::DDiterator const DDiterator other  ) 
 

This method copies the entire state (including current arc) of the iterator.

If you don't like this, then immediately follow this constructor with a call to reset()

Definition at line 1910 of file DDgraph.cc.

References _STMTS.

DDiterator::~DDiterator  )  [inline]
 

Release the current DVfield on exiting.

Definition at line 1230 of file DDgraph.h.

References _STMTS, and DDgraph::exit().


Member Function Documentation

Boolean DDiterator::valid  )  [inline]
 

Definition at line 1249 of file DDgraph.h.

References False, and True.

Referenced by end().

Boolean DDiterator::end  )  [inline]
 

Used to check if there are more Nodes to iterate on.

If yes, then valid() returns TRUE, else FALSE. end() is equivalent to NOT valid().

Definition at line 1255 of file DDgraph.h.

References valid().

DVfield & DDiterator::current  )  [inline]
 

CC 06/15/98.

If there is no current, this results in an error. This is always suppposed to return VALID node, since every invalid node will be automatically skipped.

Definition at line 1261 of file DDgraph.h.

References current_valid().

ActiveArc* DDiterator::current_arc  )  [inline]
 

CC end.

Definition at line 709 of file DDgraph.h.

Boolean DDiterator::current_valid  )  [inline]
 

Definition at line 1269 of file DDgraph.h.

References False, DDgraph::is_alive(), and True.

Referenced by current(), current_invalid(), del(), grab(), and modify().

Boolean DDiterator::current_invalid  )  [inline]
 

tells whether or not this node is valid

Even though DDiterator guarantees to return valid node in response to current(), there is still chance for the current node to become invalid by grab() called by the other iterator which shares it. Since accessing any members in invalid object causes an error, checking for validity of the current might be necessary for safety reason.

Definition at line 1275 of file DDgraph.h.

References current_valid().

DVfield * DDiterator::grab  )  [inline]
 

Grab the current element after deleting or invalidating it from the list.

Definition at line 1281 of file DDgraph.h.

References Iterator< T >::current(), current_valid(), DVfield::dv(), List< T >::ins_last(), DVfield::listable_clone(), DDgraph::mark_dead(), and Iterator< T >::valid().

Referenced by DDgraphTester::grab_current().

void DDiterator::modify DVfield other  )  [inline]
 

Subsititude new_dv_field for the DVfield currently pointed by iterator.

Definition at line 1313 of file DDgraph.h.

References current_valid(), DDgraph::dvfield_list(), DDgraph::hold(), List< T >::ins_after(), DDgraph::mark_dead(), and DDgraph::release().

void DDiterator::del  )  [inline]
 

Move operations: reset, set_to_last, next, prev, ++, -- -> When an iterator leaves one arc for another, the list DVfields will be overwritten to the old arc in a compacted form subject to its modification in the arc.

If this DVfield is only one left in the current arc, the arc would also be deleted(invalidated or deallocated). no modification, no overwriting.

Definition at line 1305 of file DDgraph.h.

References current_valid(), and DDgraph::mark_dead().

Referenced by DDgraphTester::del_current().

void DDiterator::reset  ) 
 

... Case: from_part -> _STMTS, to_part -> _STMTS

... Search the first valid from_expr

... _OUT_REFS

... Traverse is done

... Case: from_part -> _EXPR, to_part -> _STMTS

... Case: from_part -> _STMTS, to_part -> _EXPR

... Case: from_part -> _EXPR, to_part -> _EXPR

Definition at line 2006 of file DDgraph.cc.

References _FIRST, _IN_REFS, _OUT_REFS, _STMTS, DDgraph::compute_dvf_n_arc(), Iterator< T >::current(), Iterator< T >::end(), DDgraph::exit(), Statement::in_refs(), Statement::out_refs(), and Iterator< T >::reset().

Referenced by DDgraphTester::reset().

void DDiterator::set_to_last  ) 
 

void prev();

Moving to the last might be useful if you need to iterator backwards

Definition at line 2091 of file DDgraph.cc.

References _IN_REFS, _LAST, _OUT_REFS, _STMTS, DDgraph::compute_dvf_n_arc(), Iterator< T >::current(), Iterator< T >::end(), DDgraph::exit(), Statement::in_refs(), Statement::out_refs(), Iterator< T >::reset(), and Iterator< T >::set_to_last().

Referenced by DDgraphTester::set_to_last().

void DDiterator::operator--  ) 
 

void next();

... at the front end or dangling postion

... Case: from_part -> _STMTS, to_part -> _STMTS

... Case: from_part -> _EXPR, to_part -> _STMTS

... Case: from_part -> _STMTS, to_part -> _EXPR

... Case: from_part -> _EXPR, to_part -> _EXPR ... (Nothing else to do)

Definition at line 1942 of file DDgraph.cc.

References _STMTS, and DDgraph::prev().

void DDiterator::operator++  ) 
 

Go to the next valid arc.

... At the end or dangling position

... Case: from_part -> _STMTS, to_part -> _STMTS

... Case: from_part -> _EXPR, to_part -> _STMTS

... Case: from_part -> _STMTS, to_part -> _EXPR

... Case: from_part -> _EXPR, to_part -> _EXPR ... (Nothing else to do)

Definition at line 1974 of file DDgraph.cc.

References _STMTS, and DDgraph::next().


Friends And Related Function Documentation

friend class DDgraphTester [friend]
 

< DDiterator is initialized by one of the following options; (2 Statement lists) -> from-statements vs.

to-statements (2 pairs of a Statement & an Expression) -> dependency for two expressions where each lives in its partner statement, respectively

--> A statement list must be RefList and is for randomly selected statements to update/query their dependency information.

Definition at line 610 of file DDgraph.h.


The documentation for this class was generated from the following files:
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:07:09 2005