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_SITE_SET_P_IF_PITER_HH
00027 # define MLN_CORE_SITE_SET_P_IF_PITER_HH
00028
00034 # include <mln/core/internal/piter_adaptor.hh>
00035 # include <mln/core/site_set/p_if.hh>
00036
00037
00038 namespace mln
00039 {
00040
00041
00049 template <typename Pi, typename S, typename F>
00050 struct p_if_piter_
00051 : public internal::piter_adaptor_< Pi,
00052 p_if<S,F>,
00053 p_if_piter_<Pi,S,F> >
00054 {
00056 p_if_piter_();
00057
00059 p_if_piter_(const p_if<S,F>& s);
00060
00062 void start_();
00063
00065 void next_();
00066
00068 void pi_change_target_(const p_if<S,F>& s);
00069
00070 private:
00071 typedef p_if_piter_<Pi,S,F> self_;
00072 typedef internal::piter_adaptor_<Pi, p_if<S,F>, self_> super_;
00073
00074 protected:
00075 using super_::s_;
00076 using super_::pi_;
00077 };
00078
00079
00080
00081 # ifndef MLN_INCLUDE_ONLY
00082
00083 template <typename Pi, typename S, typename F>
00084 inline
00085 p_if_piter_<Pi,S,F>::p_if_piter_()
00086 {
00087 }
00088
00089 template <typename Pi, typename S, typename F>
00090 inline
00091 p_if_piter_<Pi,S,F>::p_if_piter_(const p_if<S,F>& s)
00092 {
00093 this->change_target(s);
00094 }
00095
00096 template <typename Pi, typename S, typename F>
00097 inline
00098 void
00099 p_if_piter_<Pi,S,F>::start_()
00100 {
00101 pi_.start();
00102 while (pi_.is_valid() && ! s_->pred(pi_))
00103 pi_.next();
00104 }
00105
00106 template <typename Pi, typename S, typename F>
00107 inline
00108 void
00109 p_if_piter_<Pi,S,F>::next_()
00110 {
00111 do
00112 pi_.next();
00113 while (pi_.is_valid() && ! s_->pred(pi_));
00114 }
00115
00116 template <typename Pi, typename S, typename F>
00117 inline
00118 void
00119 p_if_piter_<Pi,S,F>::pi_change_target_(const p_if<S,F>& s)
00120 {
00121 pi_.change_target(s.overset());
00122 }
00123
00124 # endif // ! MLN_INCLUDE_ONLY
00125
00126 }
00127
00128
00129 #endif // ! MLN_CORE_SITE_SET_P_IF_PITER_HH