contrib/tbl/vipl/section/vipl_section_iterator.h
Go to the documentation of this file.
00001 // This is tbl/vipl/section/vipl_section_iterator.h
00002 #ifndef vipl_section_iterator_h_
00003 #define vipl_section_iterator_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 
00008 template < class DataType > class vipl_section_descriptor; //template forward reference
00009 template < class DataType > class vipl_section_container; //template forward reference
00010 
00011 template < class DataType >
00012 class vipl_section_iterator
00013 {
00014   friend class vipl_section_container< DataType > ; //declare a friend class
00015   friend class vipl_section_descriptor< DataType > ; //declare a friend class
00016  protected:
00017   vipl_section_descriptor< DataType >* hsreal_descriptor;
00018   vipl_section_container< DataType >* hscontainer;
00019   int hsincr_count;
00020   // Assigns the pointer directly. Does not deep copy them.
00021   vipl_section_iterator(
00022        vipl_section_descriptor< DataType >* desc ,
00023        vipl_section_container< DataType >* container);
00024   // Deep copies the pointers.
00025   vipl_section_iterator(
00026        vipl_section_descriptor< DataType >* desc ,
00027        vipl_section_container< DataType >* container ,
00028        int t);
00029  public:
00030   virtual ~vipl_section_iterator(); //low_level destructor
00031   vipl_section_iterator(); //low_level c++ constructor
00032   //user accessed low_level c++ copy constructor
00033   vipl_section_iterator(const vipl_section_iterator< DataType > &);
00034   // begin method list for class section_iterator
00035   // prefix
00036   virtual vipl_section_iterator< DataType >& operator++(); // postfix
00037   virtual vipl_section_iterator< DataType > operator++( int a);
00038   // Get the descriptor for the current section
00039   virtual vipl_section_descriptor< DataType > operator*();
00040 
00041   //The equality test is, if this and p have the same address TRUE;
00042   //if this and p both have null descriptors TRUE if this XOR p
00043   //have null descriptor FALSE if this and p have linked containers
00044   //which are equal, AND the iterator's ++ counts are the same,
00045   //TRUE; otherwise FALSE
00046   virtual bool operator==(const vipl_section_iterator< DataType >& p) const;
00047   virtual bool operator!=( const vipl_section_iterator< DataType >& p) const;
00048   virtual vipl_section_iterator< DataType >& operator=( const vipl_section_iterator< DataType >& p) ;
00049   vipl_section_descriptor< DataType >* real_descriptor() const { return hsreal_descriptor; }
00050   vipl_section_descriptor< DataType >* & ref_real_descriptor() { return hsreal_descriptor; }
00051   void put_real_descriptor( vipl_section_descriptor< DataType >* v) { hsreal_descriptor = v; }
00052   vipl_section_container< DataType >* container() const { return hscontainer; }
00053   vipl_section_container< DataType >* & ref_container() { return hscontainer; }
00054   void put_container( vipl_section_container< DataType >* v) { hscontainer = v; }
00055   int incr_count() const { return hsincr_count; }
00056   int & ref_incr_count() { return hsincr_count; }
00057   void put_incr_count( int v) { hsincr_count = v; }
00058 
00059 }; // end of class definition
00060 
00061 #ifdef INSTANTIATE_TEMPLATES
00062 #include "vipl_section_iterator.txx"
00063 #endif
00064 
00065 #endif // vipl_section_iterator_h_