00001
00002
00016
00017
00018 #ifndef polybori_iterators_CCuddFirstIter_h_
00019 #define polybori_iterators_CCuddFirstIter_h_
00020
00021
00022 #include "CCuddNavigator.h"
00023
00024
00025 #include <boost/iterator/iterator_facade.hpp>
00026
00027 BEGIN_NAMESPACE_PBORI
00028
00035 class CCuddFirstIter :
00036 public boost::iterator_facade<
00037 CCuddFirstIter,
00038 CCuddNavigator::value_type,
00039 std::forward_iterator_tag,
00040 CCuddNavigator::reference
00041 > {
00042
00043 public:
00044
00046 typedef std::forward_iterator_tag iterator_category;
00047
00049 typedef CCuddFirstIter self;
00050
00052 typedef CCuddNavigator navigator;
00053
00055 typedef navigator::const_access_type const_access_type;
00056
00058 typedef navigator::bool_type bool_type;
00059
00061 CCuddFirstIter(): m_navi() {}
00062
00064 CCuddFirstIter(navigator rhs): m_navi(rhs) { terminateConstant(); }
00065
00067 ~CCuddFirstIter() {}
00068
00070 void increment() {
00071 m_navi.incrementThen();
00072 terminateConstant();
00073 }
00074
00076 bool_type equal (const self& rhs) const { return (m_navi == rhs.m_navi); }
00077
00079 navigator::reference dereference() const { return *m_navi; }
00080
00082 bool_type isEnd() const { return !m_navi.isValid(); }
00083
00084 protected:
00086 void terminateConstant() {
00087 if (m_navi.isConstant())
00088 *this = self();
00089
00090 }
00091
00093 navigator m_navi;
00094 };
00095
00096 END_NAMESPACE_PBORI
00097
00098 #endif