00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef MLN_CORE_INTERNAL_NEIGHB_NITER_BASE_HH
00027 # define MLN_CORE_INTERNAL_NEIGHB_NITER_BASE_HH
00028
00032
00033 # include <mln/core/internal/site_relative_iterator_base.hh>
00034 # include <mln/core/internal/neighb_niter_impl.hh>
00035
00036 namespace mln
00037 {
00038
00039 namespace internal
00040 {
00041
00042
00043
00044 template <typename W, typename N, typename I, typename E>
00045 class neighb_niter_base
00046 : public internal::site_relative_iterator_base< N,
00047 E,
00048 mln_psite(N) >,
00049 public internal::neighb_niter_impl<W,E>
00050 {
00051 public:
00052
00054 neighb_niter_base();
00055
00056 template <typename P>
00057 neighb_niter_base(const N& nbh, const P& c);
00058
00060 bool is_valid_() const;
00061
00063 void invalidate_();
00064
00066 void do_start_();
00067
00069 void do_next_();
00070
00072 mln_psite(W) compute_p_() const;
00073
00074 protected:
00075
00076 I i_;
00077 };
00078
00079
00080
00081 # ifndef MLN_INCLUDE_ONLY
00082
00083
00084
00085
00086 template <typename W, typename N, typename I, typename E>
00087 inline
00088 neighb_niter_base<W,N,I,E>::neighb_niter_base()
00089 {
00090 }
00091
00092 template <typename W, typename N, typename I, typename E>
00093 template <typename P>
00094 inline
00095 neighb_niter_base<W,N,I,E>::neighb_niter_base(const N& nbh, const P& c)
00096 {
00097 this->change_target(nbh);
00098 this->center_at(c);
00099
00100 }
00101
00102 template <typename W, typename N, typename I, typename E>
00103 inline
00104 bool
00105 neighb_niter_base<W,N,I,E>::is_valid_() const
00106 {
00107 return i_.is_valid();
00108 }
00109
00110 template <typename W, typename N, typename I, typename E>
00111 inline
00112 void
00113 neighb_niter_base<W,N,I,E>::invalidate_()
00114 {
00115 i_.invalidate();
00116 }
00117
00118 template <typename W, typename N, typename I, typename E>
00119 inline
00120 void
00121 neighb_niter_base<W,N,I,E>::do_start_()
00122 {
00123 i_.start();
00124 }
00125
00126 template <typename W, typename N, typename I, typename E>
00127 inline
00128 void
00129 neighb_niter_base<W,N,I,E>::do_next_()
00130 {
00131 i_.next();
00132 }
00133
00134 template <typename W, typename N, typename I, typename E>
00135 inline
00136 mln_psite(W)
00137 neighb_niter_base<W,N,I,E>::compute_p_() const
00138 {
00139 return i_.compute_p_();
00140 }
00141
00142
00143 # endif // ! MLN_INCLUDE_ONLY
00144
00145
00146 }
00147
00148 }
00149
00150
00151 #endif // ! MLN_CORE_INTERNAL_NEIGHB_NITER_BASE_HH