26 #ifndef MLN_CORE_SITE_SET_P_IMAGE_HH
27 # define MLN_CORE_SITE_SET_P_IMAGE_HH
37 # include <mln/core/site_set/p_if.hh>
38 # include <mln/fun/ops.hh>
39 # include <mln/pw/value.hh>
40 # include <mln/pw/cst.hh>
41 # include <mln/data/fill_with_value.hh>
49 template <
typename I>
class p_image;
56 struct site_set_< p_image<I> >
58 typedef trait::site_set::nsites::known
nsites;
59 typedef trait::site_set::bbox::unknown bbox;
60 typedef trait::site_set::contents::free contents;
61 typedef trait::site_set::arity::unique arity;
71 struct p_image_site_set
74 typedef mln_domain(I) S_;
75 typedef fun::eq_v2b_expr_< pw::value_<I>, pw::cst_<
bool> > F_;
77 typedef p_if<S_, F_> ret;
125 bool has(const psite&) const;
129 bool is_valid() const;
132 unsigned nsites() const;
139 void insert(const psite& p);
145 void remove(const psite& p);
149 void toggle(const psite& p);
153 std::
size_t memory_size() const;
161 const I& image_hook_() const;
170 # ifndef MLN_INCLUDE_ONLY
172 template <
typename I>
176 S tmp(ima_.domain(), pw::value(ima_) == pw::cst(
true));
180 template <
typename I>
187 template <
typename I>
191 mln_precondition(ima.is_valid());
196 template <
typename I>
201 mln_precondition(is_valid());
202 return ima_.domain().has(p) && ima_(p) ==
true;
205 template <
typename I>
210 return ima_.is_valid();
213 template <
typename I>
221 template <
typename I>
226 mln_precondition(is_valid());
227 mln_precondition(ima_.domain().has(p));
234 template <
typename I>
239 mln_precondition(is_valid());
240 mln_precondition(ima_.domain().has(p));
241 if (ima_(p) ==
false)
244 mln_assertion(nsites_ > 0);
248 template <
typename I>
253 mln_precondition(is_valid());
254 mln_precondition(ima_.domain().has(p));
259 mln_assertion(nsites_ > 0);
270 template <
typename I>
276 return sizeof(*this);
280 template <
typename I>
291 template <
typename I>
296 mln_precondition(is_valid());
300 # endif // ! MLN_INCLUDE_ONLY
305 #endif // ! MLN_CORE_SITE_SET_P_IMAGE_HH