URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-28 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Rename run_pset.
* mln/core/internal/run_pset.hh: Rename as...
* mln/core/p_runs.hh: ...this.
* tests/run_pset.cc: Rename as...
* tests/p_runs.cc: ...this.
Remove two sources entry.
* tests/Makefile.am: Fix.
---
mln/core/p_runs.hh | 455 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Makefile.am | 2
tests/p_runs.cc | 80 +++++++++
3 files changed, 535 insertions(+), 2 deletions(-)
Index: trunk/milena/tests/run_pset.cc (deleted)
===================================================================
Index: trunk/milena/tests/p_runs.cc
===================================================================
--- trunk/milena/tests/p_runs.cc (revision 0)
+++ trunk/milena/tests/p_runs.cc (revision 1566)
@@ -0,0 +1,80 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/p_runs.cc
+ *
+ * \brief Test on mln::internal::p_runs_ and related tools.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/core/p_runs.hh>
+
+
+template <typename Pset>
+void parc(const Pset& pset)
+{
+ mln_fwd_piter(Pset) it_(pset);
+ for_all(it_)
+ std::cout << it_ << std::endl;
+
+ mln_bkd_piter(Pset) rit_(pset);
+ for_all(rit_)
+ std::cout << rit_ << std::endl;
+}
+
+
+int main()
+{
+ using namespace mln;
+
+ point2d p, q, r;
+ p = make::point2d(2, 4);
+ q = make::point2d(18, 42);
+ r = make::point2d(50, 76);
+
+ // Psite declaration
+ internal::run_psite<point2d> site(p, 5, 0);
+ internal::run_psite<point2d> site2(r, 40, 0);
+
+ // Pset test
+ p_runs_<point2d> ps;
+
+ ps.insert(p_run<point2d>(p, 7));
+ mln_assertion(ps.npoints() == 7);
+
+ ps.insert(p_run<point2d>(q, 42));
+ mln_assertion(ps.npoints() == 49);
+
+ mln_assertion(ps.has(site));
+ mln_assertion(!ps.has(site2));
+
+ ps.insert(p_run<point2d>(r, 14));
+ mln_assertion(!ps.has(site2));
+
+ ps.insert(p_run<point2d>(make::point2d(17,40), 6));
+ // parc(ps);
+}
Index: trunk/milena/tests/Makefile.am
===================================================================
--- trunk/milena/tests/Makefile.am (revision 1565)
+++ trunk/milena/tests/Makefile.am (revision 1566)
@@ -173,8 +173,6 @@
convert_to_tiles_SOURCES = convert_to_tiles.cc
convert_to_p_array_SOURCES = convert_to_p_array.cc
-debug_println_SOURCES = debug_println.cc
-debug_println_with_border_SOURCES = debug_println_with_border.cc
decorated_image_SOURCES = decorated_image.cc
dpoint1d_SOURCES = dpoint1d.cc
dpoint2d_SOURCES = dpoint2d.cc
Index: trunk/milena/mln/core/internal/run_pset.hh (deleted)
===================================================================
Index: trunk/milena/mln/core/p_runs.hh
===================================================================
--- trunk/milena/mln/core/p_runs.hh (revision 0)
+++ trunk/milena/mln/core/p_runs.hh (revision 1566)
@@ -0,0 +1,455 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_P_RUNS_HH
+# define MLN_CORE_P_RUNS_HH
+
+/*! \file mln/core/p_runs.hh
+ *
+ * \brief Definition of mln::internal::p_runs_ class and its iterators
+ * (for internal use only).
+ */
+
+# include <mln/core/internal/point_set_base.hh>
+# include <mln/core/internal/point_iterator_base.hh>
+# include <mln/core/internal/run_psite.hh>
+# include <mln/core/p_run.hh>
+# include <mln/accu/bbox.hh>
+# include <mln/util/lazy_set.hh>
+
+# include <utility>
+
+
+
+namespace mln
+{
+
+ // Forward declaration
+ template <typename P> struct p_runs_fwd_piter_;
+ template <typename P> struct p_runs_bkd_piter_;
+
+
+ /*! \brief p_runs_ class represent a point set used in run_image_ class.
+ *
+ * Parameter \c P is the type of the image point.
+ */
+ template <typename P>
+ class p_runs_ : public internal::point_set_base_< internal::run_psite<P>, p_runs_<P> >
+ {
+ public:
+
+ typedef util::lazy_set_<p_run<P> > container;
+ typedef p_runs_fwd_piter_<P> fwd_piter;
+ typedef p_runs_bkd_piter_<P> bkd_piter;
+
+
+ p_runs_();
+
+ /// Test is \p p belongs to this point set.
+ bool has(const internal::run_psite<P>& p) const;
+
+ /// Give the exact bounding box.
+ const box_<P>& bbox() const;
+
+ /// Give the number of points.
+ typename std::size_t npoints() const;
+
+ /// Insert a range, start at point \p p wit len \p len.
+ void insert(const p_run<P>& pr);
+
+ /// Return the len of the range starting at point \p p.
+ unsigned range_len_(const P& p) const;
+
+ /// Return the container of the pset (internal use only).
+ const container& con() const;
+
+ protected:
+
+ /// Number of points.
+ typename std::size_t npoints_;
+
+ /// Points container
+ container con_;
+
+ /// Exact bounding box.
+ accu::bbox<P> fb_;
+ };
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P>
+ p_runs_<P>::p_runs_() :
+ npoints_(0)
+ {
+ }
+
+ template <typename P>
+ bool
+ p_runs_<P>::has(const internal::run_psite<P>& p) const
+ {
+ for (unsigned i = 0; i < con_.nelements(); ++i)
+ {
+ if (con_[i].first() == p.range_start_() && con_[i].length() > p.index_())
+ return true;
+ }
+ return false;
+ }
+
+ template <typename P>
+ const box_<P>&
+ p_runs_<P>::bbox() const
+ {
+ return fb_.to_result();
+ }
+
+ template <typename P>
+ typename std::size_t
+ p_runs_<P>::npoints() const
+ {
+ return npoints_;
+ }
+
+ template <typename P>
+ void
+ p_runs_<P>::insert(const p_run<P>& pr)
+ {
+ typename std::vector<p_run<P> >::const_iterator iter = con_.vect().begin();
+ while (iter != con_.vect().end() && iter->first() < pr.first())
+ ++iter;
+
+ if (iter != con_.vect().begin())
+ {
+ typename std::vector<p_run<P> >::const_iterator prec = iter;
+ --prec;
+ bool equal = true;
+ for (int i = P::dim - 2; i >= 0; --i)
+ if (!(equal = equal && (prec->first()[i] == pr.first()[i])))
+ break;
+ if (equal)
+ mln_assertion(prec->first()[P::dim - 1] + (signed)prec->length()
+ < pr.first()[P::dim - 1]);
+ }
+
+ if (iter != con_.vect().end())
+ {
+ bool equal = true;
+ for (int i = P::dim - 2; i >= 0; --i)
+ if (!(equal = equal && ((*iter).first()[i] == pr.first()[i])))
+ break;
+ if (equal)
+ mln_assertion(pr.first()[P::dim - 1] + (signed)pr.length()
+ < iter->first()[P::dim - 1]);
+ }
+ con_.insert(pr);
+
+ // update box
+ fb_.take(pr.bbox().pmin());
+ fb_.take(pr.bbox().pmax());
+ // update size
+ npoints_ += pr.npoints();
+ }
+
+ template <typename P>
+ unsigned
+ p_runs_<P>::range_len_(const P& p) const
+ {
+ unsigned i;
+ for (i = 0; i < con_.size(); ++i)
+ {
+ if (con_[i].first == p)
+ return con_[i].second;
+ }
+ mln_assertion(i < con.size());
+
+ //Hack
+ return (con_[i].second);
+ }
+
+ template <typename P>
+ const typename p_runs_<P>::container&
+ p_runs_<P>::con() const
+ {
+ return con_;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ /*! \brief Factorization class for p_runs_iterator_.
+ *
+ * Parameter \c P is the type of the point used in the point set.
+ * Parameter \c E is the exact type of the iterator
+ */
+ template <typename P, typename E>
+ class p_runs_piter_ : public internal::point_iterator_base_< internal::run_psite<P>, E >
+ {
+ public:
+ typedef typename p_runs_<P>::std_container std_container;
+
+ /// Convertion into a point-site.
+ operator internal::run_psite<P> () const;
+
+ /// Convertion into a point.
+ operator P () const;
+
+ /// Reference to the corresponding point.
+ const P& to_point() const;
+
+ /// Access to the current point coordinates.
+ mln_coord(P) operator[](unsigned i) const;
+
+ protected:
+
+ /// Current point.
+ P p_;
+
+ /// Current site.
+ internal::run_psite<P> site_;
+
+ /// Point set container.
+ const std_container& con_;
+
+ p_runs_piter_(const p_runs_<P>& pset);
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P, typename E>
+ p_runs_piter_<P, E>::p_runs_piter_(const p_runs_<P>& pset) :
+ con_(pset.con())
+ {
+ }
+
+ template <typename P, typename E>
+ p_runs_piter_<P, E>::operator internal::run_psite<P> () const
+ {
+ return site_;
+ }
+
+ template <typename P, typename E>
+ p_runs_piter_<P, E>::operator P () const
+ {
+ return p_;
+ }
+
+ template <typename P, typename E>
+ const P&
+ p_runs_piter_<P, E>::to_point() const
+ {
+ mln_precondition(exact(this)->is_valid());
+ return p_;
+ }
+
+ template <typename P, typename E>
+ mln_coord(P)
+ p_runs_piter_<P, E>::operator[] (unsigned i) const
+ {
+ mln_precondition(exact(this)->is_valid());
+ return p_[i];
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ /*! \brief Forward iterator on p_runs_ point set.
+ *
+ * Parameter \c P is the type of the point used in the point set.
+ */
+ template <typename P>
+ class p_runs_fwd_piter_ : public p_runs_piter_<P, p_runs_fwd_piter_<P> >
+ {
+ typedef p_runs_piter_<P, p_runs_fwd_piter_<P> > super;
+ public:
+
+ p_runs_fwd_piter_(const p_runs_<P>& pset);
+
+ /// Test the iterator validity.
+ bool is_valid() const;
+
+ /// Invalidate the iterator.
+ void invalidate();
+
+ /// Start an iteration.
+ void start();
+
+ /// Go to the next point.
+ void next_();
+
+ protected:
+ typename super::std_container::const_iterator it_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P>
+ p_runs_fwd_piter_<P>::p_runs_fwd_piter_(const p_runs_<P>& pset) :
+ super(pset)
+ {
+ it_ = this->con_.end();
+ this->site_.pset_pos_() = this->con_.size();
+ }
+
+ template <typename P>
+ bool
+ p_runs_fwd_piter_<P>::is_valid() const
+ {
+ return it_ != this->con_.end();
+ }
+
+ template <typename P>
+ void
+ p_runs_fwd_piter_<P>::invalidate()
+ {
+ it_ = this->con_.end();
+ this->site_.pset_pos_() = this->con_.size();
+ }
+
+ template <typename P>
+ void
+ p_runs_fwd_piter_<P>::start()
+ {
+ it_ = this->con_.begin();
+ this->site_.range_start_() = it_->first;
+ this->site_.index_() = 0;
+ this->site_.pset_pos_() = 0;
+ this->p_ = it_->first;
+ }
+
+ template <typename P>
+ void
+ p_runs_fwd_piter_<P>::next_()
+ {
+ mln_precondition(this->is_valid());
+ ++(this->site_.index_());
+
+ if (this->site_.index_() >= it_->second)
+ {
+ ++it_;
+ ++this->site_.pset_pos_();
+ this->site_.range_start_() = it_->first;
+ this->site_.index_() = 0;
+ }
+ this->p_ = this->site_.range_start_();
+ this->p_[0] += this->site_.index_();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+ /*! \brief Backward iterator on p_runs_ point set.
+ *
+ * Parameter \c P is the type of the point used in the point set.
+ */
+ template <typename P>
+ class p_runs_bkd_piter_ : public p_runs_piter_<P, p_runs_bkd_piter_<P> >
+ {
+ typedef p_runs_piter_<P, p_runs_bkd_piter_<P> > super;
+ public:
+
+ p_runs_bkd_piter_(const p_runs_<P>& pset);
+
+ /// Test the iterator validity.
+ bool is_valid() const;
+
+ /// Invalidate the iterator.
+ void invalidate();
+
+ /// Start an iteration.
+ void start();
+
+ /// Go to the next point.
+ void next_();
+
+ protected:
+ typename super::std_container::const_reverse_iterator it_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P>
+ p_runs_bkd_piter_<P>::p_runs_bkd_piter_(const p_runs_<P>& pset) :
+ super(pset)
+ {
+ it_ = this->con_.rend();
+ this->site_.pset_pos_() = this->con_.size();
+ }
+
+ template <typename P>
+ bool
+ p_runs_bkd_piter_<P>::is_valid() const
+ {
+ return it_ != this->con_.rend();
+ }
+
+ template <typename P>
+ void
+ p_runs_bkd_piter_<P>::invalidate()
+ {
+ it_ = this->con_.rend();
+ this->site_.pset_pos_() = this->con_.size();
+ }
+
+ template <typename P>
+ void
+ p_runs_bkd_piter_<P>::start()
+ {
+ it_ = this->con_.rbegin();
+ this->site_.range_start_() = it_->first;
+ this->site_.index_() = it_->second - 1;
+ this->site_.pset_pos_() = this->con_.size() - 1;
+ this->p_ = this->site_.range_start_();
+ this->p_[0] += this->site_.index_();
+ }
+
+ template <typename P>
+ void
+ p_runs_bkd_piter_<P>::next_()
+ {
+ mln_precondition(this->is_valid());
+ --(this->site_.index_());
+
+ if (this->site_.index_() + 1 == 0)
+ {
+ ++it_;
+ --this->site_.pset_pos_();
+ this->site_.range_start_() = it_->first;
+ this->site_.index_() = this->it_->second - 1;
+ }
+ this->p_ = this->site_.range_start_();
+ this->p_[0] += this->site_.index_();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_P_RUNS_HH
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-28 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add full tests for border.
* tests/border/adjust_full.cc,
* tests/border/duplicate_full.cc,
* tests/border/fill_full.cc,
* tests/border/mirror_full.cc: New full tests.
* tests/border/duplicate.cc: Fix Doxygen comment.
---
adjust_full.cc | 64 ++++++++
duplicate.cc | 2
duplicate_full.cc | 171 +++++++++++++++++++++++
fill_full.cc | 398 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
mirror_full.cc | 173 +++++++++++++++++++++++
5 files changed, 807 insertions(+), 1 deletion(-)
Index: trunk/milena/tests/border/mirror_full.cc
===================================================================
--- trunk/milena/tests/border/mirror_full.cc (revision 0)
+++ trunk/milena/tests/border/mirror_full.cc (revision 1565)
@@ -0,0 +1,173 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/border/duplicate_full.cc
+ *
+ * \brief Tests on mln::border::duplicate.
+ */
+
+#include <mln/core/image1d.hh>
+#include <mln/core/image2d.hh>
+#include <mln/debug/iota.hh>
+#include <mln/border/mirror.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_s8.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+
+ {
+ (std::cerr << "Test border::mirror on int with border = 3 ... ").flush ();
+
+ typedef int T;
+ int border = 3;
+ int row = 4;
+ int col = 5;
+
+ int r = row + 2 * border;
+ int c = col + 2 * border;
+
+ image2d<T> ima(row, col, border);
+ debug::iota (ima);
+ border::mirror (ima);
+
+ T vs[110] =
+ {
+ 1, 1, 1, 11, 12, 13, 14, 15, 5, 5, 5,
+ 1, 1, 1, 6, 7, 8, 9, 10, 5, 5, 5,
+ 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5,
+ 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3,
+ 8, 7, 6, 6, 7, 8, 9, 10, 10, 9, 8,
+ 13, 12, 11, 11, 12, 13, 14, 15, 15, 14, 13,
+ 18, 17, 16, 16, 17, 18, 19, 20, 20, 19, 18,
+ 16, 16, 16, 16, 17, 18, 19, 20, 20, 20, 20,
+ 16, 16, 16, 11, 12, 13, 14, 15, 20, 20, 20,
+ 16, 16, 16, 6, 7, 8, 9, 10, 20, 20, 20
+ };
+
+ for (int i = 0; i < c * r; ++i)
+ mln_assertion(ima[i] == vs[i]);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ (std::cerr << "Test border::mirror on int_s8 with border = 2 ... ").flush ();
+
+ typedef value::int_s8 T;
+ int border = 2;
+ int row = 4;
+ int col = 5;
+
+ int r = row + 2 * border;
+ int c = col + 2 * border;
+
+ image2d<T> ima(row, col, border);
+ debug::iota (ima);
+ border::mirror (ima);
+
+ T vs[72] =
+ {
+ 1, 1, 6, 7, 8, 9, 10, 5, 5,
+ 1, 1, 1, 2, 3, 4, 5, 5, 5,
+ 2, 1, 1, 2, 3, 4, 5, 5, 4,
+ 7, 6, 6, 7, 8, 9, 10, 10, 9,
+ 12, 11, 11, 12, 13, 14, 15, 15, 14,
+ 17, 16, 16, 17, 18, 19, 20, 20, 19,
+ 16, 16, 16, 17, 18, 19, 20, 20, 20,
+ 16, 16, 11, 12, 13, 14, 15, 20, 20
+ };
+
+ for (int i = 0; i < c * r; ++i)
+ mln_assertion(ima[i] == vs[i]);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ (std::cerr << "Test border::mirror on int_u8 with border = 1 ... ").flush ();
+
+ typedef value::int_u8 T;
+ int border = 1;
+ int row = 4;
+ int col = 5;
+
+ int r = row + 2 * border;
+ int c = col + 2 * border;
+
+ image2d<T> ima(row, col, border);
+ debug::iota (ima);
+ border::mirror (ima);
+
+ T vs[49] =
+ {
+ 1, 1, 2, 3, 4, 5, 5,
+ 1, 1, 2, 3, 4, 5, 5,
+ 6, 6, 7, 8, 9, 10, 10,
+ 11, 11, 12, 13, 14, 15, 15,
+ 16, 16, 17, 18, 19, 20, 20,
+ 16, 16, 17, 18, 19, 20, 20
+ };
+
+ for (int i = 0; i < c * r; ++i)
+ mln_assertion(ima[i] == vs[i]);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ (std::cerr << "Test border::mirror on int with border = 0 ... ").flush ();
+
+ int border = 0;
+ int row = 4;
+ int col = 5;
+
+ int r = row + 2 * border;
+ int c = col + 2 * border;
+
+ image2d<int> ima(row, col, border);
+ debug::iota (ima);
+ border::mirror (ima);
+
+ int vs[20] =
+ {
+ 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20
+ };
+
+ for (int i = 0; i < c * r; ++i)
+ mln_assertion(ima[i] == vs[i]);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+}
Index: trunk/milena/tests/border/adjust_full.cc
===================================================================
--- trunk/milena/tests/border/adjust_full.cc (revision 0)
+++ trunk/milena/tests/border/adjust_full.cc (revision 1565)
@@ -0,0 +1,64 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/border/adjust_full.cc
+ *
+ * \brief Tests on mln::border::adjust.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/border/get.hh>
+#include <mln/border/adjust.hh>
+
+int main()
+{
+ using namespace mln;
+
+ typedef image2d<int> I;
+
+ I ima(3, 3, 2);
+ border::adjust(ima, 3);
+ mln_assertion(border::get(ima) == 3);
+
+ border::adjust(ima, 5);
+ mln_assertion(border::get(ima) == 5);
+
+ border::adjust(ima, 1);
+ mln_assertion(border::get(ima) == 5);
+
+ border::adjust(ima, 4);
+ mln_assertion(border::get(ima) == 5);
+
+ border::adjust(ima, 42);
+ mln_assertion(border::get(ima) == 42);
+
+ border::adjust(ima, 51);
+ mln_assertion(border::get(ima) == 51);
+
+ border::adjust(ima, 2);
+ mln_assertion(border::get(ima) == 51);
+}
Index: trunk/milena/tests/border/duplicate_full.cc
===================================================================
--- trunk/milena/tests/border/duplicate_full.cc (revision 0)
+++ trunk/milena/tests/border/duplicate_full.cc (revision 1565)
@@ -0,0 +1,171 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/border/duplicate_full.cc
+ *
+ * \brief Tests on mln::border::duplicate.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/debug/iota.hh>
+#include <mln/border/duplicate.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_s8.hh>
+
+
+using namespace mln;
+
+int
+main (void)
+{
+ {
+ (std::cerr << "Test border::mirror on int with border = 3 ... ").flush ();
+
+ typedef int T;
+ int border = 3;
+ int row = 4;
+ int col = 5;
+
+ int r = row + 2 * border;
+ int c = col + 2 * border;
+
+ image2d<T> ima(row, col, border);
+ debug::iota (ima);
+ border::duplicate (ima);
+
+ T vs[110] =
+ {
+ 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5,
+ 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5,
+ 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5,
+ 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5,
+ 6, 6, 6, 6, 7, 8, 9, 10, 10, 10, 10,
+ 11, 11, 11, 11, 12, 13, 14, 15, 15, 15, 15,
+ 16, 16, 16, 16, 17, 18, 19, 20, 20, 20, 20,
+ 16, 16, 16, 16, 17, 18, 19, 20, 20, 20, 20,
+ 16, 16, 16, 16, 17, 18, 19, 20, 20, 20, 20,
+ 16, 16, 16, 16, 17, 18, 19, 20, 20, 20, 20
+ };
+
+ for (int i = 0; i < c * r; ++i)
+ mln_assertion(ima[i] == vs[i]);
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ (std::cerr << "Test border::mirror on int_u8 with border = 2 ... ").flush ();
+
+ typedef value::int_u8 T;
+ int border = 2;
+ int row = 4;
+ int col = 5;
+
+ int r = row + 2 * border;
+ int c = col + 2 * border;
+
+ image2d<T> ima(row, col, border);
+ debug::iota (ima);
+ border::duplicate (ima);
+
+ T vs[72] =
+ {
+ 1, 1, 1, 2, 3, 4, 5, 5, 5,
+ 1, 1, 1, 2, 3, 4, 5, 5, 5,
+ 1, 1, 1, 2, 3, 4, 5, 5, 5,
+ 6, 6, 6, 7, 8, 9, 10, 10, 10,
+ 11, 11, 11, 12, 13, 14, 15, 15, 15,
+ 16, 16, 16, 17, 18, 19, 20, 20, 20,
+ 16, 16, 16, 17, 18, 19, 20, 20, 20,
+ 16, 16, 16, 17, 18, 19, 20, 20, 20
+ };
+
+ for (int i = 0; i < c * r; ++i)
+ mln_assertion(ima[i] == vs[i]);
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ (std::cerr << "Test border::mirror on int_s8 with border = 1 ... ").flush ();
+
+ typedef value::int_s8 T;
+ int border = 1;
+ int row = 4;
+ int col = 5;
+
+ int r = row + 2 * border;
+ int c = col + 2 * border;
+
+ image2d<T> ima(row, col, border);
+ debug::iota (ima);
+ border::duplicate (ima);
+
+ T vs[49] =
+ {
+ 1, 1, 2, 3, 4, 5, 5,
+ 1, 1, 2, 3, 4, 5, 5,
+ 6, 6, 7, 8, 9, 10, 10,
+ 11, 11, 12, 13, 14, 15, 15,
+ 16, 16, 17, 18, 19, 20, 20,
+ 16, 16, 17, 18, 19, 20, 20
+ };
+
+ for (int i = 0; i < c * r; ++i)
+ mln_assertion(ima[i] == vs[i]);
+ std::cerr << "OK" << std::endl;
+ }
+
+
+ {
+ (std::cerr << "Test border::mirror on int with border = 0 ... ").flush ();
+
+ typedef int T;
+ int border = 0;
+ int row = 4;
+ int col = 5;
+
+ int r = row + 2 * border;
+ int c = col + 2 * border;
+
+ image2d<T> ima(row, col, border);
+ debug::iota (ima);
+ border::duplicate (ima);
+
+ T vs[20] =
+ {
+ 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20
+ };
+
+ for (int i = 0; i < c * r; ++i)
+ mln_assertion(ima[i] == vs[i]);
+ std::cerr << "OK" << std::endl;
+ }
+
+
+}
Index: trunk/milena/tests/border/fill_full.cc
===================================================================
--- trunk/milena/tests/border/fill_full.cc (revision 0)
+++ trunk/milena/tests/border/fill_full.cc (revision 1565)
@@ -0,0 +1,398 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/border_fill/test_border_fill_image2d_1.cc
+ *
+ * \brief Tests on mln::border::fill.
+ */
+
+#include <mln/border/fill.hh>
+#include <mln/level/fill.hh>
+#include <mln/core/image1d.hh>
+#include <mln/core/image2d.hh>
+#include <mln/core/image3d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u16.hh>
+#include <mln/value/int_s8.hh>
+#include <mln/value/int_s16.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/value/rgb16.hh>
+#include <mln/value/float01_8.hh>
+#include <mln/value/float01_16.hh>
+#include <mln/debug/println_with_border.hh>
+
+using namespace mln;
+
+
+template <typename T>
+int
+check1d(unsigned row, unsigned border, T& value, T& v)
+{
+ image1d<T> ima(row, border);
+ level::fill (ima, v);
+ border::fill (ima, value);
+
+ unsigned i = 0;
+ for(i = 0; i < border; ++i)
+ mln_assertion (ima[i] == value);
+ unsigned bo = border + row;
+ for(; i < bo; ++i)
+ mln_assertion (ima[i] == v);
+ bo += border;
+ for(; i < bo; ++i)
+ mln_assertion (ima[i] == value);
+}
+
+template <typename T>
+int
+check2d(unsigned row, unsigned col, unsigned border, T& value, T& v)
+{
+ image2d<T> ima(row, col, border);
+ level::fill (ima, v);
+ border::fill (ima, value);
+
+ unsigned c = col + 2 * border;
+ unsigned r = row + 2 * border;
+ unsigned bo = c * border + border;
+ unsigned i = 0;
+ unsigned u = col + border;
+ unsigned ww = r * c;
+
+ for(i = 0; i < bo; ++i)
+ mln_assertion (ima[i] == value);
+ bo += c * row;
+ for(; i < bo; ++i)
+ {
+ unsigned cur = i % c;
+ if (cur < border || cur >= u)
+ mln_assertion (ima[i] == value);
+ else
+ mln_assertion (ima[i] == v);
+ }
+ for(; i < ww; ++i)
+ mln_assertion (ima[i] == value);
+}
+
+template <typename T>
+int
+check3d(unsigned sli, unsigned row, unsigned col, unsigned border, T& value, T& v)
+{
+ image3d<T> ima(sli, row, col, border);
+ level::fill (ima, v);
+ border::fill (ima, value);
+
+ unsigned c = col + 2 * border;
+ unsigned r = row + 2 * border;
+ unsigned bo = c * border + border;
+ unsigned i = 0;
+ unsigned u = col + border;
+ unsigned ww = r * c;
+
+ for(i = 0; i < bo; ++i)
+ mln_assertion (ima[i] == value);
+ bo += c * row;
+ for(; i < bo; ++i)
+ {
+ unsigned cur = i % c;
+ if (cur < border || cur >= u)
+ mln_assertion (ima[i] == value);
+ else
+ mln_assertion (ima[i] == v);
+ }
+ for(; i < ww; ++i)
+ mln_assertion (ima[i] == value);
+}
+
+
+int
+main (void)
+{
+ int limits = 10;
+
+ {
+ std::cerr << "Tests border::fill on int:" << std::endl;
+
+ typedef int T;
+ T value = (T) -1;
+ T v = 42;
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ std::cerr << "Tests border::fill on unsigned:" << std::endl;
+
+ typedef unsigned T;
+ T value = (T) -1;
+ T v = 42;
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ std::cerr << "Tests border::fill on int_u8 ... " << std::endl;
+
+ typedef value::int_u8 T;
+ T value = 255;
+ T v = 42;
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ std::cerr << "Tests border::fill on int_u16 ... " << std::endl;
+
+ typedef value::int_u16 T;
+ T value = 65535;
+ T v = 42;
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ std::cerr << "Tests border::fill on int_s8 ... " << std::endl;
+
+ typedef value::int_s8 T;
+ T value = 127;
+ T v = 42;
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ std::cerr << "Tests border::fill on int_s16 ... " << std::endl;
+
+ typedef value::int_s16 T;
+ T value = 32767;
+ T v = 42;
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ std::cerr << "Tests border::fill on rgb8 ... " << std::endl;
+
+ typedef value::rgb8 T;
+ T value = T(255, 255, 255);
+ T v = T(42, 0, 0);
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ std::cerr << "Tests border::fill on rgb16:" << std::endl;
+
+ typedef value::rgb16 T;
+ T value = T(65535, 65535, 65535);
+ T v = T(42, 0, 0);
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+
+ {
+ std::cerr << "Tests border::fill on float01_8:" << std::endl;
+
+ typedef value::float01_8 T;
+ T value = T(0.9999);
+ T v = T(0.111);
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ std::cerr << "Tests border::fill on float01_16:" << std::endl;
+
+ typedef value::float01_16 T;
+ T value = T(0.9999);
+ T v = T(0.111);
+
+ (std::cerr << "in 1d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ check1d(i, j, value, v);
+
+ std::cerr << "OK" << std::endl;
+
+
+ (std::cerr << "in 2d ... ").flush ();
+
+ for (int i = 1; i < limits; ++i)
+ for (int j = 1; j < limits; ++j)
+ for (int k = 1; k < limits; ++k)
+ check2d(i, j, k, value, v);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+
+}
Index: trunk/milena/tests/border/duplicate.cc
===================================================================
--- trunk/milena/tests/border/duplicate.cc (revision 1564)
+++ trunk/milena/tests/border/duplicate.cc (revision 1565)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/border_duplicate/test_border_duplicate_image2d_1.cc
+/*! \file tests/border/duplicate.cc
*
* \brief Tests on mln::border::duplicate.
*/
URL: https://svn.lrde.epita.fr/svn/oln
Git branch: master (HEAD: 9f19321)
ChangeLog:
2007-11-28 Benoit Sigoure <tsuna(a)lrde.epita.fr>
Fix various typos.
* milena/doc/tutorial/slides.tex: Here.
---
milena/ChangeLog | 5 ++++
milena/doc/tutorial/slides.tex | 45 ++++++++++++++++++++-------------------
2 files changed, 28 insertions(+), 22 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index e9416c1..d33a10c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-28 Benoit Sigoure <tsuna(a)lrde.epita.fr>
+
+ Fix various typos.
+ * milena/doc/tutorial/slides.tex: Here.
+
2007-11-28 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Add run-based utilities.
diff --git a/milena/doc/tutorial/slides.tex b/milena/doc/tutorial/slides.tex
index 4a7cee8..68eddc4 100644
--- a/milena/doc/tutorial/slides.tex
+++ b/milena/doc/tutorial/slides.tex
@@ -243,7 +243,7 @@ in head/foot}%
\item Many libraries exist that can fulfill one's needs.
\item If you're happy with your favorite tool, we cannot force you
to change for \mln...
- \item Though, you might have a look at \mln and being seduced!
+ \item Though, you might have a look at \mln and be seduced!
\end{itemize}
\end{block}
@@ -253,7 +253,7 @@ in head/foot}%
\begin{block}{No!}
\begin{itemize}
\item \mln is rather different than available libraries.
- \item A lot of convenient data structures that \emph{really} helps
+ \item A lot of convenient data structures that \emph{really} help
you in developing IP solutions.
\end{itemize}
\end{block}
@@ -310,7 +310,8 @@ $\forall p \in \mathcal{D}(f), \;\; f(p) = \mathit{h}(f(p))$
\smallskip
\begin{lstlisting}[basicstyle={\tiny\sffamily}]
template <typename I, typename H>
-void transform_inplace(Image<I>& f_, const Function_v2v<H>& h_)
+void transform_inplace(Image<I>& f_,
+ const Function_v2v<H>& h_)
{
I& f = exact(f);
const H& h = exact(h_);
@@ -389,7 +390,7 @@ struct transform_inplace
\begin{itemize}
\item Generic...
\item Efficient so that one can process large images.
- \item Quite as easy to use as a C or Java library.
+ \item Almost as easy to use as a C or Java library.
\item Many tools to help writing readable algorithms in a concise way.
\end{itemize}
@@ -552,7 +553,7 @@ tegucigalpa% ls mln
\texttt{arith} & arithmetical operators \\
\texttt{border} & routines about virtual border &
\texttt{canvas} & canvases \\
-\texttt{convert} & conversions routines &
+\texttt{convert} & conversion routines &
\texttt{core} & the library core \\
\texttt{debug} & debugging tools &
\texttt{display} & display tools \\
@@ -605,7 +606,7 @@ tegucigalpa% ls mln
not on implementation details about how to do it
\smallskip
%
- \item you do not have found yet a library to easily process your
+ \item you have not yet found a library to easily process your
particular types of data
\end{itemize}
@@ -824,9 +825,9 @@ note that \code{p.row() = 7} looks more natural than \code{set\_row(\&p, 7)}.
\begin{frame}[fragile]
\frametitle{Modifying the State of an Object (2/2)}
- accessing and modifying through method calls allow some control:
+ accessing and modifying through method calls allow for some control:
\begin{itemize}
- \item one cannot do everything with an object
+ \item one cannot do anything with an object
\item especially putting it in an invalid state
\end{itemize}
@@ -888,7 +889,7 @@ will hopefully produce an error at run-time!
\begin{itemize}
\item no need to take the address (with \&) of an object
\item no pointer arithmetics
- \item no $->$ in use
+ \item no $->$ to access members
\end{itemize}
\item it \emph{always} designates the same object
\begin{itemize}
@@ -995,7 +996,7 @@ so it really performs \code{p.row\_ = 5}
accessible from the user
\begin{itemize}
\item thanks to the keyword \kw{private}
- \item writing \code{p.row\_} outside this class is not allowed (do
+ \item writing \code{p.row\_} outside this class is not allowed (does
not compile)
\end{itemize}
\smallskip
@@ -1003,7 +1004,7 @@ so it really performs \code{p.row\_ = 5}
\item the method \code{row()} is accessible (keyword \kw{public})
\begin{itemize}
\item in the method body we have some room to add code
- \item a simple access to data can performs some clever stuff that
+ \item a simple access to data can perform some clever stuff that
you do not really have to know (neither want to)!
\end{itemize}
\end{itemize}
@@ -1121,7 +1122,7 @@ int main() {
\end{lstlisting}
\begin{itemize}
-\item the variable \code{r} represents an object which type is
+\item the variable \code{r} represents an object whose type
precisely \code{rabbit}
\begin{center}
we say that it is the \emph{exact} type behind this variable
@@ -1165,7 +1166,7 @@ int main() {
\item In that case
\begin{itemize}
\item at compile-time: there are many possible types of objects represented
- \item at run-time: there is one object represented so just type.
+ \item at run-time: there is one object represented so just one type.
\end{itemize}
\end{itemize}
@@ -1184,7 +1185,7 @@ int main() {
About ``classical'' object-orientation:
\begin{itemize}
- \item abstractions (like \code{animal}) leads to poor
+ \item abstractions (like \code{animal}) lead to poor
performance at run-time when involved in intensive scientific code.
%
\item it is due to the fact that the exact type is lost\\
@@ -1340,7 +1341,7 @@ In the following:
\begin{frame}[fragile]
\frametitle{A rationale for Genericity}
-Suppose that you want a routine that computes twice the input:
+Suppose that you want a routine that computes twice its input:
\begin{lstlisting}
int twice(int i) { return 2 * i; }
\end{lstlisting}
@@ -1434,7 +1435,7 @@ In \lstinline@template <typename T> T twice(T t)@
one of the procedure argument ``\code{(T t)}''
%
\item the nature of \code{t} is \code{T}, the nature of \code{T} is
- \code{typename} (so designates a type)
+ \code{typename} (so it designates a type)
%
\item the \cpp keyword introducing a generic piece of code is
\kw{template}
@@ -1476,7 +1477,7 @@ Once this program is compiled
\item \code{int twice(int t) { return 2 * t; }} and
\item \code{float twice(float t) { return 2 * t; }}
\end{itemize}
-\item so it is not so different than with overloading
+\item so it is not so different than overloading
\end{itemize}
except that:
@@ -1762,7 +1763,7 @@ P operator+(const P& p, const D& dp)
}
\end{lstlisting}
-How can we ensure that the delta-point type \code{D} really correspond
+How can we ensure that the delta-point type \code{D} really corresponds
to \code{P}? {\scriptsize (we really do not want \code{P} and
\code{D} resp. being \code{point3d} and \code{dpoint2d}!)}
@@ -1803,7 +1804,7 @@ I operator+(const I& ima1, const I& ima2) {
}
\end{lstlisting}
-What is the problem? (Hint: read both signatures in natural language)
+What is the problem? (Hint: read both signatures out loud)
\end{frame}
@@ -1829,7 +1830,7 @@ Image operator+(const Image& ima1, const Image& ima2) {
\end{lstlisting}
which is clearly not ambiguous (but slow at run-time...)
-where \code{Dpoint} and \code{Image} are abstract class.
+where \code{Dpoint} and \code{Image} are abstract classes.
\end{frame}
@@ -2140,11 +2141,11 @@ This routine:
\scriptsize{it works for any delta-point type}
\smallskip
%
-\item is fast
+\item is fast,
\scriptsize{you cannot get more efficient code}
\smallskip
%
-\item is user-friendly
+\item is user-friendly,
\scriptsize{just write ``\code{dp1 + dp2}'' to add a couple of delta-points}
\end{itemize}
--
SIGOURE Benoit aka Tsuna (SUSv3 compliant)
_____ "Jesus saves, but only Buddha
/EPITA\ Promo 2008.CSI/ACU/YAKA makes incremental backups"
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-28 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Add run-based utilities.
* mln/core/internal/run_pset.hh: Point set based on many runs.
* mln/core/p_array_piter.hh: Add FIXME.
* mln/core/p_run.hh: New, Point set based on a run.
* mln/core/p_run_piter.hh: New.
* mln/util/lazy_set.hh: New, lazy vector of sorted elements.
* tests/run_pset.cc: Update.
---
mln/core/internal/run_pset.hh | 58 +++++--
mln/core/p_array_piter.hh | 2
mln/core/p_run.hh | 226 +++++++++++++++++++++++++++++
mln/core/p_run_piter.hh | 266 ++++++++++++++++++++++++++++++++++
mln/util/lazy_set.hh | 320 ++++++++++++++++++++++++++++++++++++++++++
tests/run_pset.cc | 7
6 files changed, 858 insertions(+), 21 deletions(-)
Index: trunk/milena/tests/run_pset.cc
===================================================================
--- trunk/milena/tests/run_pset.cc (revision 1562)
+++ trunk/milena/tests/run_pset.cc (revision 1563)
@@ -63,17 +63,18 @@
// Pset test
internal::run_pset_<point2d> ps;
- ps.insert(p, 7);
+ ps.insert(p_run<point2d>(p, 7));
mln_assertion(ps.npoints() == 7);
- ps.insert(q, 42);
+ ps.insert(p_run<point2d>(q, 42));
mln_assertion(ps.npoints() == 49);
mln_assertion(ps.has(site));
mln_assertion(!ps.has(site2));
- ps.insert(r, 14);
+ ps.insert(p_run<point2d>(r, 14));
mln_assertion(!ps.has(site2));
+ ps.insert(p_run<point2d>(make::point2d(17,40), 6));
// parc(ps);
}
Index: trunk/milena/mln/core/internal/run_pset.hh
===================================================================
--- trunk/milena/mln/core/internal/run_pset.hh (revision 1562)
+++ trunk/milena/mln/core/internal/run_pset.hh (revision 1563)
@@ -37,9 +37,10 @@
# include <mln/core/internal/point_set_base.hh>
# include <mln/core/internal/point_iterator_base.hh>
# include <mln/core/internal/run_psite.hh>
+# include <mln/core/p_run.hh>
# include <mln/accu/bbox.hh>
+# include <mln/util/lazy_set.hh>
-# include <vector>
# include <utility>
@@ -63,7 +64,7 @@
{
public:
- typedef std::vector<std::pair<P, unsigned> > std_container;
+ typedef util::lazy_set_<p_run<P> > container;
typedef run_fwd_piter_<P> fwd_piter;
typedef run_bkd_piter_<P> bkd_piter;
@@ -80,13 +81,13 @@
typename std::size_t npoints() const;
/// Insert a range, start at point \p p wit len \p len.
- void insert(const P& p, unsigned len);
+ void insert(const p_run<P>& pr);
/// Return the len of the range starting at point \p p.
unsigned range_len_(const P& p) const;
/// Return the container of the pset (internal use only).
- const std_container& con() const;
+ const container& con() const;
protected:
@@ -94,7 +95,7 @@
typename std::size_t npoints_;
/// Points container
- std_container con_;
+ container con_;
/// Exact bounding box.
accu::bbox<P> fb_;
@@ -112,9 +113,9 @@
bool
run_pset_<P>::has(const run_psite<P>& p) const
{
- for (unsigned i = 0; i < con_.size(); ++i)
+ for (unsigned i = 0; i < con_.nelements(); ++i)
{
- if (con_[i].first == p.range_start_() && con_[i].second > p.index_())
+ if (con_[i].first() == p.range_start_() && con_[i].length() > p.index_())
return true;
}
return false;
@@ -136,19 +137,42 @@
template <typename P>
void
- run_pset_<P>::insert(const P& p, unsigned len)
+ run_pset_<P>::insert(const p_run<P>& pr)
{
- P run_pend;
- typename std_container::value_type elt (p, len);
- con_.push_back(elt);
+ typename std::vector<p_run<P> >::const_iterator iter = con_.vect().begin();
+ while (iter != con_.vect().end() && iter->first() < pr.first())
+ ++iter;
+
+ if (iter != con_.vect().begin())
+ {
+ typename std::vector<p_run<P> >::const_iterator prec = iter;
+ --prec;
+ bool equal = true;
+ for (int i = P::dim - 2; i >= 0; --i)
+ if (!(equal = equal && (prec->first()[i] == pr.first()[i])))
+ break;
+ if (equal)
+ mln_assertion(prec->first()[P::dim - 1] + (signed)prec->length()
+ < pr.first()[P::dim - 1]);
+ }
+
+ if (iter != con_.vect().end())
+ {
+ bool equal = true;
+ for (int i = P::dim - 2; i >= 0; --i)
+ if (!(equal = equal && ((*iter).first()[i] == pr.first()[i])))
+ break;
+ if (equal)
+ mln_assertion(pr.first()[P::dim - 1] + (signed)pr.length()
+ < iter->first()[P::dim - 1]);
+ }
+ con_.insert(pr);
// update box
- fb_.take(p);
- run_pend = p;
- run_pend[0] += len - 1;
- fb_.take(run_pend);
+ fb_.take(pr.bbox().pmin());
+ fb_.take(pr.bbox().pmax());
// update size
- npoints_ += len;
+ npoints_ += pr.npoints();
}
template <typename P>
@@ -168,7 +192,7 @@
}
template <typename P>
- const typename run_pset_<P>::std_container&
+ const typename run_pset_<P>::container&
run_pset_<P>::con() const
{
return con_;
Index: trunk/milena/mln/core/p_run.hh
===================================================================
--- trunk/milena/mln/core/p_run.hh (revision 0)
+++ trunk/milena/mln/core/p_run.hh (revision 1563)
@@ -0,0 +1,226 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_P_RUN_HH
+# define MLN_CORE_P_RUN_HH
+
+/*! \file mln/core/p_run.hh
+ *
+ * \brief Definition of a point set class based on std::set.
+ */
+
+# include <mln/core/internal/point_set_base.hh>
+# include <mln/core/internal/set_of.hh>
+# include <mln/accu/bbox.hh>
+
+
+namespace mln
+{
+
+ // Fwd decls.
+ template <typename P> struct p_run_fwd_piter_;
+ template <typename P> struct p_run_bkd_piter_;
+
+ /*! \brief Point set class in run.
+ *
+ * This is a mathematical set of points (not a multi-set). The
+ * parameter \p P shall be a Point type.
+ *
+ * \todo Test if \p P being a Point_Site is ok.
+ */
+ template <typename P>
+ class p_run : public internal::point_set_base_< P, p_run<P> >
+ {
+ public:
+
+ /// Forward Point_Iterator associated type.
+ typedef p_run_fwd_piter_<P> fwd_piter;
+
+ /// Backward Point_Iterator associated type.
+ typedef p_run_bkd_piter_<P> bkd_piter;
+
+ /// Constructor without argument.
+ p_run();
+
+ /// Constructor.
+ p_run(const P& start, std::size_t len);
+
+ /// Set the starting point.
+ void set_run(const P& start, std::size_t len);
+
+ /// Test is \p p belongs to this point set.
+ bool has(const P& p) const;
+
+ /// Give the number of points.
+ std::size_t npoints() const;
+
+ /// Give the length of the run.
+ std::size_t length() const;
+
+ /// Return the \p i-th point.
+ P operator[](unsigned i) const;
+
+ /// Return the first point.
+ const P& first() const;
+
+ /// Give the exact bounding box.
+ const box_<mln_point(P)>& bbox() const;
+
+ /// Set a relation order to p_run.
+ bool operator<(const p_run<P>& rhs) const;
+
+ protected:
+
+ accu::bbox<P> bb_;
+ // FIXME: Add invariant bb_.is_valid() <=> npoints() != 0
+
+ /// The first point of the run.
+ P p_;
+
+ /// The length of the run.
+ std::size_t len_;
+
+ /// For internal use.
+ bool is_valid_;
+ };
+
+ template <typename P>
+ std::ostream& operator<<(std::ostream& out, const p_run<P>& pr)
+ {
+ out << "Run: (" << pr.first() << ", " << pr.length() << ")";
+ return out;
+ }
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P>
+ p_run<P>::p_run()
+ {
+ is_valid_ = false;
+ }
+
+ template <typename P>
+ p_run<P>::p_run(const P& start, std::size_t len)
+ : p_(start),
+ len_(len)
+ {
+ mln_precondition(len != 0);
+ P p = start;
+ bb_.init();
+ bb_.take(p);
+ p[P::dim - 1] += len - 1;
+ bb_.take(p);
+ is_valid_ = true;
+ }
+
+ template <typename P>
+ void
+ p_run<P>::set_run(const P& start, std::size_t len)
+ {
+ mln_precondition(len != 0);
+ p_ = start;
+ len_ = len;
+ P p = start;
+ bb_.init();
+ bb_.take(p);
+ p[P::dim - 1] += len - 1;
+ bb_.take(p);
+ is_valid_ = true;
+ }
+
+ template <typename P>
+ bool
+ p_run<P>::has(const P& p) const
+ {
+ mln_precondition(is_valid_);
+ bool res = true;
+ for (int i = P::dim - 2; i >= 0; --i)
+ if (!(res = (res && p[i] == p_[i])))
+ return false;
+ return (p[P::dim - 1] >= p_[P::dim - 1]
+ && p[P::dim - 1] < p_[P::dim - 1] + (signed)len_);
+ }
+
+ template <typename P>
+ std::size_t
+ p_run<P>::npoints() const
+ {
+ mln_precondition(is_valid_);
+ return len_;
+ }
+
+ template <typename P>
+ std::size_t
+ p_run<P>::length() const
+ {
+ mln_precondition(is_valid_);
+ return len_;
+ }
+
+ template <typename P>
+ P
+ p_run<P>::operator[](unsigned i) const
+ {
+ mln_precondition(is_valid_);
+ mln_precondition(i < npoints());
+ P p = p_;
+ p[P::dim - 1] += i;
+ return p;
+ }
+
+ template <typename P>
+ const P&
+ p_run<P>::first() const
+ {
+ return p_;
+ }
+
+ template <typename P>
+ const box_<mln_point(P)>&
+ p_run<P>::bbox() const
+ {
+ mln_precondition(is_valid_);
+ mln_precondition(npoints() != 0);
+ return bb_.to_result();
+ }
+
+ template <typename P>
+ bool
+ p_run<P>::operator<(const p_run<P>& rhs) const
+ {
+ return (this->p_ < rhs.p_)
+ || (this->p_ == rhs.p_ && this->len_ < rhs.len_);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+# include <mln/core/p_run_piter.hh>
+
+#endif // ! MLN_CORE_P_RUN_HH
Index: trunk/milena/mln/core/p_run_piter.hh
===================================================================
--- trunk/milena/mln/core/p_run_piter.hh (revision 0)
+++ trunk/milena/mln/core/p_run_piter.hh (revision 1563)
@@ -0,0 +1,266 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_P_RUN_PITER_HH
+# define MLN_CORE_P_RUN_PITER_HH
+
+/*! \file mln/core/p_run_piter.hh
+ *
+ * \brief Definition of point iterators on mln::p_run.
+ */
+
+# include <mln/core/p_run.hh>
+
+
+namespace mln
+{
+
+ /*! \brief Forward iterator on points of a p_run<P>.
+ *
+ */
+ template <typename P>
+ struct p_run_fwd_piter_ : public internal::point_iterator_base_< P, p_run_fwd_piter_<P> >
+ {
+ typedef p_run_fwd_piter_<P> self_;
+ typedef internal::point_iterator_base_< P, self_ > super_;
+ public:
+
+ // Make definitions from super class available.
+ enum { dim = super_::dim };
+
+ /// Coordinate associated type.
+ p_run_fwd_piter_(const p_run<P>& pr);
+
+ /// Reference of the corresponding point.
+ const P& to_point() const;
+
+ /// Read-only access to the \p i-th coordinate.
+ mln_coord(P) operator[](unsigned i) const;
+
+ /// Test if the iterator is valid.
+ bool is_valid() const;
+
+ /// Invalidate the iterator.
+ void invalidate();
+
+ /// Start an iteration.
+ void start();
+
+ /// Go to the next point.
+ void next_();
+
+ /// Convert the iterator into a point.
+ operator P() const;
+
+ protected:
+ const p_run<P>& run_;
+ bool is_valid_;
+ P p_;
+ };
+
+
+
+ /*! \brief Backward iterator on points of a p_run<P>.
+ *
+ */
+ template <typename P>
+ struct p_run_bkd_piter_ : public internal::point_iterator_base_< P, p_run_bkd_piter_<P> >
+ {
+ typedef p_run_bkd_piter_<P> self_;
+ typedef internal::point_iterator_base_< P, self_ > super_;
+ public:
+
+ // Make definitions from super class available.
+ enum { dim = super_::dim };
+
+ /// Coordinate associated type.
+ p_run_bkd_piter_(const p_run<P>& pr);
+
+ /// Reference of the corresponding point.
+ const P& to_point() const;
+
+ /// Read-only access to the \p i-th coordinate.
+ mln_coord(P) operator[](unsigned i) const;
+
+ /// Test if the iterator is valid.
+ bool is_valid() const;
+
+ /// Invalidate the iterator.
+ void invalidate();
+
+ /// Start an iteration.
+ void start();
+
+ /// Go to the next point.
+ void next_();
+
+ /// Convert the iterator into a point.
+ operator P() const;
+
+ protected:
+ const p_run<P>& run_;
+ bool is_valid_;
+ P p_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // p_run_fwd_piter_<P>
+
+ template <typename P>
+ p_run_fwd_piter_<P>::p_run_fwd_piter_(const p_run<P>& pr)
+ : run_(pr)
+ {
+ invalidate();
+ }
+
+ template <typename P>
+ const P&
+ p_run_fwd_piter_<P>::to_point() const
+ {
+ mln_precondition(is_valid());
+ return p_;
+ }
+
+ template <typename P>
+ mln_coord(P)
+ p_run_fwd_piter_<P>::operator[](unsigned i) const
+ {
+ mln_precondition(i < dim);
+ mln_precondition(is_valid());
+ return p_[i];
+ }
+
+ template <typename P>
+ bool
+ p_run_fwd_piter_<P>::is_valid() const
+ {
+ return is_valid_;
+ }
+
+ template <typename P>
+ void
+ p_run_fwd_piter_<P>::invalidate()
+ {
+ is_valid_ = false;
+ }
+
+ template <typename P>
+ void
+ p_run_fwd_piter_<P>::start()
+ {
+ p_ = run_.first();
+ is_valid_ = true;
+ }
+
+ template <typename P>
+ void
+ p_run_fwd_piter_<P>::next_()
+ {
+ p_[dim - 1]++;
+ is_valid_ = p_[dim - 1] - run_.first()[dim - 1] < (signed)run_.length();
+ }
+
+ template <typename P>
+ p_run_fwd_piter_<P>::operator P() const
+ {
+ mln_precondition(is_valid());
+ return p_;
+ }
+
+
+ // p_run_bkd_piter_<P>
+
+ template <typename P>
+ p_run_bkd_piter_<P>::p_run_bkd_piter_(const p_run<P>& pr)
+ : run_(pr)
+ {
+ invalidate();
+ }
+
+ template <typename P>
+ const P&
+ p_run_bkd_piter_<P>::to_point() const
+ {
+ mln_precondition(is_valid());
+ return p_;
+ }
+
+ template <typename P>
+ mln_coord(P)
+ p_run_bkd_piter_<P>::operator[](unsigned i) const
+ {
+ mln_precondition(i < dim);
+ mln_precondition(is_valid());
+ return p_[i];
+ }
+
+ template <typename P>
+ bool
+ p_run_bkd_piter_<P>::is_valid() const
+ {
+ return is_valid;
+ }
+
+ template <typename P>
+ void
+ p_run_bkd_piter_<P>::invalidate()
+ {
+ is_valid_ = false;
+ }
+
+ template <typename P>
+ void
+ p_run_bkd_piter_<P>::start()
+ {
+ p_ = run_[run_.length() - 1];
+ is_valid_ = true;
+}
+
+ template <typename P>
+ void
+ p_run_bkd_piter_<P>::next_()
+ {
+ p_[dim - 1]++;
+ is_valid_ = p_[dim - 1] - run_.first()[dim - 1] >= 0;
+ }
+
+ template <typename P>
+ p_run_bkd_piter_<P>::operator P() const
+ {
+ mln_precondition(is_valid());
+ return p_;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_P_RUN_PITER_HH
Index: trunk/milena/mln/core/p_array_piter.hh
===================================================================
--- trunk/milena/mln/core/p_array_piter.hh (revision 1562)
+++ trunk/milena/mln/core/p_array_piter.hh (revision 1563)
@@ -79,7 +79,7 @@
protected:
const std::vector<P>& vect_;
- unsigned i_;
+ unsigned i_; // FIXME: Why it's unsigned in fwd iterator and signed in the bkd one ?
P p_;
};
Index: trunk/milena/mln/util/lazy_set.hh
===================================================================
--- trunk/milena/mln/util/lazy_set.hh (revision 0)
+++ trunk/milena/mln/util/lazy_set.hh (revision 1563)
@@ -0,0 +1,320 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_UTIL_LAZY_SET_HH
+# define MLN_UTIL_LAZY_SET_HH
+
+/*! \file mln/core/internal/lazy_set.hh
+ *
+ * \brief Definition of mln::lazy_set_ for internal use only.
+ */
+
+# include <vector>
+# include <set>
+# include <iterator>
+# include <algorithm>
+
+# include <mln/core/internal/force_exact.hh>
+
+
+namespace mln
+{
+
+ namespace util
+ {
+
+ /*! \brief An "efficient" mathematical set class.
+ *
+ * \internal
+ *
+ * This set class is designed to store a mathematical set and to
+ * present it to the user as a linear array (std::vector).
+ *
+ * Elements are stored by copy. Implementation is lazy.
+ *
+ * \invariant \a v_.size() == s_.size()
+ *
+ * The parameter \c E is the element type, which shall not be
+ * const-qualified.
+ *
+ * \todo Add a remove method.
+ */
+ template <typename E>
+ class lazy_set_
+ {
+ public:
+
+ /// Type of the stored value.
+ typedef E value;
+
+ /*! \brief Insert an element \p elt into the set.
+ *
+ * \param[in] elt The element to be inserted.
+ *
+ * If \p elt is already in the set, this method is a no-op.
+ *
+ * \return The set itself after insertion.
+ */
+ lazy_set_<E>& insert(const E& elt);
+
+
+ /*! \brief Remove an element \p elt into the set.
+ *
+ * \param[in] elt The element to be inserted.
+ *
+ * If \p elt is already in the set, this method is a no-op.
+ *
+ * \return The set itself after suppression.
+ */
+ lazy_set_<E>& remove(const E& elt);
+
+
+ /*! \brief Return the i-th element of the set.
+ *
+ * \param[in] i Index of the element to retrieve.
+ *
+ * \pre i < nelements()
+ *
+ * The element is returned by reference and is constant.
+ */
+ const E& element(unsigned i) const;
+
+ /*! \brief Return the i-th element of the set.
+ *
+ * \param[in] i Index of the element to retrieve.
+ *
+ * \pre i < nelements()
+ *
+ * The element is returned by reference and is constant.
+ */
+ const E& operator[](unsigned i) const;
+
+ /*! \brief Return the number of elements of the set.
+ */
+ unsigned nelements() const;
+
+
+ /*! \brief Test if the object \p elt belongs to the set.
+ *
+ * \param[in] elt A possible element of the set.
+ *
+ * \return True is \p elt is in the set.
+ */
+ bool has(const E& elt) const;
+
+
+ /*! \brief Test if the set is empty.
+ */
+ bool is_empty() const;
+
+
+ /*! \brief Make the set empty.
+ *
+ * All elements contained in the set are destroyed so the set is
+ * emptied.
+ *
+ * \post is_empty() == true
+ */
+ void clear();
+
+
+ /*! \brief Give access to the set elements.
+ *
+ * The complexity of this method is O(1).
+ *
+ * \return An array (std::vector) of elements.
+ */
+ const std::vector<E>& vect() const;
+
+ /// Constructor without arguments.
+ lazy_set_();
+
+ private:
+
+ /*! \brief Array of elements.
+ *
+ * This structure is only updated (if required) when elements
+ * are accessed.
+ */
+ mutable std::vector<E> v_;
+
+ /*! \brief Set of elements.
+ *
+ * This structure is always up-to-date w.r.t. the set contents.
+ */
+ std::set<E> s_;
+
+
+ /*! \brief Update \a v_ from \a s_.
+ *
+ * FIXME: explain.
+ */
+ void update_() const;
+
+ /// Tell if \a v_ needs to be updated.
+ mutable bool needs_update_;
+ };
+
+
+ /*! \brief Print a set \p s into the output stream \p
+ * ostr.
+ *
+ * \param[in,out] ostr An output stream.
+ * \param[in] s A set.
+ *
+ * \return The modified output stream \p ostr.
+ *
+ * \relates mln::internal::lazy_set_
+ */
+ // FIXME : ambiguous with point_set operator <<
+ // template <typename E>
+ // std::ostream& operator<<(std::ostream& ostr, const lazy_set_<E>& s);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ lazy_set_<E>::lazy_set_()
+ {
+ needs_update_ = false;
+ }
+
+ template <typename E>
+ lazy_set_<E>&
+ lazy_set_<E>::insert(const E& elt)
+ {
+ s_.insert(elt);
+ if (needs_update_ == false)
+ needs_update_ = true;
+ return internal::force_exact< lazy_set_<E> >(*this);
+ }
+
+ template <typename E>
+ lazy_set_<E>&
+ lazy_set_<E>::remove(const E& elt)
+ {
+ // FIXME : doesn't compile
+ std::remove(s_.begin(), s_.end(), elt);
+ if (needs_update_ == false)
+ needs_update_ = true;
+ return internal::force_exact< lazy_set_<E> >(*this);
+ }
+
+ template <typename E>
+ const E&
+ lazy_set_<E>::element(unsigned i) const
+ {
+ assert(i < v_.size());
+ if (needs_update_)
+ update_();
+ return v_[i];
+ }
+
+ template <typename E>
+ const E&
+ lazy_set_<E>::operator[](unsigned i) const
+ {
+ return this->element(i);
+ }
+
+ template <typename E>
+ unsigned
+ lazy_set_<E>::nelements() const
+ {
+ if (needs_update_)
+ update_();
+ return v_.size();
+ }
+
+ template <typename E>
+ bool
+ lazy_set_<E>::has(const E& elt) const
+ {
+ return s_.find(elt) != s_.end();
+ }
+
+ template <typename E>
+ bool
+ lazy_set_<E>::is_empty() const
+ {
+ return nelements() == 0;
+ }
+
+ template <typename E>
+ void
+ lazy_set_<E>::clear()
+ {
+ v_.clear();
+ s_.clear();
+ needs_update_ = false;
+ mln_postcondition(is_empty());
+ }
+
+ template <typename E>
+ const std::vector<E>&
+ lazy_set_<E>::vect() const
+ {
+ if (needs_update_)
+ update_();
+ return v_;
+ }
+
+ template <typename E>
+ void
+ lazy_set_<E>::update_() const
+ {
+ mln_precondition(needs_update_);
+ v_.clear();
+ std::copy(s_.begin(), s_.end(), std::back_inserter(v_));
+ // no s_.clear() here:
+ // - we want to keep information up-to-date in s_
+ // - we want to save some execution time
+ needs_update_ = false;
+ }
+
+ // FIXME : ambiguous with point_set operator <<
+ // template <typename E>
+ // std::ostream& operator<<(std::ostream& ostr,
+ // const lazy_set_<E>& s)
+ // {
+ // ostr << '[';
+ // const unsigned n = s.nelements();
+ // for (unsigned i = 0; i < n; ++i)
+ // ostr << s.element(i)
+ // << (i == s.nelements() - 1 ? ']' : ',');
+ // return ostr;
+ // }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::util
+
+} // end of namespace mln
+
+
+#endif // ! MLN_UTIL_LAZY_SET_HH
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-28 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Review debug directory.
* mln/debug/iota.hh: Resolve a fixme due to a resolved bug (in
operator %)
* mln/debug/iota.spe.hh: likewise
* tests/Makefile.am: Move debug tests...
* tests/debug/Makefile.am: ...here
* tests/debug_iota.cc: Rename as...
* tests/debug/iota.cc: ...this.
* tests/debug_println.cc: Rename as...
* tests/debug/println.cc: ...this.
* tests/debug_println_with_border.cc: Rename as...
* tests/debug/println_with_border.cc: ...this.
---
mln/debug/iota.hh | 4 -
mln/debug/iota.spe.hh | 4 -
tests/Makefile.am | 1
tests/debug/Makefile.am | 11 +++++
tests/debug/iota.cc | 57 +++++++++++++++++++++++++++
tests/debug/println.cc | 46 ++++++++++++++++++++++
tests/debug/println_with_border.cc | 76 +++++++++++++++++++++++++++++++++++++
7 files changed, 193 insertions(+), 6 deletions(-)
Index: trunk/milena/tests/debug_println_with_border.cc (deleted)
===================================================================
Index: trunk/milena/tests/debug_iota.cc (deleted)
===================================================================
Index: trunk/milena/tests/debug_println.cc (deleted)
===================================================================
Index: trunk/milena/tests/debug/iota.cc
===================================================================
--- trunk/milena/tests/debug/iota.cc (revision 0)
+++ trunk/milena/tests/debug/iota.cc (revision 1561)
@@ -0,0 +1,57 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/debug_iota.cc
+ *
+ * \brief Tests on mln::debug::iota.
+ */
+
+#include <mln/core/image2d.hh>
+
+#include <mln/value/int_u8.hh>
+
+#include <mln/debug/iota.hh>
+#include <mln/level/compare.hh>
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ {
+ int vs[4][4] = { {1, 2, 3, 4},
+ {5, 6, 7, 8},
+ {9, 10,11,12},
+ {13,14,15,16} };
+
+ image2d<int> ref = make::image2d(vs);
+ image2d<int> ima(4, 4);
+
+ debug::iota(ima);
+ mln_assertion(ima == ref);
+ }
+}
Index: trunk/milena/tests/debug/println_with_border.cc
===================================================================
--- trunk/milena/tests/debug/println_with_border.cc (revision 0)
+++ trunk/milena/tests/debug/println_with_border.cc (revision 1561)
@@ -0,0 +1,76 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/debug_println_with_border.cc
+ *
+ * \brief Test on mln::debug::println_with_border.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/core/image1d.hh>
+#include <mln/level/fill.hh>
+#include <mln/debug/println.hh>
+#include <mln/debug/println_with_border.hh>
+
+
+using namespace mln;
+
+
+int main()
+{
+ border::thickness = 3;
+
+ {
+ image2d<bool> msk(3, 3);
+ msk.at(0, 0) = true;
+ msk.at(1, 0) = true;
+ msk.at(2, 0) = true;
+
+ msk.at(0, 1) = true;
+ msk.at(1, 1) = false;
+ msk.at(2, 1) = true;
+
+ msk.at(0, 2) = true;
+ msk.at(1, 2) = true;
+ msk.at(2, 2) = true;
+
+ debug::println(msk);
+ debug::println_with_border(msk);
+ }
+
+ {
+ image1d<bool> msk(3);
+ msk.at(0) = false;
+ msk.at(1) = true;
+ msk.at(2) = false;
+
+ debug::println(msk);
+ debug::println_with_border(msk);
+
+ }
+
+}
Index: trunk/milena/tests/debug/Makefile.am
===================================================================
--- trunk/milena/tests/debug/Makefile.am (revision 1560)
+++ trunk/milena/tests/debug/Makefile.am (revision 1561)
@@ -1,3 +1,14 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ println \
+ println_with_border \
+ iota
+
+println_SOURCES = println.cc
+println_with_border_SOURCES = println_with_border.cc
+iota_SOURCES = iota.cc
+
+TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/debug/println.cc
===================================================================
--- trunk/milena/tests/debug/println.cc (revision 0)
+++ trunk/milena/tests/debug/println.cc (revision 1561)
@@ -0,0 +1,46 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/debug_println.cc
+ *
+ * \brief Test on mln::debug::println.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/level/fill.hh>
+#include <mln/debug/println.hh>
+
+
+using namespace mln;
+
+
+int main()
+{
+ image2d<bool> msk(3, 3);
+ msk.at(1, 1) = true;
+ debug::println(msk);
+}
Index: trunk/milena/tests/Makefile.am
===================================================================
--- trunk/milena/tests/Makefile.am (revision 1560)
+++ trunk/milena/tests/Makefile.am (revision 1561)
@@ -9,6 +9,7 @@
canvas \
core \
display \
+ debug \
draw \
fun \
histo \
Index: trunk/milena/mln/debug/iota.spe.hh
===================================================================
--- trunk/milena/mln/debug/iota.spe.hh (revision 1560)
+++ trunk/milena/mln/debug/iota.spe.hh (revision 1561)
@@ -54,9 +54,7 @@
unsigned i = 0;
mln_pixter(I) p(input);
for_all(p)
- // FIXME : remove the convertion when the bug will be
- // resolved.
- p.val() = ++i % int(mln_max(mln_value(I)));
+ p.val() = ++i % mln_max(mln_value(I));
}
} // end of namespace mln::debug::impl
Index: trunk/milena/mln/debug/iota.hh
===================================================================
--- trunk/milena/mln/debug/iota.hh (revision 1560)
+++ trunk/milena/mln/debug/iota.hh (revision 1561)
@@ -66,9 +66,7 @@
unsigned i = 0;
mln_piter(I) p(input.domain());
for_all(p)
- // FIXME : remove the convertion when the bug will be
- // resolved.
- input(p) = ++i % int(mln_max(mln_value(I)));
+ input(p) = ++i % mln_max(mln_value(I));
}
} // end of namespace mln::debug::impl
https://svn.lrde.epita.fr/svn/oln/trunk
Fix ChangeLogs.
Clean up white space in ChangeLogs.
Index: ChangeLog
===================================================================
--- ChangeLog (revision 1558)
+++ ChangeLog (revision 1559)
@@ -2,38 +2,6 @@
* configure.ac: Configure milena/tests/core/Makefile.
-2007-11-27 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
-
- Remove all_headers.cc in util.
- * milena/tests/util/Makefile.am: Remove all_headers tests.
-
-2007-11-27 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
-
- Fix bug in Makefile.am.
-
- * milena/tests/arith/Makefile.am,
- * milena/tests/border/Makefile.am,
- * milena/tests/draw/Makefile.am,
- * milena/tests/level/Makefile.am,
- * milena/tests/logical/Makefile.am,
- * milena/tests/util/Makefile.am: Fix.
-
- * milena/tests/arith/all_headers.cc: Remove.
-
-2007-11-26 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
-
- Fix bugs.
- * milena/mln/display/color_pretty.hh: Fix warning.
- * milena/tests/Makefile.am: Add util and display directory.
- * milena/tests/util/Makefile.am: Fix compile bug.
-
-2007-11-26 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
-
- Fix Makefile.am.
-
- * milena/tests/Makefile.am,
- * milena/tests/io/fits/Makefile.am: Delete line of move test.
-
2007-11-26 Roland Levillain <roland(a)lrde.epita.fr>
Move the Olena-NG components elsewhere.
@@ -200,7 +168,7 @@
* Makefile.am (SUBDIRS): Add milena.
* milena/Makefile.am: New.
* milena/doc/Makefile.am, milena/doc/Doxyfile.in:
- New files (copied from LRDE TC's project).
+ New files (copied from LRDE TC's project).
2007-06-28 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
@@ -337,7 +305,7 @@
* configure.ac: Declare CONCEPTCXX as a previous variable.
Look for a Concept C++ compiler, and store it in CONCEPTCXX.
Configure static/samples/Makefile,
- static/samples/mini-oln/Makefile and
+ static/samples/mini-oln/Makefile and
static/samples/mini-oln/concept-c.
2006-10-31 Roland Levillain <roland(a)lrde.epita.fr>
Index: milena/ChangeLog
===================================================================
--- milena/ChangeLog (revision 1558)
+++ milena/ChangeLog (revision 1559)
@@ -52,10 +52,15 @@
convert for graylevel.
* mln/value/graylevel.hh: the graylevel type wasn't compatible with
- the generic convert in convert.hh because of a convertion to int.
+ the generic convert in convert.hh because of a convertion to int.
2007-11-27 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
+ Remove all_headers.cc in util.
+ * tests/util/Makefile.am: Remove all_headers tests.
+
+2007-11-27 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
+
Add convertion of a tree into tree_fast.
* mln/util/tree_to_fast.hh: Add convertion of tree into tree_fast.
@@ -103,8 +108,8 @@
Add an error of incompatible types in pnm loading.
* mln/io/pnm/load.hh: io::ppm::load<rgb8>("image16bits.ppm") now abort
- because we can't store rgb 16 bits into rgb 8 bits (likewise for
- pgm).
+ because we can't store rgb 16 bits into rgb 8 bits (likewise for
+ pgm).
* tests/io/ppm/ppm16.cc: Add some tests due to this update.
@@ -114,10 +119,10 @@
* mln/io/pnm/load.hh: (load(image&, filename)) now work on rgb images.
* mln/io/pnm/max_component.hh: Define a function which give the max of
- the component of a value type.
+ the component of a value type.
* tests/io/pgm/pgm16.cc: Now test the other way to load an image
- (load(image&, filename)).
+ (load(image&, filename)).
* tests/io/ppm/ppm16.cc: likewise.
* img/lena_16.ppm: New, lena, ppm 16 bits.
@@ -127,10 +132,23 @@
Fixes in int_u.
* mln/value/int_u.hh: max() is now mlc_pow_int(2, n) - 1. and
- (unsigned int) is back to (int) (cf my previous patch).
+ (unsigned int) is back to (int) (cf my previous patch).
2007-11-27 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
+ Fix bug in Makefile.am.
+
+ * tests/arith/Makefile.am,
+ * tests/border/Makefile.am,
+ * tests/draw/Makefile.am,
+ * tests/level/Makefile.am,
+ * tests/logical/Makefile.am,
+ * tests/util/Makefile.am: Fix.
+
+ * tests/arith/all_headers.cc: Remove.
+
+2007-11-27 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
+
Add include all tests for some subdirectories.
* mln/border/mirror.hh: Add geom headers.
@@ -197,6 +215,13 @@
2007-11-26 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
+ Fix bugs.
+ * mln/display/color_pretty.hh: Fix warning.
+ * tests/Makefile.am: Add util and display directory.
+ * tests/util/Makefile.am: Fix compile bug.
+
+2007-11-26 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
+
Review util subdirectory.
* mln/util/branch_iter.hh,
@@ -220,6 +245,13 @@
* tests/util/tree.cc,
* tests/util/tree_to_image.cc: Update.
+2007-11-26 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
+
+ Fix Makefile.am.
+
+ * tests/Makefile.am,
+ * tests/io/fits/Makefile.am: Delete line of move test.
+
2007-11-26 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Moves the io's tests.
@@ -264,8 +296,8 @@
2007-11-26 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
svn ignore .deps directories. Update makefiles.
- * milena/tests/Makefile.am: Move accu's checks...
- * milena/tests/accu/Makefile.am: ...here.
+ * tests/Makefile.am: Move accu's checks...
+ * tests/accu/Makefile.am: ...here.
2007-11-26 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
@@ -706,7 +738,7 @@
2007-11-21 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Little fix in test/Makefile.am.
- * milena/tests/Makefile.am: Fix warning.
+ * tests/Makefile.am: Fix warning.
2007-11-20 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
@@ -931,7 +963,7 @@
Review the mln/geom directory.
* mln/geom/seeds2tiling.hh: Clean dead code, update doc. Fixme for
- guillaume : Review the documentation.
+ guillaume : Review the documentation.
* mln/geom/seeds2tiling_with_chamfer.hh: likewise.
Add unit tests.
@@ -997,9 +1029,9 @@
* mln/debug/println.hh: Move spezialisations to println.spe.hh.
* mln/debug/println.spe.hh: New, specializations of println.
* mln/debug/println_with_border.hh: Move spezialisations to
- println_with_border.spe.hh.
+ println_with_border.spe.hh.
* mln/debug/println_with_border.spe.hh: New, specializations of
- println.
+ println.
* tests/debug_iota.cc: New, add a test for iota.
@@ -1096,7 +1128,7 @@
* mln/literal/origin.hh,
* mln/literal/white.hh,
* tests/literal/black.cc: Use extern const ref, not static. Move
- impl. within MLN_INCLUDE_ONLY.
+ impl. within MLN_INCLUDE_ONLY.
Move/add some unit tests.
@@ -1192,7 +1224,7 @@
A better test for io::pbm.
* tests/io_pbm.cc: Take a pgm, binarise it, save it, read it, and
- check we we get the same pbm.
+ check we we get the same pbm.
2007-11-13 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
@@ -1325,11 +1357,11 @@
* sandbox/garrigues/fllt_optimized.hh: Update.
* sandbox/garrigues/fllt_types.hh: New, types used in FLLT.
* sandbox/garrigues/level_set.hh: New, compute lower/upper level set
- algorithm
+ algorithm
* sandbox/garrigues/lower.hh: New, informations about how to compute
- the lower level set.
+ the lower level set.
* sandbox/garrigues/upper.hh: New, informations about how to compute
- the lower level set.
+ the lower level set.
* sandbox/garrigues/test_fllt12.cc: Cleaning, (fllt2.hh) replaced by...
(fllt_optimized.hh) ...this.
@@ -1339,7 +1371,7 @@
* sandbox/garrigues/test_fllt_lena_tiles.cc: Likewise.
* mln/util/branch_iter_ind.hh: Check if the tree has not
- been subject to updates which can invalidate the iterator.
+ been subject to updates which can invalidate the iterator.
* sandbox/garrigues/fllt2.hh: (set_p) replaced by...
{p_set} ...this.
@@ -1618,8 +1650,8 @@
Choice a good root of the merged tree in FLLT.
* sandbox/garrigues/fllt2.hh: (merge_trees) Choose a good root between
- the upper tree's one and the lower tree's one in order to keep the
- good values of the input image.
+ the upper tree's one and the lower tree's one in order to keep the
+ good values of the input image.
(fllt) add a second call to merge_trees to test the contrast
invariant of the algorithm. FIXME : In some test, we get a segv when
calling merge_trees swapping the upper_tree and lower_tree
@@ -1653,21 +1685,21 @@
* sandbox/garrigues/test_fllt2.cc,
* sandbox/garrigues/test_fllt3.cc,
* sandbox/garrigues/test_fllt_tiny.cc: likewise, Update include to
- test fllt2.hh.
+ test fllt2.hh.
2007-11-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Start a second version of merging trees in FLLT.
* sandbox/garrigues/fllt2.hh: New, looks like fllt.hh but differs in
- merge trees. We keep the old file fllt.hh to avoid regression.
+ merge trees. We keep the old file fllt.hh to avoid regression.
2007-11-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Fix an bug in make::image2d.
* mln/make/image2d.hh: (for (unsigned row = 0; row <= R; ++row))
- replaced by...
+ replaced by...
(for (unsigned row = 0; row < R; ++row)) ...this.
2007-11-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
@@ -1675,7 +1707,7 @@
Add box_bounds_piter_ to iterate on the bounds of a box2d.
* mln/core/box_piter.hh: (box_bounds_piter_) New, iterator to iterate
- on the bounds of a box2d.
+ on the bounds of a box2d.
2007-11-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
@@ -1687,14 +1719,14 @@
* sandbox/garrigues/test_fllt9.cc: New,
* sandbox/garrigues/test_fllt_lena.cc: New,
* sandbox/garrigues/test_fllt_lena_tiles.cc: New, test FLLT with
- differents 2d images.
+ differents 2d images.
2007-11-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Fix compilation error in core/concept/box.hh.
* mln/core/concept/box.hh: Add parenthesis to remove an ambiguity at
- the operator !.
+ the operator !.
2007-11-05 Simon Nivault <simon.nivault(a)lrde.epita.fr>
@@ -1922,7 +1954,7 @@
* mln/core/image2d.hh: Include make/image2d.hh at the end of the file.
* mln/make/image2d.hh: New, Add routine to make a image2d with a 2d
- array
+ array
* tests/make_image2d.cc: New, tests on make::image2d.
2007-10-30 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
@@ -2040,7 +2072,7 @@
Improve fllt. Add more tests.
* mln/set/is_subset_of.hh: New, Test if a point set is a subset of
- another.
+ another.
* mln/util/branch_iter.hh: Update
* mln/util/tree.hh: (tree<T>::add_child(node<T>*)) New,
(tree<T>::main_branch()) New.
@@ -2051,7 +2083,7 @@
* sandbox/garrigues/test_fllt4.cc,
* sandbox/garrigues/test_fllt5.cc,
* sandbox/garrigues/test_fllt_tiny.cc: New, differents cases of tests
- for fllt.
+ for fllt.
2007-10-26 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
@@ -2192,7 +2224,7 @@
2007-10-26 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Fix on tree for compiling, and Fix in fllt.
- * mln/util/tree.hh,
+ * mln/util/tree.hh,
* mln/util/tree_fast.hh,
* sandbox/garrigues/fllt.hh: Fix.
@@ -2257,7 +2289,7 @@
Update fllt.
* sandbox/garrigues/fllt.hh: (border_neighb and region_neighb) Rename
- as...
+ as...
(border_neighb and region_neighb) ...this.
2007-10-24 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
@@ -2517,7 +2549,7 @@
2007-10-22 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update of abr.
-
+
* mln/util/abr.hh: Update with better coding style.
* tests/abr.cc: Add assertion in this test.
@@ -2738,7 +2770,7 @@
2007-10-17 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
- Fix namespaces documentation.
+ Fix namespaces documentation.
* mln/arith/all.hh: New,
* mln/canvas/all.hh: New,
@@ -3103,7 +3135,7 @@
* mln/core/h_vec.hh (h_vec): New ctor overload for vec<d+1>.
(operator=): New overload for vec<d+1>.
* mln/metal/mat.hh (trait): New def for mat * vec.
- (operator*): Strengthen scalar version to disambiguate.
+ (operator*): Strengthen scalar version to disambiguate.
* mln/metal/vec.hh (to_h_vec): New method decl.
* mln/fun/x2x/translation.hh: Deactivate code in ctor w/o arg.
* mln/fun/x2x/rotation.hh: Likewise.
@@ -3325,7 +3357,7 @@
* mln/literal/zero.hh: Fix typo in doc.
* mln/value/int_s.hh: Handle literals.
* mln/value/int_u.hh (zero, one): Remove variables.
- * mln/value/concept/scalar.hh,
+ * mln/value/concept/scalar.hh,
* mln/make/w_window_line.hh,
* mln/morpho/hit_or_miss.hh: Update with literals.
@@ -4215,7 +4247,7 @@
* mln/value/concept/structured.hh,
* mln/value/concept/symbolic.hh,
* mln/value/concept/vectorial.hh: Add categories for each of these
- types (in namespace value).
+ types (in namespace value).
2007-10-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
@@ -4269,10 +4301,10 @@
---------------------------
| | | |
Scalar Vectoriel Symbolic Structured
- ^
+ ^
|
- --------
- | |
+ --------
+ | |
Integer Floating
* mln/value/internal/floating.hh: New.
@@ -4480,7 +4512,7 @@
Update doc of accus. Update Accumulator.
* mln/core/concept/accumulator.hh: Test if the convertion operator
- exist.
+ exist.
* mln/core/concept/doc/accumulator.hh: Add operator result().
@@ -4497,7 +4529,7 @@
Remove convertion method in median_alt.
* mln/accu/median_alt.hh: Move convertion method to the super class
- accu::internal::base_
+ accu::internal::base_
* mln/accu/nil.hh,
* mln/accu/p.hh: Clean old includes.
@@ -5381,7 +5413,7 @@
Clean interpolated image class.
* mln/core/interpolated.hh: Remove useless methods because of
- inherited methods from identity morpher.
+ inherited methods from identity morpher.
2007-09-25 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
@@ -5426,7 +5458,7 @@
* mln/core/rle_image.hh,
* mln/core/sparse_image.hh: Move the data allocation to the insert
- method.
+ method.
2007-09-25 Simon Nivault <simon.nivault(a)lrde.epita.fr>
@@ -5461,16 +5493,16 @@
* mln/core/decorated_image.hh: Remove super_ typedef.
* mln/core/interpolated.hh: Inherit from identity morpher. Add memory
- managment.
+ managment.
* mln/core/rle_image.hh,
* mln/core/sparse_image.hh,
* mln/core/internal/run_image.hh: Inherit from image_primary, move
- domain_ attribute to the descendants classes rle_images and
- sparse_image. Add memory managment to rle and sparse images.
+ domain_ attribute to the descendants classes rle_images and
+ sparse_image. Add memory managment to rle and sparse images.
* mln/core/safe.hh: Inherit from identity morpher. Add memory
- managment.
+ managment.
* mln/value/stack.hh: Inherit from value morpher.
@@ -5978,11 +6010,11 @@
* image2d_b.hh:
* image2d_b_data.hh: move image data into an imaage2d_b_data class,
- then hold it with a tracked pointer to avoid useless data copy like
- in olena
+ then hold it with a tracked pointer to avoid useless data copy like
+ in olena
* internal/tracked_ptr.hh: tracked pointer class from olena. fix a bug
- related to invariant_ call to optimize data access.
+ related to invariant_ call to optimize data access.
2007-09-19 Simon Nivault <simon.nivault(a)lrde.epita.fr>
@@ -6038,7 +6070,7 @@
* mln/core/internal/pixel_iterator_base.hh (boi_): Make it
before-the-beginning (reverse of past-the-end).
- (start, is_valid): Update.
+ (start, is_valid): Update.
* mln/core/line_piter.hh: Import super_::dim.
* mln/core/box_piter.hh: Likewise.
* mln/core/neighb.hh: Change inheritance to dpoints_base_.
@@ -6149,20 +6181,20 @@
Improve pnm support.
* mln/io/fits/load.hh: start debug, only the first column of the image
- is filled
+ is filled
* mln/io/internal/pnm/load.hh: add a second funtion to load a function
- load(ima, filename). Then we can check if ima is the right type to
- load the image in the file filename.
+ load(ima, filename). Then we can check if ima is the right type to
+ load the image in the file filename.
* mln/io/internal/pnm/load_header.hh: update read_header to get the
- maxvalue of the pnm header. We need it to check if max(mln_value(I))
- == maxval
+ maxvalue of the pnm header. We need it to check if max(mln_value(I))
+ == maxval
* mln/io/internal/pnm/save.hh:
* mln/io/internal/pnm/save_header.hh: change save_header(type, maxval,
- ima, filename, file) to save_header(type, maxval, ima, filename,
- file)
+ ima, filename, file) to save_header(type, maxval, ima, filename,
+ file)
* mln/io/pbm/save.hh:
* mln/io/pgm/load.hh:
@@ -7150,7 +7182,7 @@
* mln/core/concept/generalized_pixel.hh,
* mln/core/internal/pixel_impl.hh (ima): New.
* mln/core/concept/doc/generalized_pixel.hh,
- * mln/core/concept/doc/pixel_iterator.hh
+ * mln/core/concept/doc/pixel_iterator.hh
* mln/core/concept/generalized_pixel.hh,
* mln/core/concept/pixel_iterator.hh,
* mln/core/dpoints_pixter.hh (ctor): Better sig.