Polaris: SimGraphIterator.h Source File

SimGraphIterator.h

Go to the documentation of this file.
00001 #ifndef _SIMGRAPHITERATOR_H
00002 #define _SIMGRAPHITERATOR_H
00003 ///
00004 /// \class SimGraphIterator 
00005 /// \brief a class for iterating through a Similarity graph
00006 /// \defgroup Base
00007 /// \ingroup Base
00008 ///  General utility routines
00009 /// \see SimGraphIterator.h
00010 /// \see SimGraphIterator.cc
00011 /// \see SimGraphIterator.h
00012 ///
00013 /// \endcode
00014 /// \section Description Description
00015 /// This module contains the structures needed to represent
00016 /// an Iterator through the edges in a Similarity graph.
00017 /// 
00018 /// 
00019 ///
00020 ///
00021 ///
00022 /// \endcode
00023 /// \section KNOWN KNOWN/POSSIBLE BUGS/LIMITATIONS
00024 ///
00025 #ifdef POLARIS_GNU_PRAGMAS
00026 #pragma interface
00027 #endif
00028 ///
00029 #include "ClassNames.h"
00030 #include "Listable.h"
00031 #include "SimGraph.h"
00032 #include "SimEdge.h"
00033 #include "utilities/access_util.h"
00034 ///
00035 class SimGraphIterator : public Listable {
00036 
00037  protected:
00038     Array< Array< bool > > * _check_edge;  ///< Whether a particular edge should be returned during the iteration
00039     SimGraph * _graph;  ///< Pointer to the similarity graph
00040     bool _valid;        ///< Are there more edges left in the graph?
00041     int _node1_pos;     ///< Current position for node1 in iteration loop
00042     int _node2_pos;     ///< Current position for node2 in iteration loop
00043     List<SimEdge> _created_edges;  ///< A home list for the edges created by current()
00044                                ///< Deleting the SimGraphIterator also deletes these.
00045 
00046  public:
00047     SimGraphIterator( );
00048     SimGraphIterator( SimGraph & graph );         ///< Iterate through given graph
00049     ~SimGraphIterator( );
00050 
00051     void delete_node( int node );           ///< Delete the given node from the graph
00052     void delete_node( AbstractAccess & node );  ///< Delete the given node from the graph
00053     void mark_unknown( AbstractAccess & node ); ///< Mark all edges from this node as SIM_UNKNOWN
00054     void record_change( SimTypeOfChange change, SimEdge & edge );
00055     ///< Modify the SimilarityTypes in the graph to reflect a change in one of the descriptors
00056 
00057     bool valid( );                          ///< Any more edges left to visit?
00058     SimEdge & current( );                   ///< Return the current edge
00059     void operator ++( );                    ///< Go to the next edge
00060     void next( );                           ///< Same as operator++
00061     void reset( );                          ///< Start back at the beginning of the iteration
00062     bool end( ) const;                      ///< True if no more nodes to iterate on
00063 
00064     ///< This one is to satisfy Listable
00065     virtual void    print(ostream & o) const;
00066 
00067     virtual SimGraphIterator *clone() const;
00068     virtual Listable *listable_clone() const;
00069 
00070     friend ostream & operator << (ostream & o, const SimGraphIterator & ad);
00071 };
00072 
00073 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:06:07 2005