https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make sub_image work again.
* doc/tutorial/examples/sub_image.cc: New.
* mln/trait/image/props.hh (ext_io): Fix missing subtype.
* mln/debug/println.hh: Update; now rely on geom::bbox.
* mln/core/macros.hh (mln_piter, mln_piter_): Fix definition.
Now rely on piter, no more on fwd_piter.
* mln/core/p_array.hh (mln_piter): New.
* mln/core/internal/image_base.hh (piter): New.
* mln/core/internal/check/image_fastest.hh: Update.
* mln/core/sub_image.hh (border, data): Update in props.
* mln/core/image2d.hh (typedef): Remove dangerous copy.
doc/tutorial/examples/sub_image.cc | 20 ++++++++++++++++++++
mln/core/image2d.hh | 17 -----------------
mln/core/internal/check/image_fastest.hh | 5 +++--
mln/core/internal/image_base.hh | 8 ++++++++
mln/core/macros.hh | 4 ++--
mln/core/p_array.hh | 3 +++
mln/core/sub_image.hh | 10 +++++-----
mln/debug/println.hh | 6 ++++--
mln/trait/image/props.hh | 4 +++-
9 files changed, 48 insertions(+), 29 deletions(-)
Index: doc/tutorial/examples/sub_image.cc
--- doc/tutorial/examples/sub_image.cc (revision 0)
+++ doc/tutorial/examples/sub_image.cc (revision 0)
@@ -0,0 +1,20 @@
+# include <mln/core/image2d.hh>
+# include <mln/core/sub_image.hh>
+
+# include <mln/debug/iota.hh>
+# include <mln/debug/println.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ typedef image2d<unsigned> I;
+ I ima(3, 5);
+ debug::iota(ima);
+ debug::println(ima);
+
+ sub_image<I, box2d> sub(ima, box2d(2,3));
+ debug::println(sub);
+}
Index: mln/trait/image/props.hh
--- mln/trait/image/props.hh (revision 2042)
+++ mln/trait/image/props.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -464,6 +464,8 @@
struct ext_io
{
struct any { protected: any() {} };
+ struct irrelevant
+ : any { std::string name() const { return "ext_io::irrelevant"; } };
struct read_only
: any { std::string name() const { return "ext_io::read_only"; } };
struct read_write
Index: mln/debug/println.hh
--- mln/debug/println.hh (revision 2042)
+++ mln/debug/println.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -35,6 +35,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/window.hh>
+# include <mln/geom/bbox.hh>
# include <mln/debug/format.hh>
// Specializations are in:
@@ -78,7 +79,8 @@
void
println(const Image<I>& input)
{
- impl::println(exact(input).bbox(), exact(input));
+ impl::println(geom::bbox(exact(input).domain()),
+ exact(input));
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/core/macros.hh
--- mln/core/macros.hh (revision 2042)
+++ mln/core/macros.hh (working copy)
@@ -198,8 +198,8 @@
/// Shortcuts to access the type of point iterator (piter) associated to T.
/// \{
-# define mln_piter(T) typename T::fwd_piter
-# define mln_piter_(T) T::fwd_piter
+# define mln_piter(T) typename T::piter
+# define mln_piter_(T) T::piter
/// \}
/// Shortcuts to access the type of point by line iterator
Index: mln/core/internal/image_base.hh
--- mln/core/internal/image_base.hh (revision 2042)
+++ mln/core/internal/image_base.hh (working copy)
@@ -78,6 +78,7 @@
};
+
template <typename E>
struct image_checked_
:
@@ -87,6 +88,7 @@
};
+
/*! \internal A base class for images.
* Parameter \p S is a point set type.
*
@@ -106,6 +108,7 @@
/// Point associated type.
typedef mln_site(S) site;
+
/// Forward Site_Iterator associated type.
typedef mln_fwd_piter(S) fwd_piter;
@@ -113,6 +116,11 @@
typedef mln_bkd_piter(S) bkd_piter;
+ /// Site_Iterator associated type; default definition is
+ /// fwd_piter.
+ typedef fwd_piter piter;
+
+
/// Test if \p p belongs to the image domain.
bool has(const psite& p) const;
Index: mln/core/internal/check/image_fastest.hh
--- mln/core/internal/check/image_fastest.hh (revision 2042)
+++ mln/core/internal/check/image_fastest.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -87,7 +87,8 @@
image_fastest_<E,B>::image_fastest_()
{
typedef mln_site(E) site;
- typedef mln_dpsite(E) dpsite;
+ typedef mln_psite(E) psite;
+ typedef mln_delta(psite) dpsite;
typedef mln_fwd_pixter(E) fwd_pixter;
typedef mln_bkd_pixter(E) bkd_pixter;
Index: mln/core/sub_image.hh
--- mln/core/sub_image.hh (revision 2042)
+++ mln/core/sub_image.hh (working copy)
@@ -78,14 +78,14 @@
typedef trait::image::category::domain_morpher category;
- typedef trait::image::border::none border; // no more accessible border
+ typedef trait::image::ext_domain::none ext_domain; // No extension of
domain.
+ typedef trait::image::ext_value::irrelevant ext_value;
+ typedef trait::image::ext_io::irrelevant ext_io;
typedef mln_trait_image_io_from_(I) io; // un-write when I const
- typedef mln_trait_image_data_from_(I) data;
-// typedef mlc_if( I_data_are_linear_,
-// trait::data::stored, // if linear then just stored
-// I_data_ ) data; // otherwise like I
+ typedef trait::image::value_storage::disrupted value_storage;
+ // HOT FIXME: except if S is a Box
};
} // end of namespace mln::trait
Index: mln/core/p_array.hh
--- mln/core/p_array.hh (revision 2042)
+++ mln/core/p_array.hh (working copy)
@@ -148,6 +148,9 @@
/// The associated site type.
typedef typename super::site site;
+ /// Site_Iterator associated type.
+ typedef p_array_fwd_piter_<P> piter;
+
/// Forward Site_Iterator associated type.
typedef p_array_fwd_piter_<P> fwd_piter;
Index: mln/core/image2d.hh
--- mln/core/image2d.hh (revision 2042)
+++ mln/core/image2d.hh (working copy)
@@ -122,23 +122,6 @@
template <typename T>
struct image2d : public internal::image_primary_< box2d, image2d<T> >
{
- typedef point2d point; // FIXME: HOT: to be removed.
-
-
- // Warning: just to make effective types appear in Doxygen:
-
- typedef box2d pset;
-
- typedef point2d psite;
- typedef point2d site;
- typedef dpoint2d dpsite;
-
- typedef mln_fwd_piter(box2d) fwd_piter;
- typedef mln_bkd_piter(box2d) bkd_piter;
-
- // End of warning.
-
-
/// Value associated type.
typedef T value;