27 #ifndef MLN_WIN_MULTIPLE_SIZE_HH
28 # define MLN_WIN_MULTIPLE_SIZE_HH
36 # include <mln/core/internal/window_base.hh>
37 # include <mln/core/internal/site_relative_iterator_base.hh>
38 # include <mln/util/array.hh>
39 # include <mln/metal/ands.hh>
49 template <
unsigned n,
typename W,
typename F>
class multiple_size;
50 template <
unsigned n,
typename W,
typename F>
class multiple_size_qiter;
52 template <
typename D>
class window;
59 template <
unsigned n,
typename W,
typename F>
60 struct window_<
win::multiple_size<n,W,F> >
62 typedef trait::window::size::unknown
size;
63 typedef trait::window::support::regular
support;
64 typedef trait::window::definition::n_ary
definition;
78 template <
unsigned n,
typename W,
typename F>
83 private metal::ands< mlc_bool(n > 1),
84 mlc_is(mln_trait_window_size(W),
85 trait::window::size::fixed),
86 mlc_is(mln_trait_window_support(W),
87 trait::window::support::regular) >::check_t
111 const W&
window_(
unsigned i) const;
119 const mln_dpsite(W)&
ith_dp_around(
unsigned i, const mln_psite(W)&
p) const;
127 unsigned delta() const;
136 template <
unsigned n, typename W, typename F>
138 : public internal::site_relative_iterator_base<
multiple_size<n,W,F>,
147 template <
typename P>
150 template <
typename P>
154 bool is_valid_()
const;
166 mln_psite(W) compute_p_()
const;
175 # ifndef MLN_INCLUDE_ONLY
179 template <
unsigned n,
typename W,
typename F>
186 template <
unsigned n,
typename W,
typename F>
193 template <
unsigned n,
typename W,
typename F>
198 return win_.is_empty();
201 template <
unsigned n,
typename W,
typename F>
206 mln_precondition(i == win_.nelements());
211 template <
unsigned n,
typename W,
typename F>
216 mln_precondition(i < win_.nelements());
220 template <
unsigned n,
typename W,
typename F>
225 return win_.nelements();
228 template <
unsigned n,
typename W,
typename F>
236 template <
unsigned n,
typename W,
typename F>
241 mln_precondition(win_.nelements() >= 1);
242 for (
unsigned i = 0; i < win_.nelements(); ++i)
243 if (! win_[i].is_centered())
248 template <
unsigned n,
typename W,
typename F>
253 mln_precondition(win_.nelements() >= 1);
254 for (
unsigned i = 0; i < win_.nelements(); ++i)
255 if (! win_[i].is_symmetric())
260 template <
unsigned n,
typename W,
typename F>
265 mln_precondition(win_.nelements() >= 1);
266 for (
unsigned i = 0; i < win_.nelements(); ++i)
270 template <
unsigned n,
typename W,
typename F>
275 mln_precondition(win_.nelements() >= 1);
276 unsigned d = win_[0].delta();
277 for (
unsigned i = 1; i < win_.nelements(); ++i)
279 unsigned d_i = win_[i].delta();
286 template <
unsigned n,
typename W,
typename F>
291 mln_precondition(win_.nelements() >= 2);
292 mln_precondition(f_(p) < win_.nelements());
293 return win_[f_(p)].size();
296 template <
unsigned n,
typename W,
typename F>
301 mln_precondition(win_.nelements() >= 2);
302 mln_precondition(f_(p) < win_.nelements());
303 mln_precondition(i < win_[f_(p)].size());
304 return win_[f_(p)].dp(i);
310 template <
unsigned n,
typename W,
typename F>
316 template <
unsigned n,
typename W,
typename F>
317 template <
typename P>
324 template <
unsigned n,
typename W,
typename F>
325 template <
typename P>
337 template <
unsigned n,
typename W,
typename F>
342 return i_ != -1 && i_ < size_();
345 template <
unsigned n,
typename W,
typename F>
353 template <
unsigned n,
typename W,
typename F>
361 template <
unsigned n,
typename W,
typename F>
369 template <
unsigned n,
typename W,
typename F>
372 multiple_size_qiter<n,W,F>::compute_p_()
const
374 return *this->c_ + this->s_->ith_dp_around(i_, *this->c_);
377 template <
unsigned n,
typename W,
typename F>
380 multiple_size_qiter<n,W,F>::size_()
const
382 return int(this->s_->size_around(*this->c_));
385 # endif // ! MLN_INCLUDE_ONLY
393 #endif // ! MLN_WIN_MULTIPLE_SIZE_HH