https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Check more preconditions in mln::complex<D>.
* mln/core/complex.hh
(mln::complex<D>::add_face(const faces_set<N, D>&)): Ensure
arguments are consistent with the complex.
complex.hh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
Index: mln/core/complex.hh
--- mln/core/complex.hh (revision 2120)
+++ mln/core/complex.hh (working copy)
@@ -250,7 +250,19 @@
face_handle<N + 1, D>
complex<D>::add_face(const faces_set<N, D>& adjacent_faces)
{
- // FIXME: Ensure ADJACENT_FACES are already part of the complex.
+ typedef typename std::vector< face_handle<N, D> >::const_iterator
iter_t;
+
+ // Ensure ADJACENT_FACES are already part of the complex.
+ /* FIXME: We need additional macros in mln/core/contract.hh for
+ big blocks of preconditions like this one. */
+# ifndef NDEBUG
+ for (iter_t a = adjacent_faces.faces().begin();
+ a != adjacent_faces.faces().end(); ++a)
+ {
+ mln_precondition(&a->cplx() == this);
+ mln_precondition(a->is_valid());
+ }
+# endif // !NDEBUG
face<N + 1, D> f;
/* FIXME: This is not thread-proof (these two lines should
@@ -260,12 +272,9 @@
face_handle<N + 1, D> fh(*this, id);
// Connect F and its ADJACENT_FACES.
- /* FIXME: Use <fonctional> or Milena's functors. */
- for (typename std::vector< face_handle<N, D> >::const_iterator a =
- adjacent_faces.faces().begin();
+ for (iter_t a = adjacent_faces.faces().begin();
a != adjacent_faces.faces().end(); ++a)
connect_(*a, fh);
-
return fh;
}