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
00027 #ifndef MLN_CORE_INTERNAL_SITE_ITERATOR_BASE_HH
00028 # define MLN_CORE_INTERNAL_SITE_ITERATOR_BASE_HH
00029
00033
00034
00035 # include <mln/core/concept/site_iterator.hh>
00036 # include <mln/core/concept/pseudo_site.hh>
00037
00038
00039
00040 namespace mln
00041 {
00042
00043 namespace internal
00044 {
00045
00056 template <typename S, typename E>
00057 struct site_iterator_base : Site_Iterator<E>,
00058 proxy_impl< const mln_psite(S)&, E>
00059 {
00061 typedef S target;
00062
00064 typedef mln_site(S) site;
00065
00067 const mln_site(S)& to_site() const;
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00080 const mln_psite(S)& subj_();
00081
00083 const S*& target_();
00084
00085 protected:
00086
00087 site_iterator_base();
00088
00090 const S* s_;
00091
00092 private:
00093
00094 typedef proxy_impl< const mln_psite(S)&, E> super_;
00095 };
00096
00097
00098 #ifndef MLN_INCLUDE_ONLY
00099
00100 template <typename S, typename E>
00101 inline
00102 site_iterator_base<S, E>::site_iterator_base()
00103 : s_(0)
00104 {
00105 }
00106
00107 template <typename S, typename E>
00108 inline
00109 const mln_site(S)&
00110 site_iterator_base<S, E>::to_site() const
00111 {
00112 mln_precondition(exact(*this).is_valid());
00113 return this->get_subject();
00114 }
00115
00116 template <typename S, typename E>
00117 inline
00118 const mln_psite(S)&
00119 site_iterator_base<S, E>::subj_()
00120 {
00121 return exact(this)->p_hook_();
00122 }
00123
00124 template <typename S, typename E>
00125 inline
00126 const S*&
00127 site_iterator_base<S, E>::target_()
00128 {
00129 return s_;
00130 }
00131
00132 #endif // ! MLN_INCLUDE_ONLY
00133
00134 }
00135
00136 }
00137
00138
00139 #endif // ! MLN_CORE_INTERNAL_SITE_ITERATOR_BASE_HH