3023: Fix 'implies' test and doc tutorial examples.

https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Fix 'implies' test and doc tutorial examples. * doc/tutorial/examples/image_if.cc, * doc/tutorial/examples/image2d.cc, * doc/tutorial/examples/sub_image_if.cc, * doc/tutorial/examples/for_Z.cc, * doc/tutorial/examples/p_run.cc, * doc/tutorial/examples/p_mutable_array_of.cc: Fix missing updates. * mln/core/site_set/p_array.hh: Upgrade doc style. (p_indexed_psite, change_index, dec_index, inc_index): Use update_. (subj_): Do not update_; instead, test that update is effective. * mln/core/contract.hh (implies): Fix. doc/tutorial/examples/for_Z.cc | 2 - doc/tutorial/examples/image2d.cc | 4 +- doc/tutorial/examples/image_if.cc | 4 +- doc/tutorial/examples/p_mutable_array_of.cc | 2 - doc/tutorial/examples/p_run.cc | 2 - doc/tutorial/examples/sub_image_if.cc | 2 - mln/core/contract.hh | 10 +++---- mln/core/site_set/p_array.hh | 40 ++++++++++++++-------------- 8 files changed, 33 insertions(+), 33 deletions(-) Index: doc/tutorial/examples/image_if.cc --- doc/tutorial/examples/image_if.cc (revision 3022) +++ doc/tutorial/examples/image_if.cc (working copy) @@ -72,7 +72,7 @@ // FIXME: border::fill(ima, 0); debug::iota(ima); - mln_VAR(ima_, ima | fun::p2b::chess); + mln_VAR(ima_, ima | fun::p2b::chess()); debug::println(ima); debug::println(ima_); @@ -80,7 +80,7 @@ trait::image::print(ima_); std::cout << std::endl; - typedef p_if<box2d, fun::p2b::chess_t> S; + typedef p_if<box2d, fun::p2b::chess> S; ch_target(mln_fwd_piter_(S)(), ima_.domain()); // mln_VAR(ima_e, extend(ima_, pw::value(ima))); Index: doc/tutorial/examples/image2d.cc --- doc/tutorial/examples/image2d.cc (revision 3022) +++ doc/tutorial/examples/image2d.cc (working copy) @@ -6,7 +6,7 @@ # include <mln/debug/println.hh> # include <mln/core/alias/neighb2d.hh> -# include <mln/estim/nsites.hh> +# include <mln/geom/nsites.hh> template <typename I, typename W, typename P> @@ -45,7 +45,7 @@ debug::iota(ima); debug::println(ima); mln_assertion(ima.nsites() == 6); - mln_assertion(estim::nsites(ima) == ima.nsites()); + mln_assertion(geom::nsites(ima) == ima.nsites()); window2d win; win Index: doc/tutorial/examples/sub_image_if.cc --- doc/tutorial/examples/sub_image_if.cc (revision 3022) +++ doc/tutorial/examples/sub_image_if.cc (working copy) @@ -68,7 +68,7 @@ {1, 0, 1, 1, 1}, {1, 0, 0, 0, 0} }; - image2d<bool> ima = make::image2d(vals); + image2d<bool> ima = make::image(vals); debug::println(ima); int_u8 nlabels; Index: doc/tutorial/examples/for_Z.cc --- doc/tutorial/examples/for_Z.cc (revision 3022) +++ doc/tutorial/examples/for_Z.cc (working copy) @@ -135,7 +135,7 @@ {1, 0, 1, 1, 1}, {1, 0, 0, 0, 0} }; - image2d<bool> ima = make::image2d(vals); + image2d<bool> ima = make::image(vals); debug::println(ima); int_u8 nlabels; Index: doc/tutorial/examples/p_run.cc --- doc/tutorial/examples/p_run.cc (revision 3022) +++ doc/tutorial/examples/p_run.cc (working copy) @@ -32,7 +32,7 @@ {0, 0, 1, 1, 1}, {1, 1, 1, 0, 0} }; - image2d<bool> ima = make::image2d(vals); + image2d<bool> ima = make::image(vals); debug::println(ima); Runs rs; Index: doc/tutorial/examples/p_mutable_array_of.cc --- doc/tutorial/examples/p_mutable_array_of.cc (revision 3022) +++ doc/tutorial/examples/p_mutable_array_of.cc (working copy) @@ -35,7 +35,7 @@ {0, 0, 1, 1, 1}, {1, 1, 1, 0, 0} }; - image2d<bool> ima = make::image2d(vals); + image2d<bool> ima = make::image(vals); debug::println(ima); typedef p_mutable_array_of< p_run<point2d> > Runs; Index: mln/core/site_set/p_array.hh --- mln/core/site_set/p_array.hh (revision 3022) +++ mln/core/site_set/p_array.hh (working copy) @@ -28,15 +28,14 @@ #ifndef MLN_CORE_SITE_SET_P_ARRAY_HH # define MLN_CORE_SITE_SET_P_ARRAY_HH -/*! \file mln/core/site_set/p_array.hh - * - * \brief Definition of a point set class based on std::vector. - * - * \todo Add a facade to index_of_in so that it dispatches when - * calling it with Object<p_array_site>. - * - * \todo Use util::index (instead of int) as many times as possible. - */ +/// \file mln/core/site_set/p_array.hh +/// +/// Definition of a point set class based on std::vector. +/// +/// \todo Add a facade to index_of_in so that it dispatches when +/// calling it with Object<p_array_site>. +/// +/// \todo Use util::index (instead of int) as many times as possible. # include <vector> @@ -74,10 +73,10 @@ - /*! \brief Site set class based on std::vector. - * - * This is a multi-set of sites. - */ + /// Site set class based on std::vector. + /// + /// This is a multi-set of sites. + /// template <typename P> class p_array : public internal::site_set_base_< P, p_array<P> > { @@ -172,8 +171,8 @@ - // p_indexed_psite<P> - + /// Psite class for indexed site sets such as p_array<P>. + /// template <typename S> class p_indexed_psite : public internal::pseudo_site_base_< const mln_element(S)&, p_indexed_psite<S> > @@ -498,6 +497,7 @@ : s_(& s), i_(i) { + update_(); } template <typename S> @@ -514,6 +514,7 @@ p_indexed_psite<S>::change_index(int i) { i_ = i; + update_(); } template <typename S> @@ -522,6 +523,7 @@ p_indexed_psite<S>::dec_index() { --i_; + update_(); } template <typename S> @@ -530,6 +532,7 @@ p_indexed_psite<S>::inc_index() { ++i_; + update_(); } template <typename S> @@ -562,7 +565,8 @@ const mln_element(S)& p_indexed_psite<S>::subj_() { - update_(); // In case of... + if (is_valid()) + mln_invariant(p_ == (*s_)[i_]); return p_; } @@ -621,7 +625,6 @@ p_indexed_fwd_piter<S>::start_() { p_.change_index(0); - p_.update_(); } template <typename S> @@ -630,7 +633,6 @@ p_indexed_fwd_piter<S>::next_() { p_.inc_index(); - p_.update_(); } template <typename S> @@ -680,7 +682,6 @@ p_indexed_bkd_piter<S>::start_() { p_.change_index(s_->nsites() - 1); - p_.update_(); } template <typename S> @@ -689,7 +690,6 @@ p_indexed_bkd_piter<S>::next_() { p_.dec_index(); - p_.update_(); } template <typename S> Index: mln/core/contract.hh --- mln/core/contract.hh (revision 3022) +++ mln/core/contract.hh (working copy) @@ -1,4 +1,5 @@ // Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -28,10 +29,9 @@ #ifndef MLN_CORE_CONTRACT_HH # define MLN_CORE_CONTRACT_HH -/*! \file mln/core/contract.hh - * - * \brief Definition of the set of contracts. - */ +/// \file mln/core/contract.hh +/// +/// Definition of the set of contracts. # include <cassert> @@ -70,7 +70,7 @@ inline bool implies(bool lexpr, bool rexpr) { - return ! (rexpr) || (lexpr); + return (! lexpr) || rexpr; } # endif // ! MLN_INCLUDE_ONLY
participants (1)
-
Thierry Geraud