SkelGIS  3.0
/home/helene/Documents/These/SkelGIS/SkelGIS_Library/SkelGIS_V3/skelgis/iterators/DDAG/iterator.hpp
00001 /*! \file iterator_dag.hpp
00002  *  \brief to iterate on nodes or edges elements of a DDAG data structure.
00003  */
00004 #ifndef ITERATOR_DAG_H
00005 #define ITERATOR_DAG_H
00006 
00007 namespace skelgis{
00008 
00009   //-------------------------------------------------------------------------------
00010   //!  Iterator nodes class
00011   /*!
00012     the iterator on nodes elements
00013     no template needed as this iterator is a simple rank and its incrementation
00014   */
00015   //-------------------------------------------------------------------------------
00016   struct iterator_dag
00017   //-------------------------------------------------------------------------------
00018   {
00019   public:
00020     unsigned int _rank;
00021 
00022     //! default constructor of the iterator
00023     //-------------------------------------------------------------------------------
00024     iterator_dag():_rank(0){}
00025     //-------------------------------------------------------------------------------
00026     //! constructor of the iterator
00027     /*!
00028       \param r is the initial rank to assign to the iterator
00029     */
00030     //-------------------------------------------------------------------------------
00031     iterator_dag(const unsigned int r):_rank(r){}
00032     //-------------------------------------------------------------------------------
00033     //! constructor of the iterator from another iterator
00034     /*!
00035       \param it is the other iterator instance from which to construct the new one
00036     */
00037     //-------------------------------------------------------------------------------
00038     iterator_dag(const iterator_dag& it):_rank(it._rank){}
00039     //-------------------------------------------------------------------------------
00040     //! Destructor of the iterator
00041     //-------------------------------------------------------------------------------
00042     ~iterator_dag(){}
00043     //-------------------------------------------------------------------------------
00044     //! operator ++ pre-incrementation of the iterator
00045     /*!
00046       This operation increments the position of the iterator in the DDAG on nodes.
00047       \return a reference to the resulting iterator itself
00048     */
00049     //-------------------------------------------------------------------------------
00050     inline iterator_dag& operator++(){++_rank;return *this;}
00051     //-------------------------------------------------------------------------------
00052     //! operator ++ post-incrementation of the iterator
00053     /*!
00054       This operation increments the position of the iterator in the DDAG on nodes.
00055       \return a reference to the resulting iterator itself
00056     */
00057     //-------------------------------------------------------------------------------
00058     inline iterator_dag operator++(int){iterator_dag _tmp=*this;++_rank;return _tmp;}
00059     //-------------------------------------------------------------------------------
00060     //! operator = of the iterator
00061     /*!
00062       This operation assigns another iterator informations to the current one.
00063       \return a reference to the resulting iterator itself
00064     */
00065     //-------------------------------------------------------------------------------
00066     inline iterator_dag& operator=(iterator_dag right){_rank = right._rank;return *this;}
00067     //-------------------------------------------------------------------------------
00068     //! operator = of the iterator
00069     /*!
00070       This operation assigns another iterator informations to the current one.
00071       \return a reference to the resulting iterator itself
00072     */
00073     //-------------------------------------------------------------------------------
00074     inline bool operator==(const iterator_dag& toComp) {return _rank==toComp._rank;}
00075     //-------------------------------------------------------------------------------
00076     //! operator != of the iterator
00077     /*!
00078       This operation checks the inequality of two iterators with their rank values.
00079       \return true if the two iterator do not have the same rank. False otherwize.
00080     */
00081     //-------------------------------------------------------------------------------
00082     inline bool operator!=(const iterator_dag& toComp) {return _rank!=toComp._rank;}
00083     //-------------------------------------------------------------------------------
00084     //! operator <= of the iterator
00085     /*!
00086       This operation checks if the current iterator rank is smaller or equal to the other one.
00087       \return true is the current iterator rank is smaller or equal. False otherwize.
00088     */
00089     //-------------------------------------------------------------------------------
00090     inline bool operator <=(const iterator_dag& toComp) {return _rank<=toComp._rank;}
00091     //-------------------------------------------------------------------------------
00092     //! operator <= of the iterator
00093     /*!
00094       This operation checks if the current iterator rank is biger or equal to the other one.
00095       \return true is the current iterator rank is biger or equal. False otherwize.
00096     */
00097     //-------------------------------------------------------------------------------
00098     inline bool operator <(const iterator_dag& toComp) {return _rank<toComp._rank;}
00099     //-------------------------------------------------------------------------------
00100     //! operator >= of the iterator
00101     /*!
00102       This operation checks if the current iterator rank is biger or equal to the other one.
00103       \return true is the current iterator rank is biger or equal. False otherwize.
00104     */
00105     //-------------------------------------------------------------------------------
00106     inline bool operator >=(const iterator_dag& toComp) {return _rank>=toComp._rank;}
00107     //-------------------------------------------------------------------------------
00108     //! operator > of the iterator
00109     /*!
00110       This operation checks if the current iterator rank is biger than the other one.
00111       \return true is the current iterator rank is biger. False otherwize.
00112     */
00113     //-------------------------------------------------------------------------------
00114     inline bool operator >(const iterator_dag& toComp) {return _rank>toComp._rank;}
00115     //-------------------------------------------------------------------------------
00116 
00117   };
00118 
00119 };
00120 
00121 #endif
 All Classes Files Functions Variables Defines