26 #ifndef MLN_CORE_INTERNAL_NEIGHBORHOOD_BASE_HH
27 # define MLN_CORE_INTERNAL_NEIGHBORHOOD_BASE_HH
36 # include <mln/core/concept/neighborhood.hh>
37 # include <mln/core/concept/window.hh>
47 template <
unsigned n,
typename W,
typename F>
55 template <
typename W,
typename E>
56 struct neighborhood_extra_impl
61 template <
typename W,
typename F,
typename E>
62 struct neighborhood_extra_impl< win::multiple_size<2,W,F>, E >
63 :
public Neighborhood<E>
70 neighb<W> foreground()
const
72 W win = internal::force_exact<E>(*this).win().window_(1);
83 W win = internal::force_exact<E>(*this).win().window_(0);
93 template <
typename W,
typename E>
94 struct neighborhood_impl :
public neighborhood_extra_impl<W,E>
100 unsigned size()
const;
104 unsigned delta()
const;
108 const mln_dpsite(W)& dp(
unsigned i)
const;
118 template <
typename W,
typename E>
119 struct neighborhood_base :
public neighborhood_impl<W,E>
125 typedef mln_dpsite(W) dpsite;
128 typedef mln_psite(W) psite;
131 typedef mln_site(W) site;
134 bool is_valid() const;
143 # ifndef MLN_INCLUDE_ONLY
148 template <
typename W,
typename E>
150 neighborhood_base<W,E>::neighborhood_base()
154 template <
typename W,
typename E>
157 neighborhood_base<W,E>::is_valid()
const
164 template <
typename W,
typename E>
167 neighborhood_impl<W,E>::size()
const
169 mlc_is(mln_trait_window_size(W),
170 trait::window::size::fixed)::check();
171 return exact(
this)->win().size();
174 template <
typename W,
typename E>
177 neighborhood_impl<W,E>::delta()
const
179 mlc_is(mln_trait_window_support(W),
180 trait::window::support::regular)::check();
181 mlc_is_not(mln_trait_window_definition(W),
182 trait::window::definition::varying)::check();
183 return exact(
this)->win().delta();
186 template <
typename W,
typename E>
189 neighborhood_impl<W,E>::dp(
unsigned i)
const
191 mlc_is(mln_trait_window_support(W),
192 trait::window::support::regular)::check();
193 mlc_is(mln_trait_window_definition(W),
194 trait::window::definition::unique)::check();
195 return exact(
this)->win().dp(i);
198 # endif // ! MLN_INCLUDE_ONLY
205 #endif // ! MLN_CORE_INTERNAL_NEIGHBORHOOD_BASE_HH