27 #ifndef MLN_CORE_CONCEPT_BOX_HH
28 # define MLN_CORE_CONCEPT_BOX_HH
34 # include <mln/core/concept/site_set.hh>
61 unsigned len(
unsigned i)
const;
73 const E&
bbox()
const;
101 template <
typename Bl,
typename Br>
102 bool operator<=(const Box<Bl>& lhs,
const Box<Br>&
rhs);
112 template <
typename Bl,
typename Br>
113 bool operator<(const Box<Bl>& lhs,
const Box<Br>&
rhs);
118 # ifndef MLN_INCLUDE_ONLY
122 template <
typename E>
129 template <
typename E>
134 exact(
this)->is_valid()
135 ?
static_cast<unsigned>(1 +
exact(
this)->pmax()[i]
136 -
exact(
this)->pmin()[i])
140 template <
typename E>
144 typedef mln_site(E)
site;
145 site (E::*m1)() const = & E::pmin;
147 site (E::*m2)() const = & E::pmax;
151 template <typename E>
156 if (!
exact(
this)->is_valid())
159 typedef mln_site(E) P;
160 for (
unsigned i = 0; i < P::dim; ++i)
161 count *=
exact(this)->len(i);
165 template <typename E>
168 Box<E>::is_empty()
const
171 return !
exact(
this)->is_valid();
177 template <
typename Bl,
typename Br>
179 bool operator<=(const Box<Bl>& lhs_,
const Box<Br>& rhs_)
182 const Bl& lhs =
exact(lhs_);
184 typedef mln_site(Bl) P;
185 for (
unsigned i = 0; i < P::dim; ++i)
186 if (lhs.pmin()[i] < rhs.pmin()[i] ||
187 lhs.pmax()[i] > rhs.pmax()[i])
192 template <typename Bl, typename Br>
194 bool operator<(const Box<Bl>& lhs_, const Box<Br>& rhs_)
197 const Bl& lhs =
exact(lhs_);
198 const Br& rhs =
exact(rhs_);
199 return lhs <= rhs && ! (lhs ==
rhs);
202 # endif // ! MLN_INCLUDE_ONLY
207 #endif // ! MLN_CORE_CONCEPT_BOX_HH