Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
July 2007
- 6 participants
- 59 discussions
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Handle constness properly in pixel iterators.
* mln/core/trait/qlf_value.hh: New.
* mln/core/internal/pixel_iterator_base.hh
(qualified_value): Move and rename as...
* mln/core/trait/qlf_value.hh (qlf_value): ...this.
* doc/Doxyfile.in: Update.
* mln/core/macros.hh (mln_qlf_value): New.
Add space.
* mln/core/pixter2d_b.hh (eor_): Update type.
(image): New.
* mln/core/dpoints_pixter.hh (value_ref_): Update type.
* mln/core/internal/pixel_impl.hh
(value_): Remove; obsolete.
(image): New.
* mln/core/fimage.hh: Fix warning.
* mln/core/concept/generalized_pixel.hh (image): New.
(address_): Update type.
(todo): New.
(ctor): Re-activate check.
* mln/core/concept/fast_image.hh (offset): New; factor code.
(buffer): New overload.
* mln/core/concept/doc/generalized_pixel.hh (image): New.
(address_): Update type.
* mln/core/concept/doc/fast_image.hh (offset): Remove; factored.
* mln/core/image2d_b.hh (offset): Remove; factored.
(buffer): New.
* mln/level/assign.hh: Fix doc.
* mln/value/cast.hh: Fix warning.
* TODO: Update.
TODO | 1
doc/Doxyfile.in | 1
mln/core/concept/doc/fast_image.hh | 9 ----
mln/core/concept/doc/generalized_pixel.hh | 5 +-
mln/core/concept/fast_image.hh | 41 ++++++++++++++++--
mln/core/concept/generalized_pixel.hh | 15 +++++-
mln/core/dpoints_pixter.hh | 5 --
mln/core/fimage.hh | 6 +-
mln/core/image2d_b.hh | 22 ++++------
mln/core/internal/pixel_impl.hh | 12 ++---
mln/core/internal/pixel_iterator_base.hh | 23 +---------
mln/core/macros.hh | 3 +
mln/core/pixter2d_b.hh | 6 +-
mln/core/trait/qlf_value.hh | 65 ++++++++++++++++++++++++++++++
mln/level/assign.hh | 2
mln/value/cast.hh | 6 +-
16 files changed, 152 insertions(+), 70 deletions(-)
Index: doc/Doxyfile.in
--- doc/Doxyfile.in (revision 1034)
+++ doc/Doxyfile.in (working copy)
@@ -1055,6 +1055,7 @@
"mln_fwd_viter(T)=typename T::fwd_viter" \
"mln_bkd_viter(T)=typename T::bkd_viter" \
"mln_value(T)=typename T::value" \
+ "mln_qlf_value(T)=typename T::qlf_value" \
"mln_vset(T)=typename T::vset" \
"mln_rvalue(T)=typename T::rvalue" \
"mln_lvalue(T)=typename T::lvalue" \
Index: TODO
--- TODO (revision 1034)
+++ TODO (working copy)
@@ -30,6 +30,7 @@
* renaming
mlc into metal
++ look for "same_grid" etc.
* clean-up
Index: mln/core/macros.hh
--- mln/core/macros.hh (revision 1034)
+++ mln/core/macros.hh (working copy)
@@ -121,6 +121,9 @@
// q
+/// Shortcut to access the qualified (const or mutable) value type associated to T.
+# define mln_qlf_value(T) typename mln::trait::qlf_value< T >::ret
+
/// Shortcut to access the qiter type associated to T.
# define mln_qiter(T) typename T::fwd_qiter
Index: mln/core/trait/qlf_value.hh
--- mln/core/trait/qlf_value.hh (revision 0)
+++ mln/core/trait/qlf_value.hh (revision 0)
@@ -0,0 +1,65 @@
+// 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_TRAIT_QLF_VALUE_HH
+# define MLN_CORE_TRAIT_QLF_VALUE_HH
+
+/*! \file mln/core/trait/qlf_value.hh
+ *
+ * \brief Definition of the qlf_value image trait.
+ */
+
+# include <mln/core/macros.hh>
+
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+
+ template <typename I>
+ struct qlf_value
+ {
+ typedef mln_value(I) ret;
+ };
+
+
+ template <typename I>
+ struct qlf_value< const I >
+ {
+ typedef const mln_value(I) ret;
+ };
+
+
+ } // end of namespace mln::trait
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_TRAIT_QLF_VALUE_HH
Index: mln/core/fimage.hh
--- mln/core/fimage.hh (revision 1034)
+++ mln/core/fimage.hh (working copy)
@@ -82,8 +82,8 @@
/// Read-only access of pixel value at point site \p p.
mln_result(F) operator()(const psite& p) const;
- /// Read-write access of pixel value at point site \p p.
- void operator()(const psite& p);
+ /// Read-write access is present but disabled.
+ void operator()(const psite&);
/// Give the set of values of the image.
const vset& values() const;
@@ -150,7 +150,7 @@
template <typename F, typename S>
void
- fimage<F,S>::operator()(const psite& p)
+ fimage<F,S>::operator()(const psite&)
{
mln_invariant(0); // FIXME: Turn into a compile-time error...
}
Index: mln/core/pixter2d_b.hh
--- mln/core/pixter2d_b.hh (revision 1034)
+++ mln/core/pixter2d_b.hh (working copy)
@@ -45,10 +45,12 @@
class fwd_pixter2d_b : public internal::pixel_iterator_base_< I, fwd_pixter2d_b<I> >
{
typedef internal::pixel_iterator_base_< I, fwd_pixter2d_b<I> > super_;
- typedef typename super_::value_ value_;
public:
+ /// Image type.
+ typedef I image;
+
/*! \brief Constructor.
*
* \param[in] image Image to iterate over its pixels.
@@ -67,7 +69,7 @@
unsigned row_offset_;
/// End of the current row.
- value_* eor_;
+ mln_qlf_value(I)* eor_;
};
Index: mln/core/dpoints_pixter.hh
--- mln/core/dpoints_pixter.hh (revision 1034)
+++ mln/core/dpoints_pixter.hh (working copy)
@@ -58,9 +58,6 @@
typedef typename internal::pixel_impl_< I, dpoints_fwd_pixter<I> > super_;
public:
- /// Using super value type.
- typedef typename super_::value_ value_;
-
/*! \brief Constructor.
*
* \param[in] image Image subject to iteration.
@@ -111,7 +108,7 @@
unsigned i_;
/// reference pixel / point in the image
- value_** value_ref_;
+ mln_qlf_value(I)** value_ref_;
// or:
const mln_point(I)* p_ref_;
Index: mln/core/internal/pixel_impl.hh
--- mln/core/internal/pixel_impl.hh (revision 1034)
+++ mln/core/internal/pixel_impl.hh (working copy)
@@ -53,6 +53,9 @@
{
public:
+ /// Image type.
+ typedef I image;
+
/// Image value type.
typedef mln_value(I) value;
@@ -62,9 +65,6 @@
/// Image rvalue type.
typedef mln_rvalue(I) rvalue;
- /// Qualified value type.
- typedef value value_;
-
/// pixel iterator value.
lvalue operator*();
@@ -102,15 +102,15 @@
{
public:
+ /// Image type.
+ typedef const I image;
+
/// Image value type.
typedef mln_value(I) value;
/// Image rvalue type.
typedef mln_rvalue(I) rvalue;
- /// Qualified value type.
- typedef const value value_;
-
/// Get the pixel iterator value.
rvalue operator*() const;
Index: mln/core/internal/pixel_iterator_base.hh
--- mln/core/internal/pixel_iterator_base.hh (revision 1034)
+++ mln/core/internal/pixel_iterator_base.hh (working copy)
@@ -35,6 +35,7 @@
# include <mln/core/concept/pixel_iterator.hh>
# include <mln/core/internal/pixel_impl.hh>
+# include <mln/core/trait/qlf_value.hh>
namespace mln
@@ -44,21 +45,6 @@
{
- template <typename I>
- struct qualified_value
- {
- typedef mln_value(I) ret;
- };
-
-
- template <typename I>
- struct qualified_value< const I >
- {
- typedef const mln_value(I) ret;
- };
-
-
-
/*! \brief A base class for pixel iterators.
*
*/
@@ -79,16 +65,13 @@
/// Test if the iterator is valid.
bool is_valid() const;
- /// Qualified (const or not) value type.
- typedef typename qualified_value<I>::ret value_;
-
protected:
/// Beginning of the image.
- value_* boi_;
+ mln_qlf_value(I)* boi_;
/// End of the image (past-the-end).
- value_* eoi_;
+ mln_qlf_value(I)* eoi_;
/// Constructor.
pixel_iterator_base_(I& image);
Index: mln/core/concept/generalized_pixel.hh
--- mln/core/concept/generalized_pixel.hh (revision 1034)
+++ mln/core/concept/generalized_pixel.hh (working copy)
@@ -35,6 +35,7 @@
# include <mln/core/concept/object.hh>
# include <mln/core/internal/force_exact.hh>
+# include <mln/core/trait/qlf_value.hh>
namespace mln
@@ -52,6 +53,8 @@
*
* \see mln::doc::Generalized_Pixel for a complete documentation of this
* class contents.
+ *
+ * \todo (later) Add an access to the targetted image.
*/
template <typename E>
struct Generalized_Pixel
@@ -59,9 +62,10 @@
/*
typedef value;
typedef rvalue;
+ typedef image;
rvalue operator*() const;
- value** address_() const;
+ mln_qlf_value(image)** address_() const;
*/
protected:
Generalized_Pixel();
@@ -75,11 +79,14 @@
{
typedef mln_value(E) value;
typedef mln_rvalue(E) rvalue;
+
rvalue (E::*m1)() const = & E::operator*;
m1 = 0;
- // FIXME: Activate (so add qualif_value):
-// value** (E::*m2)() const = & E::address_;
-// m2 = 0;
+
+ typedef mln_image(E) image;
+
+ mln_qlf_value(image)** (E::*m2)() const = & E::address_;
+ m2 = 0;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/core/concept/fast_image.hh
--- mln/core/concept/fast_image.hh (revision 1034)
+++ mln/core/concept/fast_image.hh (working copy)
@@ -33,6 +33,8 @@
*/
# include <mln/core/concept/image.hh>
+# include <mln/core/concept/generalized_point.hh>
+# include <mln/core/trait/qlf_value.hh>
namespace mln
@@ -50,15 +52,28 @@
unsigned border();
int offset(const dpoint& dp) const;
- unsigned offset(const point& p) const;
point point_at_offset(unsigned o) const;
+ mln_qlf_value(E)* buffer();
const value* buffer() const;
rvalue operator[](unsigned o) const;
lvalue operator[](unsigned o);
*/
+
+ /*! \brief Give the offset of the point \p p.
+ *
+ * \param[in] p A generalized point.
+ *
+ * \warning This method is final.
+ *
+ * \pre The image has to be initialized and to own the point \p p.
+ * \post p = point_at_offset(result)
+ */
+ template <typename P>
+ unsigned offset(const Generalized_Point<P>& p) const;
+
protected:
Fast_Image();
};
@@ -67,6 +82,22 @@
# ifndef MLN_INCLUDE_ONLY
template <typename E>
+ template <typename P>
+ unsigned
+ Fast_Image<E>::offset(const Generalized_Point<P>& p_) const
+ {
+ // FIXME: check that P is mln_point(E)
+ const E& this_ = exact(this);
+ const P& p = internal::force_exact<P>(p_);
+ mln_precondition(this_->has_data());
+ mln_precondition(this_->owns_(p));
+
+ unsigned o = & this_->operator()(p) - this_->buffer();
+ mln_postcondition(p = this_->point_at_offset(o));
+ return o;
+ }
+
+ template <typename E>
Fast_Image<E>::Fast_Image()
{
typedef mln_point(E) point;
@@ -77,15 +108,15 @@
int (E::*m1)(const dpoint&) const = & E::offset;
m1 = 0;
- unsigned (E::*m2)(const point&) const = & E::offset;
+ point (E::*m2)(unsigned) const = & E::point_at_offset;
m2 = 0;
- point (E::*m3)(unsigned) const = & E::point_at_offset;
+ unsigned (E::*m3)() const = & E::border;
m3 = 0;
- unsigned (E::*m4)() const = & E::border;
- m4 = 0;
typedef mln_value(E) value;
+ mln_qlf_value(E)* (E::*m4)() = & E::buffer;
+ m4 = 0;
const value* (E::*m5)() const = & E::buffer;
m5 = 0;
Index: mln/core/concept/doc/generalized_pixel.hh
--- mln/core/concept/doc/generalized_pixel.hh (revision 1034)
+++ mln/core/concept/doc/generalized_pixel.hh (working copy)
@@ -47,6 +47,9 @@
struct Generalized_Pixel
{
+ /// Image associated type (with possible const qualification).
+ typedef void image;
+
/// Value associated type.
typedef void value;
@@ -67,7 +70,7 @@
*
* \return A pointer to the value address.
*/
- value** address_() const;
+ mln_qlf_value(ima)** address_() const;
protected:
Generalized_Pixel();
Index: mln/core/concept/doc/fast_image.hh
--- mln/core/concept/doc/fast_image.hh (revision 1034)
+++ mln/core/concept/doc/fast_image.hh (working copy)
@@ -58,15 +58,6 @@
int offset(const dpoint& dp);
- /*! \brief Give the offset of the point \p p.
- *
- * \param[in] p A point.
- *
- * \pre The image has to own the point \p p.
- */
- unsigned offset(const point& p);
-
-
/*! \brief Give the point at offset \p o.
*
* \param[in] o An offset.
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1034)
+++ mln/core/image2d_b.hh (working copy)
@@ -192,15 +192,15 @@
/// Give the offset corresponding to the delta-point \p dp.
int offset(const dpoint2d& dp) const;
- /// Give the offset corresponding to the point \p p.
- unsigned offset(const point2d& p) const;
-
/// Give the point corresponding to the offset \p o.
point2d point_at_offset(unsigned o) const;
/// Give a hook to the value buffer.
const T* buffer() const;
+ /// Give a hook to the value buffer.
+ T* buffer();
+
private:
@@ -411,21 +411,19 @@
}
template <typename T>
- int
- image2d_b<T>::offset(const dpoint2d& dp) const
+ T*
+ image2d_b<T>::buffer()
{
mln_precondition(this->has_data());
- int o = dp[0] * vb_.len(1) + dp[1];
- return o;
+ return buffer_;
}
template <typename T>
- unsigned
- image2d_b<T>::offset(const point2d& p) const
+ int
+ image2d_b<T>::offset(const dpoint2d& dp) const
{
- mln_precondition(this->owns_(p));
- unsigned o = & this->operator()(p) - this->buffer_;
- mln_postcondition(p = point_at_offset(o));
+ mln_precondition(this->has_data());
+ int o = dp[0] * vb_.len(1) + dp[1];
return o;
}
Index: mln/level/assign.hh
--- mln/level/assign.hh (revision 1034)
+++ mln/level/assign.hh (working copy)
@@ -44,7 +44,7 @@
/*! Assignment of image \p target with image \p data.
*
- * \param[out] output The image to be assigned.
+ * \param[out] target The image to be assigned.
* \param[in] data The auxiliary image.
*
* \pre target.domain = data.domain
Index: mln/value/cast.hh
--- mln/value/cast.hh (revision 1034)
+++ mln/value/cast.hh (working copy)
@@ -84,8 +84,8 @@
/// Read-only access of pixel value at point site \p p.
T operator()(const psite& p) const;
- /// Read-write access of pixel value at point site \p p.
- void operator()(const psite& p);
+ /// Read-write access is present but disabled.
+ void operator()(const psite&);
/// Give the set of values of the image.
const vset& values() const;
@@ -153,7 +153,7 @@
template <typename T, typename I>
void
- cast_image<T,I>::operator()(const psite& p)
+ cast_image<T,I>::operator()(const psite&)
{
mln_invariant(0); // FIXME: Turn into a compile-time error...
}
1
0
23 Jul '07
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add some morphers and handle constness in pixterators.
Add new morphers.
* tests/cast_image.cc: New.
* tests/assign.cc: New.
* tests/fimage.cc: New.
* mln/core/fimage.hh: New.
* mln/level/assign.hh: New.
* mln/value/cast.hh: New.
* mln/core/safe.hh: Rename as...
* mln/core/safe_image.hh: ...this.
* tests/safe_image.cc: Update.
* mln/core/vec.hh: Rename as...
* mln/metal/vec.hh: ...this.
Handle constness in pixel iterators.
* mln/core/internal/pixel_impl.hh (value_): New.
(address): Update.
* mln/core/internal/pixel_iterator_base.hh
(qualified_value, value_): New.
* mln/core/pixter2d_b.hh (value_): Update.
* mln/core/dpoints_pixter.hh (value_): Update.
* mln/core/internal/image_adaptor.hh
(vset, values): Fix missing.
* mln/core/concept/generalized_pixel.hh
(ctor): Comment check on address.
* mln/core/concept/pixel_iterator.hh
(ctor): Comment check on lvalue and op*.
* mln/core/concept/fast_image.hh (offset): Fix missing const.
* mln/core/image2d_b.hh: Likewise.
* mln/core/concept/doc/image.hh: Cosmetic changes.
* mln/level/fast_median.hh (input): Update.
* TODO: Update.
TODO | 2
mln/core/concept/doc/image.hh | 2
mln/core/concept/fast_image.hh | 8 -
mln/core/concept/generalized_pixel.hh | 5
mln/core/concept/pixel_iterator.hh | 9 -
mln/core/dpoints_pixter.hh | 10 -
mln/core/fimage.hh | 170 ++++++++++++++++++++++++++++++
mln/core/image2d_b.hh | 14 +-
mln/core/internal/image_adaptor.hh | 16 ++
mln/core/internal/pixel_impl.hh | 12 +-
mln/core/internal/pixel_iterator_base.hh | 20 +++
mln/core/pixter2d_b.hh | 3
mln/core/safe.hh | 7 -
mln/level/assign.hh | 103 ++++++++++++++++++
mln/level/fast_median.hh | 10 -
mln/metal/vec.hh | 11 +
mln/value/cast.hh | 175 +++++++++++++++++++++++++++++++
tests/assign.cc | 48 ++++++++
tests/cast_image.cc | 48 ++++++++
tests/fimage.cc | 44 +++++++
tests/safe_image.cc | 2
21 files changed, 681 insertions(+), 38 deletions(-)
Index: tests/cast_image.cc
--- tests/cast_image.cc (revision 0)
+++ tests/cast_image.cc (revision 0)
@@ -0,0 +1,48 @@
+// 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/cast_image.cc
+ *
+ * \brief Tests on mln::value::cast_image.
+ */
+
+#include <mln/core/image2d_b.hh>
+#include <mln/fun/chess.hh>
+#include <mln/level/fill.hh>
+#include <mln/debug/println.hh>
+#include <mln/value/cast.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d_b<bool> ima(8, 8);
+ level::fill(ima, fun::chess);
+ debug::println(ima);
+ debug::println( value::cast<int>(ima) );
+}
Index: tests/safe_image.cc
--- tests/safe_image.cc (revision 1033)
+++ tests/safe_image.cc (working copy)
@@ -31,7 +31,7 @@
*/
#include <mln/core/image2d_b.hh>
-#include <mln/core/safe_image.hh>
+#include <mln/core/safe.hh>
#include <mln/level/paste.hh>
Index: tests/assign.cc
--- tests/assign.cc (revision 0)
+++ tests/assign.cc (revision 0)
@@ -0,0 +1,48 @@
+// 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/assign.cc
+ *
+ * \brief Tests on mln::level::assign.
+ */
+
+#include <mln/core/image2d_b.hh>
+#include <mln/level/assign.hh>
+#include <mln/level/compare.hh>
+#include <mln/debug/iota.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned size = 1000;
+ image2d_b<int> rhs(size, size), lhs(rhs.domain());
+ debug::iota(rhs);
+ level::assign(lhs, rhs);
+ mln_assertion(lhs = rhs);
+}
Index: tests/fimage.cc
--- tests/fimage.cc (revision 0)
+++ tests/fimage.cc (revision 0)
@@ -0,0 +1,44 @@
+// 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/fimage.cc
+ *
+ * \brief Tests on mln::fimage.
+ */
+
+#include <mln/core/fimage.hh>
+#include <mln/core/box2d.hh>
+#include <mln/fun/chess.hh>
+#include <mln/debug/println.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ debug::println( fun::chess | make::box2d(8, 8) );
+}
Index: TODO
--- TODO (revision 1033)
+++ TODO (working copy)
@@ -17,7 +17,6 @@
value::proxy to dispatch read/write + the corresponding image type
a mean_value object { sum; count } and operator+
-value_cast<T>(image)
t_image to "transpose" the 0 and the i-th coordinates
image defined by f/pset
@@ -45,6 +44,5 @@
fast versions of level::fill and level::paste
histogram class
sorting points w.r.t. their value (array of offsets, psites, points)
-border::* and no-op versions if not fast image
arith::inplace_plus et al.
linear:: for convolutions
Index: mln/core/fimage.hh
--- mln/core/fimage.hh (revision 0)
+++ mln/core/fimage.hh (revision 0)
@@ -0,0 +1,170 @@
+// 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_FIMAGE_HH
+# define MLN_CORE_FIMAGE_HH
+
+/*! \file mln/core/fimage.hh
+ *
+ * \brief Definition of an image class FIXME
+ */
+
+# include <mln/core/internal/image_base.hh>
+# include <mln/core/concept/function.hh>
+# include <mln/value/set.hh>
+
+
+namespace mln
+{
+
+ /*! \brief FIXME
+ *
+ */
+ template <typename F, typename S>
+ struct fimage : public internal::image_base_< S, fimage<F,S> >
+ {
+ /// Point_Site associated type.
+ typedef mln_psite(S) psite;
+
+ /// Point_Set associated type.
+ typedef S pset;
+
+ /// Value associated type.
+ typedef mln_result(F) value;
+
+ /// Return type of read-only access.
+ typedef mln_result(F) rvalue;
+
+ /// Return type of read-write access.
+ typedef void lvalue; // FIXME
+
+ /// Value set associated type.
+ typedef mln::value::set_<mln_result(F)> vset;
+
+
+ /// Constructor.
+ fimage(const Function_p2v<F>& f, const Point_Set<S>& ps);
+
+
+ /// Test if this image has been initialized.
+ bool has_data() const;
+
+ /// Test if a pixel value is accessible at \p p.
+ bool owns_(const psite& p) const;
+
+ /// Give the definition domain.
+ const S& domain() const;
+
+ /// Read-only access of pixel value at point site \p p.
+ mln_result(F) operator()(const psite& p) const;
+
+ /// Read-write access of pixel value at point site \p p.
+ void operator()(const psite& p);
+
+ /// Give the set of values of the image.
+ const vset& values() const;
+
+ /// Change value type. FIXME!
+ template <typename U>
+ struct change_value
+ {
+ typedef void ret;
+ };
+
+ protected:
+ F f_;
+ S pset_;
+ };
+
+
+
+ template <typename F, typename S>
+ fimage<F,S>
+ operator | (const Function_p2v<F>& f, const Point_Set<S>& ps)
+ {
+ fimage<F,S> tmp(f, ps);
+ return tmp;
+ }
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename F, typename S>
+ fimage<F,S>::fimage(const Function_p2v<F>& f, const Point_Set<S>& ps)
+ : f_(exact(f)),
+ pset_(exact(ps))
+ {
+ }
+
+ template <typename F, typename S>
+ bool fimage<F,S>::has_data() const
+ {
+ return true;
+ }
+
+ template <typename F, typename S>
+ bool fimage<F,S>::owns_(const psite& p) const
+ {
+ return pset_.has(p);
+ }
+
+ template <typename F, typename S>
+ const S&
+ fimage<F,S>::domain() const
+ {
+ return pset_;
+ }
+
+ template <typename F, typename S>
+ mln_result(F)
+ fimage<F,S>::operator()(const psite& p) const
+ {
+ mln_precondition(pset_.has(p));
+ return f_(p);
+ }
+
+ template <typename F, typename S>
+ void
+ fimage<F,S>::operator()(const psite& p)
+ {
+ mln_invariant(0); // FIXME: Turn into a compile-time error...
+ }
+
+ template <typename F, typename S>
+ const mln::value::set_<mln_result(F)>&
+ fimage<F,S>::values() const
+ {
+ return vset::the();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_FIMAGE_HH
Index: mln/core/pixter2d_b.hh
--- mln/core/pixter2d_b.hh (revision 1033)
+++ mln/core/pixter2d_b.hh (working copy)
@@ -45,7 +45,8 @@
class fwd_pixter2d_b : public internal::pixel_iterator_base_< I, fwd_pixter2d_b<I> >
{
typedef internal::pixel_iterator_base_< I, fwd_pixter2d_b<I> > super_;
- typedef mln_value(super_) value_;
+ typedef typename super_::value_ value_;
+
public:
/*! \brief Constructor.
Index: mln/core/dpoints_pixter.hh
--- mln/core/dpoints_pixter.hh (revision 1033)
+++ mln/core/dpoints_pixter.hh (working copy)
@@ -55,11 +55,11 @@
class dpoints_fwd_pixter : public Pixel_Iterator< dpoints_fwd_pixter<I> >,
public internal::pixel_impl_< I, dpoints_fwd_pixter<I> >
{
- typedef typename internal::pixel_impl_< I, dpoints_fwd_pixter<I> > super;
+ typedef typename internal::pixel_impl_< I, dpoints_fwd_pixter<I> > super_;
public:
/// Using super value type.
- typedef mln_value(super) value;
+ typedef typename super_::value_ value_;
/*! \brief Constructor.
*
@@ -111,7 +111,7 @@
unsigned i_;
/// reference pixel / point in the image
- value** value_ref_;
+ value_** value_ref_;
// or:
const mln_point(I)* p_ref_;
@@ -135,7 +135,7 @@
dpoints_fwd_pixter<I>::dpoints_fwd_pixter(I& image,
const Dps& dps,
const Generalized_Point<Pref>& p_ref)
- : super(image)
+ : super_(image)
{
mln_precondition(image.has_data());
p_ref_ = internal::force_exact<Pref>(p_ref).pointer_();
@@ -149,7 +149,7 @@
dpoints_fwd_pixter<I>::dpoints_fwd_pixter(I& image,
const Dps& dps,
const Generalized_Pixel<Pref>& p_ref)
- : super(image)
+ : super_(image)
{
mln_precondition(image.has_data());
p_ref_ = 0;
Index: mln/core/internal/pixel_impl.hh
--- mln/core/internal/pixel_impl.hh (revision 1033)
+++ mln/core/internal/pixel_impl.hh (working copy)
@@ -62,6 +62,9 @@
/// Image rvalue type.
typedef mln_rvalue(I) rvalue;
+ /// Qualified value type.
+ typedef value value_;
+
/// pixel iterator value.
lvalue operator*();
@@ -105,13 +108,16 @@
/// Image rvalue type.
typedef mln_rvalue(I) rvalue;
+ /// Qualified value type.
+ typedef const value value_;
+
/// Get the pixel iterator value.
rvalue operator*() const;
/// Address of the current iterator value/pixel.
- value** address_() const;
+ const value** address_() const;
protected:
@@ -197,11 +203,11 @@
}
template <typename I, typename E>
- mln_value(I) **
+ const mln_value(I) **
pixel_impl_<const I, E>::address_() const
{
mln_precondition(is_valid_());
- return (value**)(& this->value_ptr_);
+ return (const value**)(& this->value_ptr_);
}
#endif // ! MLN_INCLUDE_ONLY
Index: mln/core/internal/pixel_iterator_base.hh
--- mln/core/internal/pixel_iterator_base.hh (revision 1033)
+++ mln/core/internal/pixel_iterator_base.hh (working copy)
@@ -43,6 +43,22 @@
namespace internal
{
+
+ template <typename I>
+ struct qualified_value
+ {
+ typedef mln_value(I) ret;
+ };
+
+
+ template <typename I>
+ struct qualified_value< const I >
+ {
+ typedef const mln_value(I) ret;
+ };
+
+
+
/*! \brief A base class for pixel iterators.
*
*/
@@ -51,7 +67,6 @@
public internal::pixel_impl_<I, E>
{
typedef internal::pixel_impl_<I, E> super_;
- typedef mln_value(super_) value_;
public:
@@ -64,6 +79,9 @@
/// Test if the iterator is valid.
bool is_valid() const;
+ /// Qualified (const or not) value type.
+ typedef typename qualified_value<I>::ret value_;
+
protected:
/// Beginning of the image.
Index: mln/core/internal/image_adaptor.hh
--- mln/core/internal/image_adaptor.hh (revision 1033)
+++ mln/core/internal/image_adaptor.hh (working copy)
@@ -51,12 +51,16 @@
typename S = mln_pset(I) >
struct image_adaptor_ : public internal::image_base_< S, E >
{
+
/// Point_Site associated type.
typedef mln_psite(S) psite;
/// Point_Set associated type.
typedef S pset;
+ /// Value_Set associated type.
+ typedef mln_vset(I) vset;
+
/// Value associated type.
typedef mln_value(I) value;
@@ -66,6 +70,7 @@
/// Return type of read-write access.
typedef mln_lvalue(I) lvalue;
+
/// Test if this image has been initialized.
bool has_data() const;
@@ -75,12 +80,16 @@
/// Give the definition domain.
const S& domain() const;
+ /// Give the set of values.
+ const vset& values() const;
+
/// Read-only access of pixel value at point site \p p.
rvalue operator()(const psite& p) const;
/// Read-write access of pixel value at point site \p p.
lvalue operator()(const psite& p);
+
protected:
I& adaptee_;
@@ -116,6 +125,13 @@
}
template <typename I, typename E, typename S>
+ const mln_vset(I)&
+ image_adaptor_<I,E,S>::values() const
+ {
+ return adaptee_.values();
+ }
+
+ template <typename I, typename E, typename S>
typename image_adaptor_<I,E,S>::rvalue
image_adaptor_<I,E,S>::operator()(const psite& p) const
{
Index: mln/core/safe.hh
--- mln/core/safe.hh (revision 1031)
+++ mln/core/safe.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_SAFE_IMAGE_HH
-# define MLN_CORE_SAFE_IMAGE_HH
+#ifndef MLN_CORE_SAFE_HH
+# define MLN_CORE_SAFE_HH
# include <mln/core/internal/image_adaptor.hh>
@@ -34,6 +34,7 @@
namespace mln
{
+ // FIXME: Doc!
template <typename I>
struct safe_image : public internal::image_adaptor_< I, safe_image<I> >
@@ -100,4 +101,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_SAFE_IMAGE_HH
+#endif // ! MLN_CORE_SAFE_HH
Index: mln/core/concept/generalized_pixel.hh
--- mln/core/concept/generalized_pixel.hh (revision 1033)
+++ mln/core/concept/generalized_pixel.hh (working copy)
@@ -77,8 +77,9 @@
typedef mln_rvalue(E) rvalue;
rvalue (E::*m1)() const = & E::operator*;
m1 = 0;
- value** (E::*m2)() const = & E::address_;
- m2 = 0;
+ // FIXME: Activate (so add qualif_value):
+// value** (E::*m2)() const = & E::address_;
+// m2 = 0;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/core/concept/pixel_iterator.hh
--- mln/core/concept/pixel_iterator.hh (revision 1033)
+++ mln/core/concept/pixel_iterator.hh (working copy)
@@ -54,8 +54,9 @@
public Generalized_Pixel<E>
{
/*
- typedef lvalue;
+ only if the iterator is constructed on a mutable image:
+ typedef lvalue;
lvalue operator*();
*/
protected:
@@ -68,9 +69,9 @@
template <typename E>
Pixel_Iterator<E>::Pixel_Iterator()
{
- typedef mln_lvalue(E) lvalue;
- lvalue (E::*m)() = & E::operator*;
- m = 0;
+// typedef mln_lvalue(E) lvalue;
+// lvalue (E::*m)() = & E::operator*;
+// m = 0;
}
#endif // ! MLN_INCLUDE_ONLY
Index: mln/core/concept/fast_image.hh
--- mln/core/concept/fast_image.hh (revision 1033)
+++ mln/core/concept/fast_image.hh (working copy)
@@ -49,8 +49,8 @@
/*
unsigned border();
- int offset(const dpoint& dp);
- unsigned offset(const point& p);
+ int offset(const dpoint& dp) const;
+ unsigned offset(const point& p) const;
point point_at_offset(unsigned o) const;
const value* buffer() const;
@@ -75,9 +75,9 @@
typedef mln_fwd_pixter(E) fwd_pixter;
typedef mln_bkd_pixter(E) bkd_pixter;
- int (E::*m1)(const dpoint&) = & E::offset;
+ int (E::*m1)(const dpoint&) const = & E::offset;
m1 = 0;
- unsigned (E::*m2)(const point&) = & E::offset;
+ unsigned (E::*m2)(const point&) const = & E::offset;
m2 = 0;
point (E::*m3)(unsigned) const = & E::point_at_offset;
m3 = 0;
Index: mln/core/concept/doc/image.hh
--- mln/core/concept/doc/image.hh (revision 1033)
+++ mln/core/concept/doc/image.hh (working copy)
@@ -41,6 +41,7 @@
template <typename E>
struct Image : public Object<E>
{
+
/*! \brief Value associated type.
*
* \invariant This type is neither qualified by const, nor by
@@ -61,6 +62,7 @@
*/
typedef void vset;
+
/*! \brief Test if the image have been initialized.
*/
bool has_data() const;
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1033)
+++ mln/core/image2d_b.hh (working copy)
@@ -190,10 +190,10 @@
/// Fast Image method
/// Give the offset corresponding to the delta-point \p dp.
- int offset(const dpoint2d& dp);
+ int offset(const dpoint2d& dp) const;
/// Give the offset corresponding to the point \p p.
- unsigned offset(const point2d& p);
+ unsigned offset(const point2d& p) const;
/// Give the point corresponding to the offset \p o.
point2d point_at_offset(unsigned o) const;
@@ -412,7 +412,7 @@
template <typename T>
int
- image2d_b<T>::offset(const dpoint2d& dp)
+ image2d_b<T>::offset(const dpoint2d& dp) const
{
mln_precondition(this->has_data());
int o = dp[0] * vb_.len(1) + dp[1];
@@ -421,7 +421,7 @@
template <typename T>
unsigned
- image2d_b<T>::offset(const point2d& p)
+ image2d_b<T>::offset(const point2d& p) const
{
mln_precondition(this->owns_(p));
unsigned o = & this->operator()(p) - this->buffer_;
@@ -535,6 +535,12 @@
};
template <typename T, typename W>
+ struct fwd_qixter< const image2d_b<T>, W >
+ {
+ typedef dpoints_fwd_pixter< const image2d_b<T> > ret;
+ };
+
+ template <typename T, typename W>
struct bkd_qixter< image2d_b<T>, W >
{
typedef internal::fixme ret;
Index: mln/metal/vec.hh
--- mln/metal/vec.hh (revision 1031)
+++ mln/metal/vec.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_VEC_HH
-# define MLN_CORE_VEC_HH
+#ifndef MLN_CORE_METAL_VEC_HH
+# define MLN_CORE_METAL_VEC_HH
# include <mln/core/concept/object.hh>
@@ -34,6 +34,9 @@
namespace mln
{
+ namespace metal
+ {
+
template <unsigned n, typename T>
struct vec : public Object< vec<n,T> >
{
@@ -56,7 +59,9 @@
T coord_[n];
};
+ } // end of namespace mln::metal
+
} // end of namespace mln
-#endif // ! MLN_CORE_VEC_HH
+#endif // ! MLN_CORE_METAL_VEC_HH
Index: mln/level/assign.hh
--- mln/level/assign.hh (revision 0)
+++ mln/level/assign.hh (revision 0)
@@ -0,0 +1,103 @@
+// 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_LEVEL_ASSIGN_HH
+# define MLN_LEVEL_ASSIGN_HH
+
+/*! \file mln/level/assign.hh
+ *
+ * \brief Assignment between a couple of images.
+ */
+
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ /*! Assignment of image \p target with image \p data.
+ *
+ * \param[out] output The image to be assigned.
+ * \param[in] data The auxiliary image.
+ *
+ * \pre target.domain = data.domain
+ *
+ * \todo Overload in impl:: for mixed (fast, non-fast).
+ *
+ * \todo Overload in impl:: for (fast, fast) if same value using memcpy.
+ */
+ template <typename L, typename R>
+ void assign(Image<L>& target, const Image<R>& data);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ template <typename L, typename R>
+ void assign(Image<L>& target_, const Image<R>& data_)
+ {
+ L& target = exact(target_);
+ const R& data = exact(data_);
+ mln_piter(L) p(target.domain());
+ for_all(p)
+ target(p) = data(p);
+ }
+
+ template <typename L, typename R>
+ void assign(Fast_Image<L>& target_, const Fast_Image<R>& data_)
+ {
+ L& target = exact(target_);
+ const R& data = exact(data_);
+ mln_pixter(L) lhs(target);
+ mln_pixter(const R) rhs(data);
+ for_all_2(lhs, rhs)
+ *lhs = *rhs;
+ }
+
+ } // end of namespace mln::level::impl
+
+
+ template <typename L, typename R>
+ void assign(Image<L>& target, const Image<R>& data)
+ {
+ mln_precondition(exact(data).domain() = exact(target).domain());
+ impl::assign(exact(target), exact(data));
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LEVEL_ASSIGN_HH
Index: mln/level/fast_median.hh
--- mln/level/fast_median.hh (revision 1033)
+++ mln/level/fast_median.hh (working copy)
@@ -54,7 +54,7 @@
* \pre \p input and \p output have to be initialized.
*/
template <typename I, typename W, typename O>
- void fast_median(Image<I>& input, const Window<W>& win,
+ void fast_median(const Image<I>& input, const Window<W>& win,
Image<O>& output);
@@ -65,7 +65,7 @@
{
template <typename I, typename W, typename O>
- void fast_median(I& input,
+ void fast_median(const I& input,
const W& win,
O& output)
{
@@ -90,14 +90,14 @@
point2d p = input.domain().pmin() + up;
- mln_qixter(I, window2d)
+ mln_qixter(const I, window2d)
q_fp(input, win_fwd_plus, p), q_fm(input, win_fwd_minus, p),
q_bp(input, win_bkd_plus, p), q_bm(input, win_bkd_minus, p),
q_top(input, win_top, p), q_bot(input, win_bot, p);
med.init();
{
- mln_qixter(I, W) q(input, win, p);
+ mln_qixter(const I, W) q(input, win, p);
for_all(q)
med.take(*q);
}
@@ -154,7 +154,7 @@
// facade
template <typename I, typename W, typename O>
- void fast_median(Image<I>& input, const Window<W>& win,
+ void fast_median(const Image<I>& input, const Window<W>& win,
Image<O>& output)
{
impl::fast_median(exact(input), exact(win), exact(output));
Index: mln/value/cast.hh
--- mln/value/cast.hh (revision 0)
+++ mln/value/cast.hh (revision 0)
@@ -0,0 +1,175 @@
+// 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_VALUE_CAST_HH
+# define MLN_VALUE_CAST_HH
+
+/*! \file mln/value/cast.hh
+ *
+ * \brief Definition of an image class FIXME
+ */
+
+# include <mln/core/concept/image.hh>
+# include <mln/value/set.hh>
+
+
+namespace mln
+{
+
+ namespace value
+ {
+
+ /*! \brief FIXME
+ *
+ */
+ template <typename T, typename I>
+ struct cast_image : public internal::image_base_< mln_pset(I), cast_image<T,I> >
+ {
+ /// Point_Site associated type.
+ typedef mln_psite(I) psite;
+
+ /// Point_Set associated type.
+ typedef mln_pset(I) pset;
+
+ /// Value associated type.
+ typedef T value;
+
+ /// Return type of read-only access.
+ typedef T rvalue;
+
+ /// Return type of read-write access.
+ typedef void lvalue; // FIXME
+
+ /// Value set associated type.
+ typedef mln::value::set_<T> vset;
+
+
+ /// Constructor.
+ cast_image(const Image<I>& ima);
+
+
+ /// Test if this image has been initialized.
+ bool has_data() const;
+
+ /// Test if a pixel value is accessible at \p p.
+ bool owns_(const psite& p) const;
+
+ /// Give the definition domain.
+ const mln_pset(I)& domain() const;
+
+ /// Read-only access of pixel value at point site \p p.
+ T operator()(const psite& p) const;
+
+ /// Read-write access of pixel value at point site \p p.
+ void operator()(const psite& p);
+
+ /// Give the set of values of the image.
+ const vset& values() const;
+
+ /// Change value type.
+ template <typename U>
+ struct change_value
+ {
+ typedef mln_ch_value(I, U) ret;
+ };
+
+ protected:
+ const I& ima_;
+ };
+
+
+
+ template <typename T, typename I>
+ cast_image<T,I>
+ cast(const Image<I>& ima)
+ {
+ mln_precondition(exact(ima).has_data());
+ cast_image<T,I> tmp(ima);
+ return tmp;
+ }
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T, typename I>
+ cast_image<T,I>::cast_image(const Image<I>& ima)
+ : ima_(exact(ima))
+ {
+ mln_precondition(exact(ima).has_data());
+ }
+
+ template <typename T, typename I>
+ bool cast_image<T,I>::has_data() const
+ {
+ mln_invariant(ima_.has_data());
+ return true;
+ }
+
+ template <typename T, typename I>
+ bool cast_image<T,I>::owns_(const psite& p) const
+ {
+ return ima_.owns_(p);
+ }
+
+ template <typename T, typename I>
+ const mln_pset(I)&
+ cast_image<T,I>::domain() const
+ {
+ return ima_.domain();
+ }
+
+ template <typename T, typename I>
+ T
+ cast_image<T,I>::operator()(const psite& p) const
+ {
+ mln_precondition(ima_.owns_(p));
+ return ima_(p);
+ }
+
+ template <typename T, typename I>
+ void
+ cast_image<T,I>::operator()(const psite& p)
+ {
+ mln_invariant(0); // FIXME: Turn into a compile-time error...
+ }
+
+ template <typename T, typename I>
+ const mln::value::set_<T>&
+ cast_image<T,I>::values() const
+ {
+ return vset::the();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_CAST_HH
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Configure new Makefiles.
* configure.ac (static/samples/mini-std/Makefile)
(static/samples/mini-std/cpp/Makefile)
(static/samples/mini-std/cpp2/Makefile):
Configure them.
configure.ac | 3 +++
1 file changed, 3 insertions(+)
Index: configure.ac
--- configure.ac (revision 1032)
+++ configure.ac (working copy)
@@ -85,6 +85,9 @@
static/samples/Makefile
static/samples/mini-oln/Makefile
static/samples/mini-oln/concept-c++/Makefile
+ static/samples/mini-std/Makefile
+ static/samples/mini-std/cpp/Makefile
+ static/samples/mini-std/cpp2/Makefile
milena/Makefile
milena/doc/Makefile
olena/Makefile
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Adjust samples to the new interface of Static.
* samples/mini-std/cpp/equipment.hh:
No longer use stc_scoop_equipment_for_namespace.
Include stc/scoop.hxx instead.
Rename template parameters `E' to `Exact'.
(stc_using, stc_using_from): Remove macros.
* samples/mini-std/cpp/impl.hh:
(morpher_container, primary_container): Adjust callers of
stc_using_from.
(morpher_container::delegatee): Rename methods as...
(morpher_container::delegatee_): ...these.
Adjust callers.
* samples/mini-std/cpp/stack.hh,
* samples/mini-std/cpp/value_cast.hh
(impl_delegatee): Rename methods as...
(impl_delegatee_): ...these.
* samples/mini-std/cpp/concepts.hh,
* samples/mini-std/cpp/impl.hh,
* samples/mini-std/cpp/list.hh,
* samples/mini-std/cpp/vector.hh,
* samples/mini-std/cpp/deque.hh,
* samples/mini-std/cpp/stack.hh,
* samples/mini-std/cpp/value_cast.hh,
* samples/mini-std/cpp/identity.hh,
* samples/mini-std/cpp/fwddecls.hh
Remove the `_type' suffix from all virtual types.
Remove virtual types named `super_type' and replace them with a
`super_trait_' class.
Rename template parameters `E' to `Exact'.
* samples/mini-oln/mini-oln.cc: Likewise.
s/set_super_type/super_trait_/.
* samples/mini-std/cpp2/mini-std.cc
(LOGGER_BEGIN, LOGMETHODVOID, LOGMETHODARG, LOGGER_END): Wrap long
lines in macros.
(LOGMETHOD): Likewise.
Add a space after the printed location.
* samples/mini-std/Makefile.am,
* samples/mini-std/cpp/Makefile.am:
New.
* samples/mini-std/cpp2/Makefile: Rename as...
* samples/mini-std/cpp2/Makefile.am: ...this.
(CPPFLAGS, .PHONY): Remove variables.
(all, mini-std): Remove targets.
(AM_CPPFLAGS, TESTS_CXXFLAGS, AM_CXXFLAGS)
(check_PROGRAMS, mini_std_SOURCES, TESTS):
New variables.
* samples/Makefile.am (SUBDIRS): Add mini-std.
Makefile.am | 2
mini-oln/mini-oln.cc | 214 +++++++++++++++++++++++----------------------
mini-std/Makefile.am | 5 +
mini-std/README | 2
mini-std/cpp/Makefile.am | 22 ++++
mini-std/cpp/concepts.hh | 104 ++++++++++-----------
mini-std/cpp/deque.hh | 11 +-
mini-std/cpp/equipment.hh | 31 +++---
mini-std/cpp/fwddecls.hh | 42 ++++----
mini-std/cpp/identity.hh | 92 +++++++++----------
mini-std/cpp/impl.hh | 129 +++++++++++++++------------
mini-std/cpp/list.hh | 9 +
mini-std/cpp/stack.hh | 18 ++-
mini-std/cpp/value_cast.hh | 17 ++-
mini-std/cpp/vector.hh | 9 +
mini-std/cpp2/Makefile.am | 19 +++
16 files changed, 405 insertions(+), 321 deletions(-)
Index: samples/mini-oln/mini-oln.cc
--- samples/mini-oln/mini-oln.cc (revision 1031)
+++ samples/mini-oln/mini-oln.cc (working copy)
@@ -41,26 +41,25 @@
// Helper macros.
#define oln_type_of_(FromType, Alias) \
- find_vtype<FromType, oln::typedef_:: Alias##_type>::ret
+ find_vtype<FromType, oln::typedef_:: Alias>::ret
#define oln_type_of(FromType, Alias) \
typename oln_type_of_(FromType, Alias)
-// Add equipment
-stc_scoop_equipment_for_namespace(oln)
+// Add equipment.
mlc_case_equipment_for_namespace(oln);
// Virtual types declaration.
namespace oln
{
- mlc_decl_typedef(point_type);
- mlc_decl_typedef(iter_type);
- mlc_decl_typedef(value_type);
- mlc_decl_typedef(rvalue_type);
- mlc_decl_typedef(lvalue_type);
+ mlc_decl_typedef(point);
+ mlc_decl_typedef(iter);
+ mlc_decl_typedef(value);
+ mlc_decl_typedef(rvalue);
+ mlc_decl_typedef(lvalue);
- mlc_decl_typedef(nbh_type);
- mlc_decl_typedef(niter_type);
+ mlc_decl_typedef(nbh);
+ mlc_decl_typedef(niter);
}
@@ -70,12 +69,20 @@
namespace oln
{
+
+ // --------------------- //
+ // Namespace equipment. //
+ // --------------------- //
+
+#include <stc/scoop.hxx>
+
+
// ------- //
// Point. //
// ------- //
- template <typename E>
- struct Point : public stc::any<E>
+ template <typename Exact>
+ struct Point : public stc::any<Exact>
{
};
@@ -84,10 +91,10 @@
// Iterator. //
// ---------- //
- template <typename E>
- struct Iterator : public stc::any<E>
+ template <typename Exact>
+ struct Iterator : public stc::any<Exact>
{
- typedef oln_type_of(E, point) point_t;
+ typedef oln_type_of(Exact, point) point_t;
void start()
{
@@ -116,11 +123,11 @@
// Image. //
// ------- //
- template <typename E>
- struct Image : public stc::any<E>
+ template <typename Exact>
+ struct Image : public stc::any<Exact>
{
- typedef oln_type_of(E, point) point_t;
- typedef oln_type_of(E, rvalue) rvalue_t;
+ typedef oln_type_of(Exact, point) point_t;
+ typedef oln_type_of(Exact, rvalue) rvalue_t;
rvalue_t operator ()(point_t& p) const
{
@@ -138,14 +145,14 @@
// Image2d. //
// --------- //
- template <typename E>
- struct Image2d : public virtual Image<E>
+ template <typename Exact>
+ struct Image2d : public virtual Image<Exact>
{
- typedef oln_type_of(E, point) point_t;
+ typedef oln_type_of(Exact, point) point_t;
// inherited from Image
- // typedef oln_type_of(E, rvalue) rvalue_t;
+ // typedef oln_type_of(Exact, rvalue) rvalue_t;
// rvalue_t& operator ()(point_t& p)
// {
@@ -168,14 +175,14 @@
// Image3d. //
// --------- //
- template <typename E>
- struct Image3d : public virtual Image<E>
+ template <typename Exact>
+ struct Image3d : public virtual Image<Exact>
{
- typedef oln_type_of(E, point) point_t;
+ typedef oln_type_of(Exact, point) point_t;
// inherited from Image
- // typedef oln_type_of(E, rvalue) rvalue_t;
+ // typedef oln_type_of(Exact, rvalue) rvalue_t;
// rvalue_t& operator ()(point_t& p)
// {
@@ -203,11 +210,11 @@
// Mutable_Image //
// ------------- //
- template <typename E>
- struct Mutable_Image : public virtual Image<E>
+ template <typename Exact>
+ struct Mutable_Image : public virtual Image<Exact>
{
- typedef oln_type_of(E, point) point_t;
- typedef oln_type_of(E, lvalue) lvalue_t;
+ typedef oln_type_of(Exact, point) point_t;
+ typedef oln_type_of(Exact, lvalue) lvalue_t;
lvalue_t operator ()(point_t& p)
{
@@ -220,11 +227,11 @@
// Image_with_neighborhood. //
// ------------------------- //
- template <typename E>
- struct Image_with_neighborhood : public virtual Image<E>
+ template <typename Exact>
+ struct Image_with_neighborhood : public virtual Image<Exact>
{
- typedef oln_type_of(E, nbh) nbh_t;
- typedef oln_type_of(E, niter) niter_t;
+ typedef oln_type_of(Exact, nbh) nbh_t;
+ typedef oln_type_of(Exact, niter) niter_t;
nbh_t nbh() const
{
@@ -252,24 +259,24 @@
struct point2d;
struct point3d;
- template <typename E>
- struct case_<switch_image_base, E, 1> :
- public mlc::where_ < mlc::eq_ <oln_type_of(E, point), point2d> >
+ template <typename Exact>
+ struct case_<switch_image_base, Exact, 1> :
+ public mlc::where_ < mlc::eq_ <oln_type_of(Exact, point), point2d> >
{
- typedef Image2d<E> ret;
+ typedef Image2d<Exact> ret;
};
- template <typename E>
- struct case_<switch_image_base, E, 2> :
- public mlc::where_ < mlc::eq_ <oln_type_of(E, point), point3d> >
+ template <typename Exact>
+ struct case_<switch_image_base, Exact, 2> :
+ public mlc::where_ < mlc::eq_ <oln_type_of(Exact, point), point3d> >
{
- typedef Image3d<E> ret;
+ typedef Image3d<Exact> ret;
};
- template <typename E>
- struct default_case_<switch_image_base, E>
+ template <typename Exact>
+ struct default_case_<switch_image_base, Exact>
{
- typedef Image<E> ret;
+ typedef Image<Exact> ret;
};
// ----------------- //
@@ -279,17 +286,17 @@
// Tag.
struct switch_image_base_mutable;
- template <typename E>
- struct case_<switch_image_base_mutable, E, 1> :
- public mlc::where_ < mlc::is_found_< stc_vtype(oln, E, lvalue) > >
+ template <typename Exact>
+ struct case_<switch_image_base_mutable, Exact, 1> :
+ public mlc::where_ < stc_type_is_found(lvalue) >
{
- typedef Mutable_Image<E> ret;
+ typedef Mutable_Image<Exact> ret;
};
- template <typename E>
- struct default_case_<switch_image_base_mutable, E>
+ template <typename Exact>
+ struct default_case_<switch_image_base_mutable, Exact>
{
- typedef Image<E> ret;
+ typedef Image<Exact> ret;
};
// ------------ //
@@ -297,30 +304,31 @@
// ------------ //
// Forward declaration.
- template <typename E> struct image_base;
+ template <typename Exact> struct image_base;
- template<typename E>
- struct set_super_type< image_base<E> >
+ template<typename Exact>
+ struct super_trait_< image_base<Exact> >
{
typedef mlc::none ret;
};
- template <typename E>
- struct vtypes< image_base<E> >
+ template <typename Exact>
+ struct vtypes< image_base<Exact> >
{
- typedef stc::abstract point_type;
- typedef stc::abstract iter_type;
- typedef stc::abstract value_type;
- typedef stc::abstract rvalue_type;
- typedef stc::abstract lvalue_type;
-
- typedef mlc::none niter_type;
- typedef mlc::none nbh_type;
- };
-
- template <typename E>
- struct image_base : public virtual switch_<switch_image_base, E>::ret,
- public virtual switch_<switch_image_base_mutable, E>::ret
+ typedef stc::abstract point;
+ typedef stc::abstract iter;
+ typedef stc::abstract value;
+ typedef stc::abstract rvalue;
+ typedef stc::abstract lvalue;
+
+ typedef mlc::none niter;
+ typedef mlc::none nbh;
+ };
+
+ template <typename Exact>
+ struct image_base :
+ public virtual switch_<switch_image_base, Exact>::ret,
+ public virtual switch_<switch_image_base_mutable, Exact>::ret
{
image_base()
{
@@ -363,7 +371,7 @@
template <typename T> struct image2d;
template<>
- struct set_super_type<iterator2d>
+ struct super_trait_<iterator2d>
{
typedef mlc::none ret;
};
@@ -371,7 +379,7 @@
template <>
struct vtypes<iterator2d>
{
- typedef point2d point_type;
+ typedef point2d point;
};
struct iterator2d : public Iterator<iterator2d>
@@ -427,7 +435,7 @@
template <typename T> struct image2d;
template<typename T>
- struct set_super_type< image2d<T> >
+ struct super_trait_< image2d<T> >
{
typedef image_base< image2d<T> > ret;
};
@@ -435,11 +443,11 @@
template <typename T>
struct vtypes< image2d<T> >
{
- typedef point2d point_type;
- typedef iterator2d iter_type;
- typedef T value_type;
- typedef value_type rvalue_type;
- typedef value_type& lvalue_type;
+ typedef point2d point;
+ typedef iterator2d iter;
+ typedef T value;
+ typedef value rvalue;
+ typedef value& lvalue;
};
template <typename T>
@@ -499,7 +507,7 @@
struct neighborhood2d
{
- typedef niter2d niter_type;
+ typedef niter2d niter;
};
@@ -512,7 +520,7 @@
template <typename T> struct image3d;
template<>
- struct set_super_type<iterator3d>
+ struct super_trait_<iterator3d>
{
typedef mlc::none ret;
};
@@ -520,7 +528,7 @@
template <>
struct vtypes<iterator3d>
{
- typedef point3d point_type;
+ typedef point3d point;
};
struct iterator3d : public Iterator<iterator3d>
@@ -584,7 +592,7 @@
template <typename T> struct image3d;
template<typename T>
- struct set_super_type< image3d<T> >
+ struct super_trait_< image3d<T> >
{
typedef image_base< image3d<T> > ret;
};
@@ -592,11 +600,11 @@
template <typename T>
struct vtypes< image3d<T> >
{
- typedef point3d point_type;
- typedef iterator3d iter_type;
- typedef T value_type;
- typedef value_type rvalue_type;
- typedef value_type& lvalue_type;
+ typedef point3d point;
+ typedef iterator3d iter;
+ typedef T value;
+ typedef value rvalue;
+ typedef value& lvalue;
};
template <typename T>
@@ -665,7 +673,7 @@
struct neighborhood3d
{
- typedef niter3d niter_type;
+ typedef niter3d niter;
};
@@ -674,24 +682,24 @@
// --------------- //
// Forward declaration.
- template <typename E> struct image_morpher;
+ template <typename Exact> struct image_morpher;
- template<typename E>
- struct set_super_type< image_morpher<E> >
+ template<typename Exact>
+ struct super_trait_< image_morpher<Exact> >
{
- typedef image_base<E> ret;
+ typedef image_base<Exact> ret;
};
- template <typename E>
- struct vtypes< image_morpher<E> >
+ template <typename Exact>
+ struct vtypes< image_morpher<Exact> >
{
- typedef stc::abstract delegatee_type;
+ typedef stc::abstract delegatee;
};
- template <typename E>
- struct image_morpher : public image_base<E>
+ template <typename Exact>
+ struct image_morpher : public image_base<Exact>
{
- typedef oln_type_of(E, delegatee) delegatee_t;
+ typedef oln_type_of(Exact, delegatee) delegatee_t;
image_morpher(delegatee_t& ref_ima) :
ref_ima (ref_ima)
@@ -715,7 +723,7 @@
template <typename I, typename N> struct plus;
template <typename I, typename N>
- struct set_super_type< plus<I, N> >
+ struct super_trait_< plus<I, N> >
{
typedef image_morpher< plus <I, N> > ret;
};
@@ -723,12 +731,12 @@
template <typename I, typename N>
struct vtypes< plus<I, N> >
{
- typedef I delegatee_type;
- typedef N nbh_type;
+ typedef I delegatee;
+ typedef N nbh;
// For the sake of simplicity, the niter type is obtained directly
// from the neighborhood type itself (without using a virtual
// type).
- typedef typename N::niter_type niter_type;
+ typedef typename N::niter niter;
};
template <typename I, typename N>
Index: samples/mini-std/cpp/impl.hh
--- samples/mini-std/cpp/impl.hh (revision 1031)
+++ samples/mini-std/cpp/impl.hh (working copy)
@@ -14,25 +14,25 @@
{
// front insertion
- template <typename b, typename E> struct front_insertion_sequence;
- template <typename E> struct front_insertion_sequence <mlc::true_, E> : virtual Front_Insertion_Sequence<E> {};
- template <typename E> struct front_insertion_sequence <mlc::false_, E> : virtual Sequence<E> {};
+ template <typename b, typename Exact> struct front_insertion_sequence;
+ template <typename Exact> struct front_insertion_sequence <mlc::true_, Exact> : virtual Front_Insertion_Sequence<Exact> {};
+ template <typename Exact> struct front_insertion_sequence <mlc::false_, Exact> : virtual Sequence<Exact> {};
// back insertion
- template <typename b, typename E> struct back_insertion_sequence;
- template <typename E> struct back_insertion_sequence <mlc::true_, E> : virtual Back_Insertion_Sequence<E> {};
- template <typename E> struct back_insertion_sequence <mlc::false_, E> : virtual Sequence<E> {};
+ template <typename b, typename Exact> struct back_insertion_sequence;
+ template <typename Exact> struct back_insertion_sequence <mlc::true_, Exact> : virtual Back_Insertion_Sequence<Exact> {};
+ template <typename Exact> struct back_insertion_sequence <mlc::false_, Exact> : virtual Sequence<Exact> {};
// random access
- template <typename b, typename E> struct random_access_container;
- template <typename E> struct random_access_container <mlc::true_, E> : virtual Random_Access_Container<E> {};
- template <typename E> struct random_access_container <mlc::false_, E> : virtual Container<E> {};
+ template <typename b, typename Exact> struct random_access_container;
+ template <typename Exact> struct random_access_container <mlc::true_, Exact> : virtual Random_Access_Container<Exact> {};
+ template <typename Exact> struct random_access_container <mlc::false_, Exact> : virtual Container<Exact> {};
- template <typename E>
+ template <typename Exact>
struct container_switch
- : front_insertion_sequence< abc_vtype(E, has_front_insertion), E >,
- back_insertion_sequence < abc_vtype(E, has_back_insertion), E >,
- random_access_container < abc_vtype(E, has_random_access), E >
+ : front_insertion_sequence< abc_vtype(Exact, has_front_insertion), Exact >,
+ back_insertion_sequence < abc_vtype(Exact, has_back_insertion), Exact >,
+ random_access_container < abc_vtype(Exact, has_random_access), Exact >
{
protected:
container_switch() {}
@@ -55,15 +55,19 @@
- // Class container_base<E>.
+ // Class container_base<Exact>.
- template <typename E> class container_base;
+ template <typename Exact> class container_base;
- template <typename E>
- struct vtypes< container_base<E> >
+ template <typename Exact>
+ struct super_trait_< container_base<Exact> >
{
- typedef mlc::none super_type;
+ typedef mlc::none ret;
+ };
+ template <typename Exact>
+ struct vtypes< container_base<Exact> >
+ {
typedef stc::abstract value_type;
typedef stc::abstract iterator;
typedef stc::abstract const_iterator;
@@ -78,39 +82,48 @@
typedef stc::abstract tag;
};
- template <typename E>
- class container_base : public internal::container_switch<E>
+ template <typename Exact>
+ class container_base : public internal::container_switch<Exact>
{
public:
// FIXME: remove below.
- typedef typename Back_Insertion_Sequence<E>::reference reference;
- typedef typename Back_Insertion_Sequence<E>::const_reference const_reference;
+ typedef typename Back_Insertion_Sequence<Exact>::reference reference;
+ typedef typename Back_Insertion_Sequence<Exact>::const_reference const_reference;
protected:
container_base() {}
};
- // Class morpher_container<E>.
+ // Class morpher_container<Exact>.
+
+ template <typename Exact> class morpher_container;
- template <typename E> class morpher_container;
- template <typename E>
- struct vtypes< morpher_container<E> >
+ template <typename Exact>
+ struct super_trait_< morpher_container<Exact> >
+ {
+ typedef container_base<Exact> ret;
+ };
+
+ template <typename Exact>
+ struct vtypes< morpher_container<Exact> >
{
- typedef container_base<E> super_type;
- typedef stc::abstract delegatee_type;
+ typedef stc::abstract delegatee;
};
- template <typename E>
- class morpher_container : public container_base<E>
+ template <typename Exact>
+ class morpher_container : public container_base<Exact>
{
public:
- stc_using_from(Container<E>, value_type);
- abc_typename(delegatee_type);
+ stc_using_from(Container, value_type);
+ abc_typename(delegatee);
- const delegatee_type& delegatee() const { return this->exact().impl_delegatee(); }
- delegatee_type& delegatee() { return this->exact().impl_delegatee(); }
+ // FIXME: `delegatee_' and `impl_delegatee_' are not elegant
+ // names, but we cannot use `delegatee' (since it is a typedef in
+ // this class). Find better names.
+ const delegatee& delegatee_() const { return this->exact().impl_delegatee_(); }
+ delegatee& delegatee_() { return this->exact().impl_delegatee_(); }
protected:
morpher_container() {}
@@ -118,36 +131,46 @@
- // Class primary_container<E>.
+ // Class primary_container<Exact>.
- template <typename E> class primary_container;
+ template <typename Exact> class primary_container;
- template <typename E>
- struct vtypes< primary_container<E> >
+ template <typename Exact>
+ struct super_trait_< primary_container<Exact> >
+ {
+ typedef container_base<Exact> ret;
+ };
+
+ template <typename Exact>
+ struct vtypes< primary_container<Exact> >
{
- typedef container_base<E> super_type;
typedef mlc::none tag;
};
- template <typename E>
- class primary_container : public container_base<E>
+ template <typename Exact>
+ class primary_container : public container_base<Exact>
{
public:
- stc_using_from(Container<E>, value_type);
+ stc_using_from(Container, value_type);
protected:
primary_container() {}
};
- // Class primary_std_container<E>.
+ // Class primary_std_container<Exact>.
- template <typename E> class primary_std_container;
+ template <typename Exact> class primary_std_container;
+
+ template <typename Exact>
+ struct super_trait_< primary_std_container<Exact> >
+ {
+ typedef primary_container<Exact> ret;
+ };
- template <typename E>
- struct vtypes< primary_std_container<E> >
+ template <typename Exact>
+ struct vtypes< primary_std_container<Exact> >
{
- typedef primary_container<E> super_type;
typedef stc::abstract std_type;
typedef stc_defer(std_type) container_t;
@@ -159,11 +182,11 @@
typedef stc::final<typename container_t::size_type> size_type;
};
- template <typename E>
- class primary_std_container : public primary_container<E>
+ template <typename Exact>
+ class primary_std_container : public primary_container<Exact>
{
public:
- typedef primary_container<E> super;
+ typedef primary_container<Exact> super;
stc_using(iterator);
stc_using(const_iterator);
@@ -179,8 +202,8 @@
bool impl_empty() const { return data_.empty(); }
// Forward_Container.
- bool impl_equal(const E& rhs) const { return data_ == rhs.data_; }
- bool impl_less (const E& rhs) const { return data_ < rhs.data_; }
+ bool impl_equal(const Exact& rhs) const { return data_ == rhs.data_; }
+ bool impl_less (const Exact& rhs) const { return data_ < rhs.data_; }
protected:
@@ -189,7 +212,7 @@
primary_std_container(size_type n, const value_type& t) : data_(n, t) {}
primary_std_container(const primary_std_container& rhs) : data_(rhs.data_) {}
- abc_vtype(E, std_type) data_;
+ abc_vtype(Exact, std_type) data_;
};
Index: samples/mini-std/cpp/vector.hh
--- samples/mini-std/cpp/vector.hh (revision 1031)
+++ samples/mini-std/cpp/vector.hh (working copy)
@@ -11,13 +11,16 @@
template <typename T> class vector;
+ template <typename T>
+ struct super_trait_< vector<T> >
+ {
+ typedef vector<T> self__;
+ typedef primary_std_container<self__> ret;
+ };
template <typename T>
struct vtypes< vector<T> >
{
- typedef vector<T> E;
- typedef primary_std_container<E> super_type;
-
typedef std::vector<T> std_type;
// As Reversible_Container:
Index: samples/mini-std/cpp/deque.hh
--- samples/mini-std/cpp/deque.hh (revision 1031)
+++ samples/mini-std/cpp/deque.hh (working copy)
@@ -8,17 +8,18 @@
namespace abc
{
-
template <typename T> class deque;
-
+ typename <template T>
+ struct super_trait_< deque<T> >
+ {
+ typedef deque<T> self__;
+ typedef primary_std_container<self__> ret;
+ };
template <typename T>
struct vtypes< deque<T> >
{
- typedef deque<T> E;
- typedef primary_std_container<E> super_type;
-
typedef std::deque<T> std_type;
// As Reversible_Container:
Index: samples/mini-std/cpp/stack.hh
--- samples/mini-std/cpp/stack.hh (revision 1031)
+++ samples/mini-std/cpp/stack.hh (working copy)
@@ -10,15 +10,17 @@
template <typename T, typename S> class stack;
-
+ template <typename T, S>
+ struct super_trait_< list<T, S> >
+ {
+ typedef stack<T, S> self__;
+ typedef morpher_container<self__> ret;
+ };
template <typename T, typename S>
struct vtypes< stack<T,S> >
{
- typedef stack<T,S> E;
- typedef morpher_container<E> super_type;
-
- typedef S delegatee_type;
+ typedef S delegatee;
// Properties.
typedef mlc::false_ has_front_insertion;
@@ -39,7 +41,7 @@
stc_using(reference);
stc_using(value_type);
- stc_using(delegatee_type);
+ stc_using(delegatee);
// Renaming.
reference top()
@@ -57,8 +59,8 @@
this->pop_back();
}
- const delegatee_type& impl_delegatee() const { return this->seq_; }
- delegatee_type& impl_delegatee() { return this->seq_; }
+ const delegatee& impl_delegatee_() const { return this->seq_; }
+ delegatee& impl_delegatee_() { return this->seq_; }
protected:
S seq_;
Index: samples/mini-std/cpp/value_cast.hh
--- samples/mini-std/cpp/value_cast.hh (revision 1031)
+++ samples/mini-std/cpp/value_cast.hh (working copy)
@@ -11,14 +11,17 @@
template <typename T, typename C> class value_cast_;
+ template <typename T, C>
+ struct super_trait_< value_cast_<T, C> >
+ {
+ typedef value_cast_<T, C> self__;
+ typedef morpher_container<self__> super_type;
+ };
template <typename T, typename C>
struct vtypes< value_cast_<T,C> >
{
- typedef value_cast_<T,C> E;
- typedef morpher_container<E> super_type;
-
- typedef C delegatee_type;
+ typedef C delegatee;
typedef T value_type;
typedef T& reference;
@@ -36,15 +39,15 @@
typedef value_cast_<T,C> self_type;
typedef morpher_container<self_type> super;
- stc_using(delegatee_type);
+ stc_using(delegatee);
value_cast_(Container<C>& con)
: con_(con.exact())
{
}
- const delegatee_type& impl_delegatee() const { return this->con_; }
- delegatee_type& impl_delegatee() { return this->con_; }
+ const delegatee& impl_delegatee_() const { return this->con_; }
+ delegatee& impl_delegatee_() { return this->con_; }
protected:
C& con_;
Index: samples/mini-std/cpp/equipment.hh
--- samples/mini-std/cpp/equipment.hh (revision 1031)
+++ samples/mini-std/cpp/equipment.hh (working copy)
@@ -6,33 +6,32 @@
# include <stc/scoop.hh>
-stc_scoop_equipment_for_namespace(abc);
-
-
// Patch.
# define abc_vtype_(From, Target) abc::vtype<From, abc::typedef_::Target>::ret
# define abc_vtype(From, Target) typename abc_vtype_(From, Target)
-# define abc_typename(Vtype) typedef abc_vtype(E, Vtype) Vtype
+# define abc_typename(Vtype) typedef abc_vtype(Exact, Vtype) Vtype
-# define stc_defer(Target) typename abc::deferred_vtype<E, abc::typedef_::Target>::ret
-
-# define stc_using(Vtype) typedef typename super::Vtype Vtype
-# define stc_using_from(From, Vtype) typedef typename From::Vtype Vtype
+# define stc_defer(Target) \
+ typename abc::deferred_vtype<Exact, abc::typedef_::Target>::ret
# define stc_introducing(Vtype) typedef abc_vtype(self_type, Vtype) Vtype
-// stc_deferred_vtype(test, E, dim)
+// stc_deferred_vtype(test, Exact, dim)
namespace abc
{
- /// \{
+// Namespace equipment.
+#include <stc/scoop.hxx>
+
+
/// Typedef declarations.
+ /// \{
// From std.
mlc_decl_typedef(value_type);
@@ -64,17 +63,19 @@
namespace automatic
{
- template < template <class> class abstraction, typename E, typename tag = void >
+ template < template <class> class abstraction,
+ typename Exact, typename tag = void >
struct impl;
- template < template <class> class abstraction, typename E >
- struct impl< abstraction, E, mlc::none >
+ template < template <class> class abstraction, typename Exact >
+ struct impl< abstraction, Exact, mlc::none >
{
// none means nothing!
};
- template < template <class> class abstraction, typename E >
- struct impl< abstraction, E, void > : impl< abstraction, E, abc_vtype(E, tag) >
+ template < template <class> class abstraction, typename Exact >
+ struct impl< abstraction, Exact, void >
+ : impl< abstraction, Exact, abc_vtype(Exact, tag) >
{
// fetch impl w.r.t. tag
};
Index: samples/mini-std/cpp/identity.hh
--- samples/mini-std/cpp/identity.hh (revision 1031)
+++ samples/mini-std/cpp/identity.hh (working copy)
@@ -19,8 +19,8 @@
// FIXME: Hack! (to be removed)
- template < template <class> class abstraction, typename E >
- struct impl< abstraction, E, tag::identity >
+ template < template <class> class abstraction, typename Exact >
+ struct impl< abstraction, Exact, tag::identity >
{
// ...
};
@@ -29,10 +29,10 @@
// Container
- template <typename E>
- class impl< Container, E, tag::identity >
+ template <typename Exact>
+ class impl< Container, Exact, tag::identity >
:
- public virtual stc::any__simple<E>
+ public virtual stc::any__simple<Exact>
{
protected:
abc_typename(value_type);
@@ -40,117 +40,117 @@
abc_typename(const_iterator);
abc_typename(size_type);
public:
- iterator impl_begin() { return this->exact().delegatee().begin(); }
- const_iterator impl_begin() const { return this->exact().delegatee().begin(); }
- iterator impl_end() { return this->exact().delegatee().end(); }
- const_iterator impl_end() const { return this->exact().delegatee().end(); }
- size_type impl_size() const { return this->exact().delegatee().size(); }
- bool impl_empty() const { return this->exact().delegatee().empty(); }
+ iterator impl_begin() { return this->exact().delegatee_().begin(); }
+ const_iterator impl_begin() const { return this->exact().delegatee_().begin(); }
+ iterator impl_end() { return this->exact().delegatee_().end(); }
+ const_iterator impl_end() const { return this->exact().delegatee_().end(); }
+ size_type impl_size() const { return this->exact().delegatee_().size(); }
+ bool impl_empty() const { return this->exact().delegatee_().empty(); }
};
// Forward_Container
- template <typename E>
- class impl< Forward_Container, E, tag::identity >
+ template <typename Exact>
+ class impl< Forward_Container, Exact, tag::identity >
:
- public virtual stc::any__simple<E>
+ public virtual stc::any__simple<Exact>
{
protected:
- typedef Forward_Container<E> self_type;
+ typedef Forward_Container<Exact> self_type;
public:
- bool impl_equal(const self_type& rhs) const { return this->exact().delegatee().operator==(rhs); }
- bool impl_less (const self_type& rhs) const { return this->exact().delegatee().operator< (rhs); }
+ bool impl_equal(const self_type& rhs) const { return this->exact().delegatee_().operator==(rhs); }
+ bool impl_less (const self_type& rhs) const { return this->exact().delegatee_().operator< (rhs); }
};
// Reversible_Container
- template <typename E>
- class impl< Reversible_Container, E, tag::identity >
+ template <typename Exact>
+ class impl< Reversible_Container, Exact, tag::identity >
:
- public virtual stc::any__simple<E>
+ public virtual stc::any__simple<Exact>
{
protected:
abc_typename(reverse_iterator);
abc_typename(const_reverse_iterator);
public:
- reverse_iterator impl_rbegin() { return this->exact().delegatee().rbegin(); }
- const_reverse_iterator impl_rbegin() const { return this->exact().delegatee().rbegin(); }
- reverse_iterator impl_rend() { return this->exact().delegatee().rend(); }
- const_reverse_iterator impl_rend() const { return this->exact().delegatee().rend(); }
+ reverse_iterator impl_rbegin() { return this->exact().delegatee_().rbegin(); }
+ const_reverse_iterator impl_rbegin() const { return this->exact().delegatee_().rbegin(); }
+ reverse_iterator impl_rend() { return this->exact().delegatee_().rend(); }
+ const_reverse_iterator impl_rend() const { return this->exact().delegatee_().rend(); }
};
// Random_Access_Container
- template <typename E>
- class impl< Random_Access_Container, E, tag::identity >
+ template <typename Exact>
+ class impl< Random_Access_Container, Exact, tag::identity >
:
- public virtual stc::any__simple<E>
+ public virtual stc::any__simple<Exact>
{
protected:
abc_typename(reference);
abc_typename(const_reference);
abc_typename(size_type);
public:
- reference impl_brackets(size_type n) { return this->exact().delegatee()[n]; }
- const_reference impl_brackets(size_type n) const { return this->exact().delegatee()[n]; }
+ reference impl_brackets(size_type n) { return this->exact().delegatee_()[n]; }
+ const_reference impl_brackets(size_type n) const { return this->exact().delegatee_()[n]; }
};
// Sequence
- template <typename E>
- class impl< Sequence, E, tag::identity >
+ template <typename Exact>
+ class impl< Sequence, Exact, tag::identity >
:
- public virtual stc::any__simple<E>
+ public virtual stc::any__simple<Exact>
{
protected:
abc_typename(value_type);
abc_typename(iterator);
public:
- iterator impl_insert(iterator p, value_type t) { return this->exact().delegatee().insert(p, t); }
- iterator impl_erase(iterator p) { return this->exact().delegatee().erase(p); }
- iterator impl_erase(iterator p, iterator q) { return this->exact().delegatee().erase(p, q); }
+ iterator impl_insert(iterator p, value_type t) { return this->exact().delegatee_().insert(p, t); }
+ iterator impl_erase(iterator p) { return this->exact().delegatee_().erase(p); }
+ iterator impl_erase(iterator p, iterator q) { return this->exact().delegatee_().erase(p, q); }
};
// Front_Insertion_Sequence
- template <typename E>
- class impl< Front_Insertion_Sequence, E, tag::identity >
+ template <typename Exact>
+ class impl< Front_Insertion_Sequence, Exact, tag::identity >
:
- public virtual stc::any__simple<E>
+ public virtual stc::any__simple<Exact>
{
protected:
abc_typename(value_type);
public:
- void impl_push_front(value_type t) { this->exact().delegatee().push_front(t); }
- void impl_pop_front() { this->exact().delegatee().pop_front(); }
+ void impl_push_front(value_type t) { this->exact().delegatee_().push_front(t); }
+ void impl_pop_front() { this->exact().delegatee_().pop_front(); }
};
// Back_Insertion_Sequence
- template <typename E>
- class impl< Back_Insertion_Sequence, E, tag::identity >
+ template <typename Exact>
+ class impl< Back_Insertion_Sequence, Exact, tag::identity >
:
- public virtual stc::any__simple<E>
+ public virtual stc::any__simple<Exact>
{
protected:
abc_typename(value_type);
abc_typename(reference);
public:
- reference impl_back() { this->exact().delegatee().back(); }
- void impl_push_back(value_type t) { this->exact().delegatee().push_back(t); }
- void impl_pop_back() { this->exact().delegatee().pop_back(); }
+ reference impl_back() { this->exact().delegatee_().back(); }
+ void impl_push_back(value_type t) { this->exact().delegatee_().push_back(t); }
+ void impl_pop_back() { this->exact().delegatee_().pop_back(); }
};
Index: samples/mini-std/cpp/fwddecls.hh
--- samples/mini-std/cpp/fwddecls.hh (revision 1031)
+++ samples/mini-std/cpp/fwddecls.hh (working copy)
@@ -16,10 +16,10 @@
// | +-- Random_Access_Container
// |
- template <typename E> class Container;
- template <typename E> class Forward_Container;
- template <typename E> class Reversible_Container;
- template <typename E> class Random_Access_Container;
+ template <typename Exact> class Container;
+ template <typename Exact> class Forward_Container;
+ template <typename Exact> class Reversible_Container;
+ template <typename Exact> class Random_Access_Container;
// |
// +-- Sequence
@@ -29,9 +29,9 @@
// | +-- Back_Insertion_Sequence
// |
- template <typename E> class Sequence;
- template <typename E> class Front_Insertion_Sequence;
- template <typename E> class Back_Insertion_Sequence;
+ template <typename Exact> class Sequence;
+ template <typename Exact> class Front_Insertion_Sequence;
+ template <typename Exact> class Back_Insertion_Sequence;
// |
// +-- Associative_Container
@@ -45,13 +45,13 @@
// +-- Unique_Associative_Container
// +-- Multiple_Associative_Container
- template <typename E> class Associative_Container;
- template <typename E> class Simple_Associative_Container;
- template <typename E> class Pair_Associative_Container;
- template <typename E> class Sorted_Associative_Container;
- template <typename E> class Hashed_Associative_Container;
- template <typename E> class Unique_Associative_Container;
- template <typename E> class Multiple_Associative_Container;
+ template <typename Exact> class Associative_Container;
+ template <typename Exact> class Simple_Associative_Container;
+ template <typename Exact> class Pair_Associative_Container;
+ template <typename Exact> class Sorted_Associative_Container;
+ template <typename Exact> class Hashed_Associative_Container;
+ template <typename Exact> class Unique_Associative_Container;
+ template <typename Exact> class Multiple_Associative_Container;
@@ -69,13 +69,13 @@
// |
// +-- Random_Access_Iterator
- template <typename E> class Iterator;
- template <typename E> class Trivial_Iterator;
- template <typename E> class Input_Iterator;
- template <typename E> class Output_Iterator;
- template <typename E> class Forward_Iterator;
- template <typename E> class Bidirectional_Iterator;
- template <typename E> class Random_Access_Iterator;
+ template <typename Exact> class Iterator;
+ template <typename Exact> class Trivial_Iterator;
+ template <typename Exact> class Input_Iterator;
+ template <typename Exact> class Output_Iterator;
+ template <typename Exact> class Forward_Iterator;
+ template <typename Exact> class Bidirectional_Iterator;
+ template <typename Exact> class Random_Access_Iterator;
} // end of namespace abc
Index: samples/mini-std/cpp/list.hh
--- samples/mini-std/cpp/list.hh (revision 1031)
+++ samples/mini-std/cpp/list.hh (working copy)
@@ -11,13 +11,16 @@
template <typename T> class list;
+ typename <template T>
+ struct super_trait_< list<T> >
+ {
+ typedef list<T> self__;
+ typedef primary_std_container<self__> ret;
+ };
template <typename T>
struct vtypes< list<T> >
{
- typedef list<T> E;
- typedef primary_std_container<E> super_type;
-
typedef std::list<T> std_type;
// As Reversible_Container:
Index: samples/mini-std/cpp/Makefile.am
--- samples/mini-std/cpp/Makefile.am (revision 0)
+++ samples/mini-std/cpp/Makefile.am (revision 0)
@@ -0,0 +1,22 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+AM_CPPFLAGS = -I$(top_srcdir)/static -I$(top_srcdir)/metalic
+
+# FIXME: Add
+#
+# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
+#
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
+TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
+
+
+noinst_HEADERS = \
+ algorithm.hh concepts.hh deque.hh equipment.hh fwddecls.hh \
+ identity.hh impl.hh list.hh stack.hh value_cast.hh vector.hh
+
+check_PROGRAMS = test
+test_SOURCES = main.cc
+
+TESTS = $(check_PROGRAMS)
Index: samples/mini-std/cpp/concepts.hh
--- samples/mini-std/cpp/concepts.hh (revision 1031)
+++ samples/mini-std/cpp/concepts.hh (working copy)
@@ -9,9 +9,9 @@
// Container
- template <typename E>
- class Container : public virtual stc::any__simple<E>,
- public automatic::impl<Container, E>
+ template <typename Exact>
+ class Container : public virtual stc::any__simple<Exact>,
+ public automatic::impl<Container, Exact>
{
public:
@@ -39,13 +39,13 @@
// Forward_Container
- template <typename E>
- class Forward_Container : public virtual Container<E>,
- public automatic::impl<Forward_Container, E>
+ template <typename Exact>
+ class Forward_Container : public virtual Container<Exact>,
+ public automatic::impl<Forward_Container, Exact>
{
public:
- typedef Forward_Container<E> self_type;
+ typedef Forward_Container<Exact> self_type;
// Methods.
bool operator==(const self_type& rhs) const { return this->exact().impl_equal(rhs.exact()); }
@@ -65,9 +65,9 @@
// Reversible_Container
- template <typename E>
- class Reversible_Container : public virtual Forward_Container<E>,
- public automatic::impl<Reversible_Container, E>
+ template <typename Exact>
+ class Reversible_Container : public virtual Forward_Container<Exact>,
+ public automatic::impl<Reversible_Container, Exact>
{
public:
@@ -89,13 +89,13 @@
// Random_Access_Container
- template <typename E>
- class Random_Access_Container : public virtual Reversible_Container<E>,
- public automatic::impl<Random_Access_Container, E>
+ template <typename Exact>
+ class Random_Access_Container : public virtual Reversible_Container<Exact>,
+ public automatic::impl<Random_Access_Container, Exact>
{
public:
- typedef Reversible_Container<E> super;
+ typedef Reversible_Container<Exact> super;
stc_using(reference);
stc_using(const_reference);
stc_using(size_type);
@@ -113,13 +113,13 @@
// Sequence
- template <typename E>
- class Sequence : public virtual Forward_Container<E>,
- public automatic::impl<Sequence, E>
+ template <typename Exact>
+ class Sequence : public virtual Forward_Container<Exact>,
+ public automatic::impl<Sequence, Exact>
{
public:
- typedef Forward_Container<E> super;
+ typedef Forward_Container<Exact> super;
stc_using(iterator);
stc_using(value_type);
stc_using(reference);
@@ -155,13 +155,13 @@
// Front_Insertion_Sequence
- template <typename E>
- class Front_Insertion_Sequence : public virtual Sequence<E>,
- public automatic::impl<Front_Insertion_Sequence, E>
+ template <typename Exact>
+ class Front_Insertion_Sequence : public virtual Sequence<Exact>,
+ public automatic::impl<Front_Insertion_Sequence, Exact>
{
public:
- typedef Sequence<E> super;
+ typedef Sequence<Exact> super;
stc_using(value_type);
// Concrete.
@@ -183,13 +183,13 @@
// Back_Insertion_Sequence
- template <typename E>
- class Back_Insertion_Sequence : public virtual Sequence<E>,
- public automatic::impl<Back_Insertion_Sequence, E>
+ template <typename Exact>
+ class Back_Insertion_Sequence : public virtual Sequence<Exact>,
+ public automatic::impl<Back_Insertion_Sequence, Exact>
{
public:
- typedef Sequence<E> super;
+ typedef Sequence<Exact> super;
stc_using(reference);
stc_using(value_type);
@@ -216,9 +216,9 @@
// Iterator
- template <typename E>
- class Iterator : public virtual stc::any__simple<E>,
- public automatic::impl<Iterator, E>
+ template <typename Exact>
+ class Iterator : public virtual stc::any__simple<Exact>,
+ public automatic::impl<Iterator, Exact>
{
public:
@@ -232,13 +232,13 @@
// Trivial_Iterator
- template <typename E>
- class Trivial_Iterator : public virtual Iterator<E>,
- public automatic::impl<Trivial_Iterator, E>
+ template <typename Exact>
+ class Trivial_Iterator : public virtual Iterator<Exact>,
+ public automatic::impl<Trivial_Iterator, Exact>
{
public:
- typedef Trivial_Iterator<E> self_type;
+ typedef Trivial_Iterator<Exact> self_type;
// Typedef.
abc_typename(value_type);
@@ -262,9 +262,9 @@
// Input_Iterator
- template <typename E>
- class Input_Iterator : public virtual Trivial_Iterator<E>,
- public automatic::impl<Input_Iterator, E>
+ template <typename Exact>
+ class Input_Iterator : public virtual Trivial_Iterator<Exact>,
+ public automatic::impl<Input_Iterator, Exact>
{
public:
@@ -272,12 +272,12 @@
abc_typename(distance_type);
// Method.
- E& operator++() { return this->exact().impl_preinc(); }
+ Exact& operator++() { return this->exact().impl_preinc(); }
// Concrete.
- E operator++(int) const
+ Exact operator++(int) const
{
- E cpy(*this);
+ Exact cpy(*this);
++(*this);
return cpy;
}
@@ -290,13 +290,13 @@
// Output_Iterator
- template <typename E>
- class Output_Iterator : public virtual Trivial_Iterator<E>,
- public automatic::impl<Output_Iterator, E>
+ template <typename Exact>
+ class Output_Iterator : public virtual Trivial_Iterator<Exact>,
+ public automatic::impl<Output_Iterator, Exact>
{
public:
- typedef Trivial_Iterator<E> super;
+ typedef Trivial_Iterator<Exact> super;
stc_using(value_type);
using super::operator*;
@@ -314,9 +314,9 @@
// Forward_Iterator
- template <typename E>
- class Forward_Iterator : public virtual Input_Iterator<E>, public virtual Output_Iterator<E>,
- public automatic::impl<Forward_Iterator, E>
+ template <typename Exact>
+ class Forward_Iterator : public virtual Input_Iterator<Exact>, public virtual Output_Iterator<Exact>,
+ public automatic::impl<Forward_Iterator, Exact>
{
public:
// nothing
@@ -328,19 +328,19 @@
// Bidirectional_Iterator
- template <typename E>
- class Bidirectional_Iterator : public virtual Forward_Iterator<E>,
- public automatic::impl<Bidirectional_Iterator, E>
+ template <typename Exact>
+ class Bidirectional_Iterator : public virtual Forward_Iterator<Exact>,
+ public automatic::impl<Bidirectional_Iterator, Exact>
{
public:
// Method.
- E& operator--() { return this->exact().impl_predec(); }
+ Exact& operator--() { return this->exact().impl_predec(); }
// Concrete.
- E operator--(int) const
+ Exact operator--(int) const
{
- E cpy(*this);
+ Exact cpy(*this);
--(*this);
return cpy;
}
Index: samples/mini-std/cpp2/mini-std.cc
Index: samples/mini-std/cpp2/Makefile.am
--- samples/mini-std/cpp2/Makefile.am (revision 1019)
+++ samples/mini-std/cpp2/Makefile.am (working copy)
@@ -1,7 +1,18 @@
-CPPFLAGS = -I../../../../olena/oln -I../../../../metalic
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
-.PHONY: all
+AM_CPPFLAGS = -I$(top_srcdir)/static -I$(top_srcdir)/metalic
-all: mini-std
+# FIXME: Add
+#
+# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
+#
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
+TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
-mini-std: mini-std.cc
\ No newline at end of file
+
+check_PROGRAMS = mini-std
+mini_std_SOURCES = mini-std.cc
+
+TESTS = $(check_PROGRAMS)
Index: samples/mini-std/Makefile.am
--- samples/mini-std/Makefile.am (revision 0)
+++ samples/mini-std/Makefile.am (revision 0)
@@ -0,0 +1,5 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+SUBDIRS = cpp cpp2
+
+EXTRA_DIST = README design.hh
Index: samples/mini-std/README
--- samples/mini-std/README (revision 1031)
+++ samples/mini-std/README (working copy)
@@ -5,6 +5,8 @@
cd cpp
g++ -I../../.. -I../../../../metalic -Wall -ansi -pedantic main.cc
+or just use `make'
+
* contents
** utility files
Index: samples/Makefile.am
--- samples/Makefile.am (revision 1031)
+++ samples/Makefile.am (working copy)
@@ -1,3 +1,3 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
-SUBDIRS = mini-oln
+SUBDIRS = mini-std mini-oln
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Some renaming and add phantom border routines.
* mln/pw: New directory.
* mln/fun/var.hh: Rename as...
* mln/pw/var.hh: ...this.
* mln/fun/val.hh: Rename as...
* mln/pw/cst.hh: ...this.
* mln/fun/pw_value.hh: Renameas ...
* mln/pw/value.hh: ...this.
* mln/core/concept/image.hh: .
* mln/core/concept/iterator.hh: .
* tests/erosion.cc,
* tests/pw_value.cc,
* TODO: Update.
* mln/convert/to_window.hh: Fix doc.
* mln/border/resize.hh: New.
* mln/border/fill.hh: New.
* mln/border/all.hh: New.
* mln/border/duplicate.hh: New.
* mln/border/mirror.hh: New.
TODO | 15 -------
mln/border/all.hh | 54 ++++++++++++++++++++++++++++
mln/border/duplicate.hh | 75 +++++++++++++++++++++++++++++++++++++++
mln/border/fill.hh | 76 ++++++++++++++++++++++++++++++++++++++++
mln/border/mirror.hh | 75 +++++++++++++++++++++++++++++++++++++++
mln/border/resize.hh | 81 +++++++++++++++++++++++++++++++++++++++++++
mln/convert/to_window.hh | 2 -
mln/core/concept/image.hh | 4 ++
mln/core/concept/iterator.hh | 6 +++
mln/pw/cst.hh | 41 ++++++++++++---------
mln/pw/value.hh | 57 ++++++++++++------------------
mln/pw/var.hh | 28 +++++++-------
tests/erosion.cc | 10 ++---
tests/pw_value.cc | 6 +--
14 files changed, 442 insertions(+), 88 deletions(-)
Index: tests/erosion.cc
--- tests/erosion.cc (revision 1030)
+++ tests/erosion.cc (working copy)
@@ -40,8 +40,8 @@
#include <mln/level/fill.hh>
#include <mln/morpho/erosion.hh>
-#include <mln/fun/pw_value.hh>
-#include <mln/fun/val.hh>
+#include <mln/pw/value.hh>
+#include <mln/pw/cst.hh>
#include <mln/fun/ops.hh>
@@ -61,18 +61,16 @@
morpho::erosion(lena, rec, out);
io::save_pgm(out, "out.pgm");
- /*
{
image2d_b<bool> bin(lena.domain()), out(lena.domain());
- level::fill(bin, pw_value(1) > val(127));
+ level::fill(bin, pw::value(lena) > pw::cst(127));
morpho::erosion(bin, rec, out);
image2d_b<int_u8> test(lena.domain());
- image2d_b<int_u8>::piter p(lena.domain());
+ image2d_b<int_u8>::fwd_piter p(lena.domain());
for_all(p)
test(p) = out(p) ? 255 : 0;
io::save_pgm(test, "test.pgm");
}
- */
}
Index: tests/pw_value.cc
--- tests/pw_value.cc (revision 1030)
+++ tests/pw_value.cc (working copy)
@@ -31,9 +31,9 @@
*/
#include <mln/core/image2d_b.hh>
-#include <mln/fun/pw_value.hh>
#include <mln/fun/ops.hh>
-#include <mln/fun/val.hh>
+#include <mln/pw/value.hh>
+#include <mln/pw/cst.hh>
int main()
@@ -44,5 +44,5 @@
point2d p = make::point2d(1, 1);
ima(p) = 51;
- std::cout << (pw_value(ima) = val(51))(p) << std::endl;
+ mln_assertion( (pw::value(ima) = pw::cst(51))(p) = true );
}
Index: TODO
--- TODO (revision 1030)
+++ TODO (working copy)
@@ -31,12 +31,12 @@
* renaming
mlc into metal
-point-wise material: pw::value_of, pw::constant, and pw::variable
* clean-up
accu::histo and median: remove inheritance
+select_function in fun::internal::selector_p2? etc.
* processing routines
@@ -48,16 +48,3 @@
border::* and no-op versions if not fast image
arith::inplace_plus et al.
linear:: for convolutions
-
-
-svn mv genpoint.hh generalized_point.hh
-svn mv genpixel.hh generalized_pixel.hh
-svn mv psite.hh point_site.hh
-svn mv viter.hh value_iterator.hh
-svn mv piter.hh point_iterator.hh
-
-
-svn mv doc/genpoint.hh doc/generalized_point.hh
-svn mv doc/genpixel.hh doc/generalized_pixel.hh
-svn mv doc/viter.hh doc/value_iterator.hh
-svn mv doc/piter.hh doc/point_iterator.hh
Index: mln/convert/to_window.hh
--- mln/convert/to_window.hh (revision 1030)
+++ mln/convert/to_window.hh (working copy)
@@ -30,7 +30,7 @@
/*! \file mln/convert/to_window.hh
*
- * \brief Convertions to mln::Image.
+ * \brief Convertions to mln::Window.
*/
# include <mln/core/concept/neighborhood.hh>
Index: mln/pw/var.hh
--- mln/pw/var.hh (revision 0)
+++ mln/pw/var.hh (working copy)
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_FUN_VAR_HH
-# define MLN_FUN_VAR_HH
+#ifndef MLN_PW_VAR_HH
+# define MLN_PW_VAR_HH
-/*! \file mln/fun/var.hh
+/*! \file mln/pw/var.hh
*
* \brief FIXME.
*/
@@ -41,31 +41,31 @@
// FIXME: Doc!
- namespace fun
+ namespace pw
{
template <typename V>
struct var_ : public Function_p2v< var_<V> >
{
typedef V result;
+
var_(const V& v);
+
template <typename P>
const V& operator()(const P&) const;
+
private:
const V& v_;
};
- } // end of namespace mln::fun
-
template <typename V>
- fun::var_<V> var(const V& v);
+ var_<V> var(const V& v);
# ifndef MLN_INCLUDE_ONLY
- namespace fun
- {
+ // pw::var_<V>
template <typename V>
var_<V>::var_(const V& v)
@@ -81,18 +81,20 @@
return v_;
}
- } // end of namespace mln::fun
+ // pw::var(v)
template <typename V>
- fun::var_<V> var(const V& v)
+ var_<V> var(const V& v)
{
- fun::var_<V> tmp(v);
+ var_<V> tmp(v);
return tmp;
}
# endif // ! MLN_INCLUDE_ONLY
+ } // end of namespace mln::pw
+
} // end of namespace mln
-#endif // ! MLN_FUN_VAR_HH
+#endif // ! MLN_PW_VAR_HH
Index: mln/pw/cst.hh
--- mln/pw/cst.hh (revision 0)
+++ mln/pw/cst.hh (working copy)
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_FUN_VAL_HH
-# define MLN_FUN_VAL_HH
+#ifndef MLN_PW_CST_HH
+# define MLN_PW_CST_HH
-/*! \file mln/fun/val.hh
+/*! \file mln/pw/cst.hh
*
* \brief FIXME.
*/
@@ -39,35 +39,38 @@
namespace mln
{
- // FIXME: Doc!
-
- namespace fun
+ namespace pw
{
+ // FIXME: Doc!
+
template <typename T>
- struct val_ : public Function_p2v< val_<T> >
+ struct cst_ : public Function_p2v< cst_<T> >
{
typedef T result;
- val_(T t);
+
+ cst_(T t);
+
template <typename P>
T operator()(const P&) const;
+
private:
T t_;
};
- } // end of namespace mln::fun
+
+ // FIXME: Doc!
template <typename T>
- fun::val_<T> val(T t);
+ cst_<T> cst(T t);
# ifndef MLN_INCLUDE_ONLY
- namespace fun
- {
+ // pw::cst_<T>
template <typename T>
- val_<T>::val_(T t)
+ cst_<T>::cst_(T t)
: t_(t)
{
}
@@ -75,23 +78,25 @@
template <typename T>
template <typename P>
T
- val_<T>::operator()(const P&) const
+ cst_<T>::operator()(const P&) const
{
return t_;
}
- } // end of namespace mln::fun
+ // pw::cst(t)
template <typename T>
- fun::val_<T> val(T t)
+ cst_<T> cst(T t)
{
- fun::val_<T> tmp(t);
+ cst_<T> tmp(t);
return tmp;
}
# endif // ! MLN_INCLUDE_ONLY
+ } // end of namespace mln::pw
+
} // end of namespace mln
-#endif // ! MLN_FUN_VAL_HH
+#endif // ! MLN_PW_CST_HH
Index: mln/pw/value.hh
--- mln/pw/value.hh (revision 0)
+++ mln/pw/value.hh (working copy)
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_FUN_PW_VALUE_HH
-# define MLN_FUN_PW_VALUE_HH
+#ifndef MLN_PW_VALUE_HH
+# define MLN_PW_VALUE_HH
-/*! \file mln/fun/pw_value.hh
+/*! \file mln/fun/pw/value.hh
*
* \brief FIXME.
*/
@@ -42,19 +42,7 @@
namespace mln
{
- // Fwd decl.
- namespace fun { template <typename I> struct pw_value; }
-
-
-
- // FIXME: Doc!
-
- template <typename I>
- fun::pw_value<I> pw_value(const Image<I>& ima);
-
-
-
- namespace fun
+ namespace pw
{
// FIXME: Move!
@@ -70,16 +58,16 @@
struct select_function_< value::binary_kind, E > : Function_p2b<E>
{};
- } // end of namespace mln::fun::internal
+ } // end of namespace mln::pw::internal
// FIXME: Doc!
template <typename I>
- struct pw_value : public internal::select_function_< mln_value_kind(I), pw_value<I> >
+ struct value_ : public internal::select_function_< mln_value_kind(I), value_<I> >
{
typedef mln_value(I) result;
- pw_value(const I& ima);
+ value_(const I& ima);
mln_rvalue(I) operator()(const mln_psite(I)& p) const;
protected:
const I& ima_;
@@ -87,44 +75,47 @@
+ // FIXME: Doc!
+
+ template <typename I>
+ value_<I> value(const Image<I>& ima);
+
+
+
# ifndef MLN_INCLUDE_ONLY
- // fun::pw_value<I>
+ // pw::value_<I>
template <typename I>
- pw_value<I>::pw_value(const I& ima)
+ value_<I>::value_(const I& ima)
: ima_(ima)
{
}
template <typename I>
mln_rvalue(I)
- pw_value<I>::operator()(const mln_psite(I)& p) const
+ value_<I>::operator()(const mln_psite(I)& p) const
{
mln_precondition(ima_.owns_(p));
return ima_(p);
}
-# endif // ! MLN_INCLUDE_ONLY
-
- } // end of namespace mln::fun
-
-# ifndef MLN_INCLUDE_ONLY
-
- // pw_value
+ // pw::value(ima)
template <typename I>
- fun::pw_value<I>
- pw_value(const Image<I>& ima)
+ value_<I>
+ value(const Image<I>& ima)
{
mln_precondition(exact(ima).has_data());
- fun::pw_value<I> tmp(exact(ima));
+ value_<I> tmp(exact(ima));
return tmp;
}
# endif // ! MLN_INCLUDE_ONLY
+ } // end of namespace mln::pw
+
} // end of namespace mln
-#endif // ! MLN_FUN_PW_VALUE_HH
+#endif // ! MLN_PW_VALUE_HH
Index: mln/core/concept/image.hh
--- mln/core/concept/image.hh (revision 1030)
+++ mln/core/concept/image.hh (working copy)
@@ -134,6 +134,10 @@
m6 = 0;
lvalue (E::*m7)(const psite& p) = & E::operator();
m7 = 0;
+
+ typedef mln_vset(E) vset;
+ const vset& (E::*m8)() const = & E::values;
+ m8 = 0;
}
# endif // ! MLN_INCLUDE_ONLY
Index: mln/core/concept/iterator.hh
--- mln/core/concept/iterator.hh (revision 1030)
+++ mln/core/concept/iterator.hh (working copy)
@@ -40,6 +40,12 @@
# define for_all(x) for(x.start(); x.is_valid(); x.next())
+/*! \brief Loop to browse all the elements targetted by the couples of
+ * iterators \p x1 and \p x2.
+ */
+# define for_all_2(x1, x2) for(x1.start(),x2.start(); x1.is_valid(); x1.next(),x2.next())
+
+
/*! \brief Loop to browse all the remaining elements targetted by the
* iterator \p x.
*/
Index: mln/border/resize.hh
--- mln/border/resize.hh (revision 0)
+++ mln/border/resize.hh (revision 0)
@@ -0,0 +1,81 @@
+// 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_BORDER_RESIZE_HH
+# define MLN_BORDER_RESIZE_HH
+
+/*! \file mln/border/resize.hh
+ *
+ * \brief FIXME.
+ */
+
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace border
+ {
+
+ /*! Resize the virtual (outer) border of image \p ima to at least
+ * \p thickness.
+ *
+ * \param[in,out] ima The image whose border is to be resized.
+ * \param[in] thickness The expected minimum border size.
+ *
+ * \pre \p ima has to be initialized.
+ *
+ * \warning If the image border already has a size greater than \p
+ * thickness, this routine is a no-op.
+ *
+ * \todo Implement it.
+ */
+ template <typename I>
+ void resize(const Fast_Image<I>& ima, unsigned thickness);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ void resize(const Fast_Image<I>& ima_, unsigned thickness)
+ {
+ const I& ima = exact(ima_);
+ mln_precondition(ima_.has_data());
+ if (ima.border() >= thickness)
+ return;
+ mln_invariant(0); // FIXME: NYI
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::border
+
+} // end of namespace mln
+
+
+#endif // ! MLN_BORDER_RESIZE_HH
Index: mln/border/fill.hh
--- mln/border/fill.hh (revision 0)
+++ mln/border/fill.hh (revision 0)
@@ -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.
+
+#ifndef MLN_BORDER_FILL_HH
+# define MLN_BORDER_FILL_HH
+
+/*! \file mln/border/fill.hh
+ *
+ * \brief FIXME.
+ */
+
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace border
+ {
+
+ /*! Fill the virtual (outer) border of image \p ima with the
+ * single value \p v.
+ *
+ * \param[in,out] ima The image whose border is to be filled.
+ * \param[in] v The value to assign to all border pixels.
+ *
+ * \pre \p ima has to be initialized.
+ *
+ * \todo Implement it + optimize with memset if possible.
+ */
+ template <typename I>
+ void fill(const Fast_Image<I>& ima, const mln_value(I)& v);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ void fill(const Fast_Image<I>& ima_, const mln_value(I)& v)
+ {
+ const I& ima = exact(ima_);
+ mln_precondition(ima_.has_data());
+ mln_invariant(0); // FIXME: NYI
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::border
+
+} // end of namespace mln
+
+
+#endif // ! MLN_BORDER_FILL_HH
Index: mln/border/all.hh
--- mln/border/all.hh (revision 0)
+++ mln/border/all.hh (revision 0)
@@ -0,0 +1,54 @@
+// 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_BORDER_ALL_HH
+# define MLN_BORDER_ALL_HH
+
+/*! \file mln/border/all.hh
+ *
+ * \brief File that includes all border-related routines.
+ */
+
+
+namespace mln
+{
+
+ /*! Namespace of routines related to image virtual (outer) border.
+ */
+ namespace border {}
+
+}
+
+
+# include <mln/border/duplicate.hh>
+# include <mln/border/fill.hh>
+# include <mln/border/mirror.hh>
+# include <mln/border/resize.hh>
+# include <mln/border/thickness.hh>
+
+
+#endif // ! MLN_BORDER_ALL_HH
Index: mln/border/duplicate.hh
--- mln/border/duplicate.hh (revision 0)
+++ mln/border/duplicate.hh (revision 0)
@@ -0,0 +1,75 @@
+// 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_BORDER_DUPLICATE_HH
+# define MLN_BORDER_DUPLICATE_HH
+
+/*! \file mln/border/duplicate.hh
+ *
+ * \brief FIXME.
+ */
+
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace border
+ {
+
+ /*! Assign the virtual (outer) border of image \p ima with the
+ * dupplicate of the inner border of this image.
+ *
+ * \param[in,out] ima The image whose border is to be duplicated.
+ *
+ * \pre \p ima has to be initialized.
+ *
+ * \todo Implement it + optimize with memcpy if possible.
+ */
+ template <typename I>
+ void duplicate(const Fast_Image<I>& ima);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ void duplicate(const Fast_Image<I>& ima_)
+ {
+ const I& ima = exact(ima_);
+ mln_precondition(ima_.has_data());
+ mln_invariant(0); // FIXME: NYI
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::border
+
+} // end of namespace mln
+
+
+#endif // ! MLN_BORDER_DUPLICATE_HH
Index: mln/border/mirror.hh
--- mln/border/mirror.hh (revision 0)
+++ mln/border/mirror.hh (revision 0)
@@ -0,0 +1,75 @@
+// 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_BORDER_MIRROR_HH
+# define MLN_BORDER_MIRROR_HH
+
+/*! \file mln/border/mirror.hh
+ *
+ * \brief FIXME.
+ */
+
+# include <mln/core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace border
+ {
+
+ /*! Mirror the virtual (outer) border of image \p ima with the
+ * (inner) level contents of this image.
+ *
+ * \param[in,out] ima The image whose border is to be mirrored.
+ *
+ * \pre \p ima has to be initialized.
+ *
+ * \todo Implement it + optimize with memset if possible.
+ */
+ template <typename I>
+ void mirror(const Fast_Image<I>& ima);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ void mirror(const Fast_Image<I>& ima_)
+ {
+ const I& ima = exact(ima_);
+ mln_precondition(ima_.has_data());
+ mln_invariant(0); // FIXME: NYI
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::border
+
+} // end of namespace mln
+
+
+#endif // ! MLN_BORDER_MIRROR_HH
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Adjust tests to the new interface of Static.
* tests/super.cc, tests/vtypes-and-exact.cc:
No longer use stc_scoop_equipment_for_namespace.
Include stc/scoop.hxx instead.
Remove the `_type' suffix from all virtual types.
s/set_super_type/super_trait_/.
* tests/vtypes.cc: Likewise.
my::set_super_type<Z>: Remove.
vtypes<Z>::delegatee: New virtual type.
super.cc | 13 ++----
vtypes-and-exact.cc | 76 ++++++++++++------------------------
vtypes.cc | 108 ++++++++++++++++++++++++++--------------------------
3 files changed, 85 insertions(+), 112 deletions(-)
Index: tests/vtypes-and-exact.cc
--- tests/vtypes-and-exact.cc (revision 1029)
+++ tests/vtypes-and-exact.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 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
@@ -40,28 +40,33 @@
// Helper macros.
#define my_type_of_(FromType, Alias) \
- my::find_vtype<FromType, my::typedef_:: Alias##_type>::ret
+ my::find_vtype< FromType, my::typedef_:: Alias >::ret
#define my_type_of(FromType, Alias) \
typename my_type_of_(FromType, Alias)
-// Namespace equipment.
-stc_scoop_equipment_for_namespace(my);
namespace my
{
+ /*----------------------.
+ | Namespace equipment. |
+ `----------------------*/
+
+#include <stc/scoop.hxx>
+
+
/*-----------.
| Typedefs. |
`-----------*/
- mlc_decl_typedef(foo_type);
- mlc_decl_typedef(bar_type);
- mlc_decl_typedef(baz_type);
- mlc_decl_typedef(quux_type);
- mlc_decl_typedef(yin_type);
- mlc_decl_typedef(zorg_type);
+ mlc_decl_typedef(foo);
+ mlc_decl_typedef(bar);
+ mlc_decl_typedef(baz);
+ mlc_decl_typedef(quux);
+ mlc_decl_typedef(yin);
+ mlc_decl_typedef(zorg);
/*----------------------------------------.
@@ -77,12 +82,12 @@
struct vtypes< A<Exact> >
{
// A native type.
- typedef int foo_type;
+ typedef int foo;
// A Metalic value, used here to ensure that mlc::abstract::values
// are accepted as virtual types, as well as any other type).
- typedef mlc::int_<42> bar_type;
+ typedef mlc::int_<42> bar;
// An undefined type.
- typedef mlc::undefined baz_type;
+ typedef mlc::undefined baz;
};
template <typename Exact>
@@ -92,23 +97,6 @@
typedef Exact exact_t;
// Aliases.
-
- // META-FIXME: Update comment (stc/scoop.hh as changed since).
-
- /* FIXME: Work around a bug that affects both g++ 4.1 and
- gcc-snapshot (4.2) from Debian. The versions of the compiler
- used at the moment this text was written were:
-
- g++ 4.1 : g++ (GCC) 4.1.2 20060920 (prerelease) (Debian 4.1.1-14)
- gcc-snapshot : g++ (GCC) 4.2.0 20060922 (experimental)
-
-
- Problem description:
-
- Using my_type_of (i.e., using stc_to_exact) breaks the
- assertions ``Ensure stc::is_any_ works properly.'' below (in
- main). Using my_direct_type_of (on the exact type) solves
- this! */
typedef my_type_of(exact_t, foo) foo_t;
typedef my_type_of(exact_t, bar) bar_t;
typedef my_type_of(exact_t, baz) baz_t;
@@ -125,7 +113,7 @@
// Super type.
template <typename Exact>
- struct set_super_type< B<Exact> >
+ struct super_trait_< B<Exact> >
{
typedef A<Exact> ret;
};
@@ -137,16 +125,16 @@
// (foo is left untouched.)
// A type redefined here.
- typedef double bar_type;
+ typedef double bar;
// A type defined here (but declared abstract in the super class).
- typedef char baz_type;
+ typedef char baz;
// A type defined only here (and not in the super class).
- typedef long quux_type;
+ typedef long quux;
};
/// An extended type associated to my::B.
template <typename Exact>
- struct single_vtype< B<Exact>, typedef_::yin_type >
+ struct single_vtype< B<Exact>, typedef_::yin >
{
typedef unsigned long ret;
};
@@ -158,13 +146,6 @@
typedef Exact exact_t;
// Aliases.
-
- // META-FIXME: Update comment (stc/scoop.hh as changed since).
-
- /* FIXME: Same as above; using my_type_of (i.e., using
- stc_to_exact) breaks the assertions ``Ensure stc::is_any_ works
- properly.'' below (in main). Using my_direct_type_of (on the
- exact type) solves this! */
typedef my_type_of(exact_t, foo) foo_t;
typedef my_type_of(exact_t, bar) bar_t;
typedef my_type_of(exact_t, baz) baz_t;
@@ -182,7 +163,7 @@
// Super type.
template <>
- struct set_super_type<C>
+ struct super_trait_<C>
{
typedef B<C> ret;
};
@@ -192,7 +173,7 @@
struct vtypes<C>
{
// A type defined only here (and not in the super class).
- typedef double zorg_type;
+ typedef double zorg;
};
struct C : public B<C>
@@ -201,13 +182,6 @@
typedef self_t exact_t;
// Aliases.
-
- // META-FIXME: Update comment (stc/scoop.hh as changed since).
-
- /* FIXME: Same as above; using my_type_of_ (i.e., using
- stc_to_exact) breaks the assertions ``Ensure stc::is_any_ works
- properly.'' below (in main). Using my_direct_type_of_ (on the
- exact type) solves this! */
typedef my_type_of_(exact_t, foo) foo_t;
typedef my_type_of_(exact_t, quux) quux_t;
typedef my_type_of_(exact_t, zorg) zorg_t;
Index: tests/super.cc
--- tests/super.cc (revision 1029)
+++ tests/super.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 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
@@ -33,13 +33,12 @@
#include <stc/scoop.hh>
-// Namespace equipment.
-stc_scoop_equipment_for_namespace(my);
-
-
namespace my
{
+// Namespace equipment.
+# include <stc/scoop.hxx>
+
/*----.
| A. |
`----*/
@@ -58,7 +57,7 @@
// Set super type.
template<>
- struct set_super_type<B>
+ struct super_trait_<B>
{
typedef A ret;
};
@@ -84,7 +83,7 @@
template<>
struct vtypes<C>
{
- typedef B delegatee_type;
+ typedef B delegatee;
};
struct C // no inheritance
Index: tests/vtypes.cc
--- tests/vtypes.cc (revision 1029)
+++ tests/vtypes.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 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
@@ -37,28 +37,33 @@
// Helper macros.
#define my_type_of_(FromType, Alias) \
- my::find_vtype<FromType, my::typedef_:: Alias##_type>::ret
+ my::find_vtype< FromType, my::typedef_:: Alias >::ret
#define my_type_of(FromType, Alias) \
typename my_type_of_(FromType, Alias)
-// Namespace equipment.
-stc_scoop_equipment_for_namespace(my);
namespace my
{
+ /*----------------------.
+ | Namespace equipment. |
+ `----------------------*/
+
+#include <stc/scoop.hxx>
+
+
/*-----------.
| Typedefs. |
`-----------*/
- mlc_decl_typedef(foo_type);
- mlc_decl_typedef(bar_type);
- mlc_decl_typedef(baz_type);
- mlc_decl_typedef(quux_type);
- mlc_decl_typedef(yin_type);
- mlc_decl_typedef(zorg_type);
+ mlc_decl_typedef(foo);
+ mlc_decl_typedef(bar);
+ mlc_decl_typedef(baz);
+ mlc_decl_typedef(quux);
+ mlc_decl_typedef(yin);
+ mlc_decl_typedef(zorg);
/*----.
@@ -73,21 +78,21 @@
struct vtypes<my::A>
{
// A native type.
- typedef int foo_type;
+ typedef int foo;
// A Metalic value, used here is to ensure that
// mlc::abstract::values are accepted as virtual types, as well as
// any other type).
- typedef mlc::int_<42> bar_type;
+ typedef mlc::int_<42> bar;
// An undefined type.
- typedef mlc::undefined baz_type;
+ typedef mlc::undefined baz;
};
struct A
{
// Aliases.
- typedef my_type_of_(A, foo) foo_type;
- typedef my_type_of_(A, bar) bar_type;
- typedef my_type_of_(A, baz) baz_type;
+ typedef my_type_of_(A, foo) foo;
+ typedef my_type_of_(A, bar) bar;
+ typedef my_type_of_(A, baz) baz;
};
@@ -100,7 +105,7 @@
// Set super type.
template<>
- struct set_super_type<B>
+ struct super_trait_<B>
{
typedef A ret;
};
@@ -112,16 +117,16 @@
// (foo is left untouched.)
// A type redefined here.
- typedef double bar_type;
+ typedef double bar;
// A type defined here (but declared abstract in the super class).
- typedef char baz_type;
+ typedef char baz;
// A type defined only here (and not in the super class).
- typedef long quux_type;
+ typedef long quux;
};
/// An extended type associated to my::B.
template <>
- struct single_vtype<B, typedef_::yin_type>
+ struct single_vtype<B, typedef_::yin>
{
typedef unsigned long ret;
};
@@ -129,11 +134,11 @@
struct B : public A
{
// Aliases.
- typedef my_type_of_(B, foo) foo_type;
- typedef my_type_of_(B, bar) bar_type;
- typedef my_type_of_(B, baz) baz_type;
- typedef my_type_of_(B, quux) quux_type;
- typedef my_type_of_(B, yin) yin_type;
+ typedef my_type_of_(B, foo) foo;
+ typedef my_type_of_(B, bar) bar;
+ typedef my_type_of_(B, baz) baz;
+ typedef my_type_of_(B, quux) quux;
+ typedef my_type_of_(B, yin) yin;
};
@@ -145,33 +150,28 @@
struct Z;
// Z doesn't derive from B, but we want its vtypes to ``inherit''
- // from B's vtypes (see the specialization
- // types<category::my_cat, Z>).
-
- /// Link to B (``pseudo'' inheritance).
- template<>
- struct set_super_type<Z>
- {
- typedef B ret;
- };
+ // from B's vtypes.
/// Types associated to my::Z.
template <>
struct vtypes<Z>
{
+ /// Delegation to B (used to be called ``pseudo'' inheritance).
+ typedef B delegatee;
+
// A type defined only here (and not in the super class).
- typedef double zorg_type;
+ typedef double zorg;
};
struct Z // no inheritance
{
// Aliases.
- typedef my_type_of_(Z, foo) foo_type;
- typedef my_type_of_(Z, bar) bar_type;
- typedef my_type_of_(Z, baz) baz_type;
- typedef my_type_of_(Z, quux) quux_type;
- typedef my_type_of_(Z, yin) yin_type;
- typedef my_type_of_(Z, zorg) zorg_type;
+ typedef my_type_of_(Z, foo) foo;
+ typedef my_type_of_(Z, bar) bar;
+ typedef my_type_of_(Z, baz) baz;
+ typedef my_type_of_(Z, quux) quux;
+ typedef my_type_of_(Z, yin) yin;
+ typedef my_type_of_(Z, zorg) zorg;
};
} // end of namespace my
@@ -181,21 +181,21 @@
main()
{
// Check types associated to A.
- mlc::assert_<mlc_eq(my::A::foo_type, int)>::check();
- mlc::assert_<mlc_eq(my::A::bar_type, mlc::int_<42>)>::check();
+ mlc::assert_<mlc_eq(my::A::foo, int)>::check();
+ mlc::assert_<mlc_eq(my::A::bar, mlc::int_<42>)>::check();
// Check types associated to B.
- mlc::assert_<mlc_eq(my::B::baz_type, char)>::check();
- mlc::assert_<mlc_eq(my::B::quux_type, long)>::check();
- mlc::assert_<mlc_eq(my::B::yin_type, unsigned long)>::check();
+ mlc::assert_<mlc_eq(my::B::baz, char)>::check();
+ mlc::assert_<mlc_eq(my::B::quux, long)>::check();
+ mlc::assert_<mlc_eq(my::B::yin, unsigned long)>::check();
- mlc::assert_<mlc_neq(my::B::bar_type, my::A::bar_type)>::check();
+ mlc::assert_<mlc_neq(my::B::bar, my::A::bar)>::check();
// Check types associated to Z.
- mlc::assert_<mlc_eq(my::Z::foo_type, int)>::check();
- mlc::assert_<mlc_eq(my::Z::bar_type, double)>::check();
- mlc::assert_<mlc_eq(my::Z::baz_type, char)>::check();
- mlc::assert_<mlc_eq(my::Z::quux_type, long)>::check();
- mlc::assert_<mlc_eq(my::Z::yin_type, unsigned long)>::check();
- mlc::assert_<mlc_eq(my::Z::zorg_type, double)>::check();
+ mlc::assert_<mlc_eq(my::Z::foo, int)>::check();
+ mlc::assert_<mlc_eq(my::Z::bar, double)>::check();
+ mlc::assert_<mlc_eq(my::Z::baz, char)>::check();
+ mlc::assert_<mlc_eq(my::Z::quux, long)>::check();
+ mlc::assert_<mlc_eq(my::Z::yin, unsigned long)>::check();
+ mlc::assert_<mlc_eq(my::Z::zorg, double)>::check();
}
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Clean up stc/scoop.hxx a bit.
* stc/scoop.hxx: Add a copyright header.
Typos.
Re-indent some parts.
(helper_check): Fix documentation.
Actually use check_final_stm and check_delegatee_inherited as
described in the documentation.
(helper_find): Add some documentation.
scoop.hxx | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 53 insertions(+), 12 deletions(-)
Index: static/stc/scoop.hxx
--- static/stc/scoop.hxx (revision 1027)
+++ static/stc/scoop.hxx (working copy)
@@ -1,3 +1,29 @@
+// Copyright (C) 2005, 2006, 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 oln/stc/scoop.hxx
\brief To be included within a namespace to import SCOOP 2 equipment. */
@@ -102,7 +128,8 @@
/*
- FIXME: Inactivate since dummy code (many class are not Abstractions but abstraction<Exact>).
+ FIXME: Inactivate since dummy code (many class are not Abstractions
+ but abstraction<Exact>).
template <template <class> class abstraction, typename Exact>
struct super_trait_< abstraction<Exact> >
@@ -241,7 +268,7 @@
* Returns the statement for class 'from' corresponding to 'target'.
* This statement is either defined in 'vtypes' or in 'single_vtype'.
*
- * This routine is local; it does not recourse on superior classes.
+ * This routine is local; it does not recur on superior classes.
*
*/
@@ -308,7 +335,8 @@
};
template <typename orig, typename target, typename stm>
- struct check_no_final_inherited <orig, /* if curr == */ mlc::none, target, stm>
+ struct check_no_final_inherited <orig, /* if curr == */ mlc::none,
+ target, stm>
{
};
@@ -342,7 +370,7 @@
* check_delegatee_inherited
*/
- template <typename curr, typename target>
+ template <typename curr>
struct check_delegatee_inherited
: mlc::assert_< stc::is_found< typename first_stm<curr,
typedef_::delegatee>::ret::second_elt >,
@@ -422,7 +450,7 @@
* super = super(curr);
*
* if (stm == stc::abstract) {
- * check_no_stm_inherited(curr, super, target);
+ * check_no_stm_inherited((curr, abstract), super, target);
* return check(super, target);
* }
* if (stm == stc::final<T>) {
@@ -463,10 +491,8 @@
: check_no_final_inherited< mlc::pair_<curr, stc::final<T> >,
stc_super(curr),
target >
+ , check_final_stm< curr, target, T >
{
- /* FIXME:
- check_final_stm(T);
- */
typedef typename check<stc_super(curr), target>::ret ret;
};
@@ -476,10 +502,8 @@
: check_no_final_inherited< mlc::pair_<curr, stc::not_delegated>,
stc_super(curr),
target >
+ , check_delegatee_inherited< curr >
{
- /* FIXME:
- check_delegatee_inherited(curr);
- */
typedef typename check<stc_super(curr), target>::ret ret;
};
@@ -662,6 +686,7 @@
*
* delegator_find(from, target)
* {
+ * // FIXME: This precondition is not actually enforced in the algorithm.
* precondition(target != delegatee);
* delegatee = superior_find(from, delegatee);
* if (delegatee == mlc::not_found)
@@ -696,8 +721,23 @@
/*
* helper_find(from, target, where, res)
*
+ * FIXME: ...
*
- *
+ * helper_find(from, target, where, res)
+ * {
+ * if (res == mlc::not_found)
+ * return delegator_find(from, target)
+ * else if (res = stc::abstract)
+ * {
+ * res_d = delegator_find(source, target)
+ * assert(res_d != mlc::not_found,
+ * "<target> declared <where> but not defined at <from>")
+ * }
+ * else if (res = stc::not_delegated)
+ * return superior_find(from, target)
+ * else
+ * return res
+ * }
*/
template <typename from, typename target, typename where>
@@ -712,6 +752,7 @@
/* if res == */ stc::abstract >
{
typedef typename delegator_find<from, target>::ret res_d;
+ // FIXME: Might be shorten using mlc::assert_and_return_.
struct check_
: mlc::assert_< stc::is_found<res_d>,
ERROR::vtype_declared_but_not_defined
1
1
Index: ChangeLog
===================================================================
--- ChangeLog (revision 1028)
+++ ChangeLog (revision 1029)
@@ -1,15 +1,3 @@
-2007-07-23 Roland Levillain <roland(a)lrde.epita.fr>
-
- Clean up stc/scoop.hxx a bit.
-
- * stc/scoop.hxx: Add a copyright header.
- Typos.
- Re-indent some parts.
- (helper_check): Fix documentation.
- Actually use check_final_stm and check_delegatee_inherited as
- described in the documentation.
- (helper_find): Add some documentation.
-
2007-06-29 Roland Levillain <roland(a)lrde.epita.fr>
Add support for Doxygen in Milena.
Index: static/ChangeLog
===================================================================
--- static/ChangeLog (revision 1028)
+++ static/ChangeLog (revision 1029)
@@ -1,3 +1,15 @@
+2007-07-23 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Clean up stc/scoop.hxx a bit.
+
+ * stc/scoop.hxx: Add a copyright header.
+ Typos.
+ Re-indent some parts.
+ (helper_check): Fix documentation.
+ Actually use check_final_stm and check_delegatee_inherited as
+ described in the documentation.
+ (helper_find): Add some documentation.
+
2007-07-17 Roland Levillain <roland(a)lrde.epita.fr>
Update stc/scoop.{hh,hxx} with the latest version from Olena.
1
0
23 Jul '07
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Renaming some concepts with more explicit and longer names.
* mln/core/concept/piter.hh,
* mln/core/concept/genpoint.hh,
* mln/core/concept/psite.hh,
* mln/core/concept/viter.hh,
* mln/core/concept/doc/genpoint.hh,
* mln/core/concept/doc/piter.hh,
* mln/core/concept/doc/viter.hh,
* mln/core/concept/doc/genpixel.hh,
* mln/core/concept/genpixel.hh: Rename respectively as...
* mln/core/concept/point_iterator.hh,
* mln/core/concept/generalized_point.hh,
* mln/core/concept/point_site.hh,
* mln/core/concept/value_iterator.hh,
* mln/core/concept/doc/generalized_point.hh,
* mln/core/concept/doc/point_iterator.hh,
* mln/core/concept/doc/value_iterator.hh,
* mln/core/concept/doc/generalized_pixel.hh,
* mln/core/concept/generalized_pixel.hh: ...these.
* mln/convert/to_dpoint.hh,
* mln/geom/pmin_pmax.hh,
* mln/core/dpoints_piter.hh,
* mln/core/psubset.hh,
* mln/core/box.hh,
* mln/core/psubset_piter.hh,
* mln/core/rectangle2d.hh,
* mln/core/box_piter.hh,
* mln/core/window.hh,
* mln/core/dpoints_pixter.hh,
* mln/core/internal/image_adaptor.hh,
* mln/core/internal/image_base.hh,
* mln/core/internal/piter_adaptor.hh,
* mln/core/pixel.hh,
* mln/core/hline2d.hh,
* mln/core/neighb.hh,
* mln/core/concept/value_set.hh,
* mln/core/concept/point.hh,
* mln/core/concept/pixel_iterator.hh,
* mln/core/concept/point_set.hh,
* mln/core/concept/doc/image.hh,
* mln/core/concept/doc/value_set.hh,
* mln/core/concept/doc/pixel_iterator.hh,
* mln/core/concept/doc/point_set.hh,
* mln/core/concept/doc/window.hh,
* mln/core/concept/doc/neighborhood.hh,
* mln/core/vline2d.hh,
* mln/level/approx/median.hh,
* mln/value/lut_vec.hh,
* mln/value/viter.hh,
* mln/value/set.hh: Update.
* TODO: Update.
TODO | 17 +++++++--
mln/convert/to_dpoint.hh | 6 +--
mln/core/box.hh | 6 +--
mln/core/box_piter.hh | 10 ++---
mln/core/concept/doc/generalized_pixel.hh | 12 +++---
mln/core/concept/doc/generalized_point.hh | 10 ++---
mln/core/concept/doc/image.hh | 8 ++--
mln/core/concept/doc/neighborhood.hh | 6 +--
mln/core/concept/doc/pixel_iterator.hh | 2 -
mln/core/concept/doc/point_iterator.hh | 16 ++++----
mln/core/concept/doc/point_set.hh | 6 +--
mln/core/concept/doc/value_iterator.hh | 10 ++---
mln/core/concept/doc/value_set.hh | 4 +-
mln/core/concept/doc/window.hh | 6 +--
mln/core/concept/generalized_pixel.hh | 14 +++----
mln/core/concept/generalized_point.hh | 54 +++++++++++++++---------------
mln/core/concept/pixel_iterator.hh | 4 +-
mln/core/concept/point.hh | 4 +-
mln/core/concept/point_iterator.hh | 16 ++++----
mln/core/concept/point_set.hh | 2 -
mln/core/concept/point_site.hh | 16 ++++----
mln/core/concept/value_iterator.hh | 20 +++++------
mln/core/concept/value_set.hh | 2 -
mln/core/dpoints_piter.hh | 12 +++---
mln/core/dpoints_pixter.hh | 10 ++---
mln/core/hline2d.hh | 4 +-
mln/core/internal/image_adaptor.hh | 2 -
mln/core/internal/image_base.hh | 6 +--
mln/core/internal/piter_adaptor.hh | 6 +--
mln/core/neighb.hh | 4 +-
mln/core/pixel.hh | 4 +-
mln/core/psubset.hh | 6 +--
mln/core/psubset_piter.hh | 2 -
mln/core/rectangle2d.hh | 4 +-
mln/core/vline2d.hh | 4 +-
mln/core/window.hh | 6 +--
mln/geom/pmin_pmax.hh | 4 +-
mln/level/approx/median.hh | 2 -
mln/value/lut_vec.hh | 4 +-
mln/value/set.hh | 4 +-
mln/value/viter.hh | 6 +--
41 files changed, 175 insertions(+), 166 deletions(-)
Index: TODO
--- TODO (revision 1026)
+++ TODO (working copy)
@@ -25,17 +25,13 @@
in Fast_Image: memcpy and memset-like methods (?)
.offset() into GenPixel
-notion of low-quantization
-vset and .values() in Image
built-in op objects -> reverse lhs/rhs
* renaming
-GenPixel, GenPoint, Psite, Piter: longer name (?)
mlc into metal
point-wise material: pw::value_of, pw::constant, and pw::variable
-kind-related: mln_value_kind(I) and mln_kind(V)
* clean-up
@@ -52,3 +48,16 @@
border::* and no-op versions if not fast image
arith::inplace_plus et al.
linear:: for convolutions
+
+
+svn mv genpoint.hh generalized_point.hh
+svn mv genpixel.hh generalized_pixel.hh
+svn mv psite.hh point_site.hh
+svn mv viter.hh value_iterator.hh
+svn mv piter.hh point_iterator.hh
+
+
+svn mv doc/genpoint.hh doc/generalized_point.hh
+svn mv doc/genpixel.hh doc/generalized_pixel.hh
+svn mv doc/viter.hh doc/value_iterator.hh
+svn mv doc/piter.hh doc/point_iterator.hh
Index: mln/convert/to_dpoint.hh
--- mln/convert/to_dpoint.hh (revision 1026)
+++ mln/convert/to_dpoint.hh (working copy)
@@ -33,7 +33,7 @@
* \brief Convertions to mln::Dpoint.
*/
-# include <mln/core/concept/genpoint.hh>
+# include <mln/core/concept/generalized_point.hh>
namespace mln
@@ -44,13 +44,13 @@
/// Convert a generalized point \p p into a delta-point.
template <typename P>
- mln_dpoint(P) to_dpoint(const GenPoint<P>& p);
+ mln_dpoint(P) to_dpoint(const Generalized_Point<P>& p);
# ifndef MLN_INCLUDE_ONLY
template <typename P>
- mln_dpoint(P) to_dpoint(const GenPoint<P>& p_)
+ mln_dpoint(P) to_dpoint(const Generalized_Point<P>& p_)
{
const P& p = internal::force_exact<P>(p_);
mln_dpoint(P) tmp;
Index: mln/geom/pmin_pmax.hh
--- mln/geom/pmin_pmax.hh (revision 1026)
+++ mln/geom/pmin_pmax.hh (working copy)
@@ -48,7 +48,7 @@
/// iterator \p p.
template <typename I>
std::pair<mln_point(I), mln_point(I)>
- pmin_pmax(const Piter<I>& p);
+ pmin_pmax(const Point_Iterator<I>& p);
@@ -56,7 +56,7 @@
template <typename I>
std::pair<mln_point(I), mln_point(I)>
- pmin_pmax(Piter<I>& p_)
+ pmin_pmax(Point_Iterator<I>& p_)
{
I& p = exact(p_);
Index: mln/core/dpoints_piter.hh
--- mln/core/dpoints_piter.hh (revision 1026)
+++ mln/core/dpoints_piter.hh (working copy)
@@ -33,8 +33,8 @@
* \brief Definition of mln::dpoints_fwd_piter and mln::dpoints_bkd_piter.
*/
-# include <mln/core/concept/piter.hh>
-# include <mln/core/concept/genpoint.hh>
+# include <mln/core/concept/point_iterator.hh>
+# include <mln/core/concept/generalized_point.hh>
namespace mln
@@ -46,7 +46,7 @@
* The parameter \c D is the type of delta-points.
*/
template <typename D>
- class dpoints_fwd_piter : public Piter< dpoints_fwd_piter<D> >
+ class dpoints_fwd_piter : public Point_Iterator< dpoints_fwd_piter<D> >
{
public:
@@ -59,7 +59,7 @@
/// Point associated type.
typedef mln_point(D) point;
- /// Psite associated type.
+ /// Point_Site associated type.
typedef point psite;
/// Coordinate associated type.
@@ -72,7 +72,7 @@
*/
template <typename Dps, typename Pref>
dpoints_fwd_piter(const Dps& dps, // FIXME: explicitly set_of_<D>?
- const GenPoint<Pref>& p_ref);
+ const Generalized_Point<Pref>& p_ref);
/// Convertion to point.
operator mln_point(D) () const;
@@ -117,7 +117,7 @@
template <typename D>
template <typename Dps, typename Pref>
dpoints_fwd_piter<D>::dpoints_fwd_piter(const Dps& dps,
- const GenPoint<Pref>& p_ref)
+ const Generalized_Point<Pref>& p_ref)
: dps_(exact(dps).vec()),
p_ref_(* internal::force_exact<Pref>(p_ref).pointer_())
{
Index: mln/core/psubset.hh
--- mln/core/psubset.hh (revision 1026)
+++ mln/core/psubset.hh (working copy)
@@ -67,17 +67,17 @@
template <typename S, typename F>
struct psubset : public Point_Set< psubset<S,F> >
{
- /// Psite associated type.
+ /// Point_Site associated type.
typedef mln_psite(S) psite;
/// Point associated type.
typedef mln_point(S) point;
- /// Forward Piter associated type.
+ /// Forward Point_Iterator associated type.
typedef psubset_fwd_piter_<S,F> fwd_piter;
- /// Backward Piter associated type.
+ /// Backward Point_Iterator associated type.
typedef internal::fixme bkd_piter;
Index: mln/core/box.hh
--- mln/core/box.hh (revision 1026)
+++ mln/core/box.hh (working copy)
@@ -54,7 +54,7 @@
struct box_ : public Box< box_<P> >,
public internal::box_impl_< P::dim, mln_coord(P), box_<P> >
{
- /*! \brief Psite associated type.
+ /*! \brief Point_Site associated type.
*/
typedef P psite;
@@ -62,11 +62,11 @@
*/
typedef P point;
- /*! \brief Forward Piter associated type.
+ /*! \brief Forward Point_Iterator associated type.
*/
typedef box_fwd_piter_<P> fwd_piter;
- /*! \brief Backward Piter associated type.
+ /*! \brief Backward Point_Iterator associated type.
*/
typedef box_bkd_piter_<P> bkd_piter;
Index: mln/core/psubset_piter.hh
--- mln/core/psubset_piter.hh (revision 1026)
+++ mln/core/psubset_piter.hh (working copy)
@@ -33,7 +33,7 @@
* \brief Definition of iterators on points of psubsetes.
*/
-# include <mln/core/concept/piter.hh>
+# include <mln/core/concept/point_iterator.hh>
# include <mln/core/internal/piter_adaptor.hh>
# include <mln/core/psubset.hh>
Index: mln/core/rectangle2d.hh
--- mln/core/rectangle2d.hh (revision 1026)
+++ mln/core/rectangle2d.hh (working copy)
@@ -62,12 +62,12 @@
/// Dpoint associated type.
typedef dpoint2d dpoint;
- /*! \brief Piter type to browse a rectangle such as: "for each row
+ /*! \brief Point_Iterator type to browse a rectangle such as: "for each row
* (increasing), for each column (increasing)."
*/
typedef dpoints_fwd_piter<dpoint2d> fwd_qiter;
- /*! \brief Piter type to browse a rectangle such as: "for each row
+ /*! \brief Point_Iterator type to browse a rectangle such as: "for each row
* (decreasing), for each column (decreasing)."
*/
typedef internal::fixme bkd_qiter;
Index: mln/core/box_piter.hh
--- mln/core/box_piter.hh (revision 1026)
+++ mln/core/box_piter.hh (working copy)
@@ -33,7 +33,7 @@
* \brief Definition of iterators on points of boxes.
*/
-# include <mln/core/concept/piter.hh>
+# include <mln/core/concept/point_iterator.hh>
# include <mln/core/concept/box.hh>
@@ -47,14 +47,14 @@
* \see mln::box_
*/
template <typename P>
- class box_fwd_piter_ : public Piter< box_fwd_piter_<P> >
+ class box_fwd_piter_ : public Point_Iterator< box_fwd_piter_<P> >
{
public:
/// Space dimension.
enum { dim = P::dim };
- /// Psite associated type.
+ /// Point_Site associated type.
typedef P psite;
/// Point associated type.
@@ -107,14 +107,14 @@
* \see mln::box_
*/
template <typename P>
- class box_bkd_piter_ : public Piter< box_bkd_piter_<P> >
+ class box_bkd_piter_ : public Point_Iterator< box_bkd_piter_<P> >
{
public:
/// Space dimension.
enum { dim = P::dim };
- /// Psite associated type.
+ /// Point_Site associated type.
typedef P psite;
/// Point associated type.
Index: mln/core/window.hh
--- mln/core/window.hh (revision 1026)
+++ mln/core/window.hh (working copy)
@@ -34,7 +34,7 @@
*/
# include <mln/core/concept/window.hh>
-# include <mln/core/concept/genpoint.hh>
+# include <mln/core/concept/generalized_point.hh>
# include <mln/core/internal/set_of.hh>
# include <mln/core/dpoint.hh>
# include <mln/core/box.hh>
@@ -67,12 +67,12 @@
/// Dpoint associated type.
typedef D dpoint;
- /*! \brief Piter type to browse the points of a generic window
+ /*! \brief Point_Iterator type to browse the points of a generic window
* w.r.t. the ordering of delta-points.
*/
typedef dpoints_fwd_piter<D> fwd_qiter;
- /*! \brief Piter type to browse the points of a generic window
+ /*! \brief Point_Iterator type to browse the points of a generic window
* w.r.t. the reverse ordering of delta-points.
*/
typedef internal::fixme bkd_qiter;
Index: mln/core/dpoints_pixter.hh
--- mln/core/dpoints_pixter.hh (revision 1026)
+++ mln/core/dpoints_pixter.hh (working copy)
@@ -38,7 +38,7 @@
# include <vector>
# include <mln/core/concept/pixel_iterator.hh>
-# include <mln/core/concept/genpixel.hh>
+# include <mln/core/concept/generalized_pixel.hh>
# include <mln/core/internal/pixel_impl.hh>
@@ -70,7 +70,7 @@
template <typename Dps, typename Pref>
dpoints_fwd_pixter(I& image,
const Dps& dps,
- const GenPoint<Pref>& p_ref);
+ const Generalized_Point<Pref>& p_ref);
/*! \brief Constructor.
*
@@ -81,7 +81,7 @@
template <typename Dps, typename Pref>
dpoints_fwd_pixter(I& image,
const Dps& dps,
- const GenPixel<Pref>& p_ref);
+ const Generalized_Pixel<Pref>& p_ref);
/// Start an iteration.
void start();
@@ -134,7 +134,7 @@
template <typename Dps, typename Pref>
dpoints_fwd_pixter<I>::dpoints_fwd_pixter(I& image,
const Dps& dps,
- const GenPoint<Pref>& p_ref)
+ const Generalized_Point<Pref>& p_ref)
: super(image)
{
mln_precondition(image.has_data());
@@ -148,7 +148,7 @@
template <typename Dps, typename Pref>
dpoints_fwd_pixter<I>::dpoints_fwd_pixter(I& image,
const Dps& dps,
- const GenPixel<Pref>& p_ref)
+ const Generalized_Pixel<Pref>& p_ref)
: super(image)
{
mln_precondition(image.has_data());
Index: mln/core/internal/image_adaptor.hh
--- mln/core/internal/image_adaptor.hh (revision 1026)
+++ mln/core/internal/image_adaptor.hh (working copy)
@@ -51,7 +51,7 @@
typename S = mln_pset(I) >
struct image_adaptor_ : public internal::image_base_< S, E >
{
- /// Psite associated type.
+ /// Point_Site associated type.
typedef mln_psite(S) psite;
/// Point_Set associated type.
Index: mln/core/internal/image_base.hh
--- mln/core/internal/image_base.hh (revision 1026)
+++ mln/core/internal/image_base.hh (working copy)
@@ -70,7 +70,7 @@
/// Point_Set associated type.
typedef S pset;
- /// Psite associated type.
+ /// Point_Site associated type.
typedef mln_psite(S) psite;
/// Point associated type.
@@ -84,10 +84,10 @@
typedef mln_coord(point) coord;
- /// Forward Piter associated type.
+ /// Forward Point_Iterator associated type.
typedef mln_fwd_piter(S) fwd_piter;
- /// Backward Piter associated type.
+ /// Backward Point_Iterator associated type.
typedef mln_bkd_piter(S) bkd_piter;
Index: mln/core/internal/piter_adaptor.hh
--- mln/core/internal/piter_adaptor.hh (revision 1026)
+++ mln/core/internal/piter_adaptor.hh (working copy)
@@ -33,7 +33,7 @@
* \brief Definition of iterators on points of boxes.
*/
-# include <mln/core/concept/piter.hh>
+# include <mln/core/concept/point_iterator.hh>
# include <mln/core/concept/box.hh>
@@ -49,14 +49,14 @@
* parameter E is the exact type.
*/
template <typename Pi, typename E>
- class piter_adaptor_ : public Piter<E>
+ class piter_adaptor_ : public Point_Iterator<E>
{
public:
/// Space dimension.
enum { dim = Pi::dim };
- /// Psite associated type.
+ /// Point_Site associated type.
typedef mln_psite(Pi) psite;
/// Point associated type.
Index: mln/core/pixel.hh
--- mln/core/pixel.hh (revision 1026)
+++ mln/core/pixel.hh (working copy)
@@ -33,7 +33,7 @@
* \brief Definition of the generic pixel class mln::pixel.
*/
-# include <mln/core/concept/genpixel.hh>
+# include <mln/core/concept/generalized_pixel.hh>
# include <mln/core/internal/pixel_impl.hh>
@@ -47,7 +47,7 @@
*/
template <typename I>
struct pixel : public Object< pixel<I> >,
- public GenPixel< pixel<I> >,
+ public Generalized_Pixel< pixel<I> >,
internal::pixel_impl_< I, pixel<I> >
{
/// Constructor.
Index: mln/core/hline2d.hh
--- mln/core/hline2d.hh (revision 1026)
+++ mln/core/hline2d.hh (working copy)
@@ -60,12 +60,12 @@
/// Dpoint associated type.
typedef dpoint2d dpoint;
- /*! \brief Piter type to browse a hline such as: "for each row
+ /*! \brief Point_Iterator type to browse a hline such as: "for each row
* (increasing), for each column (increasing)."
*/
typedef dpoints_fwd_piter<dpoint2d> fwd_qiter;
- /*! \brief Piter type to browse a hline such as: "for each row
+ /*! \brief Point_Iterator type to browse a hline such as: "for each row
* (decreasing), for each column (decreasing)."
*/
typedef internal::fixme bkd_qiter;
Index: mln/core/neighb.hh
--- mln/core/neighb.hh (revision 1026)
+++ mln/core/neighb.hh (working copy)
@@ -58,12 +58,12 @@
/// Dpoint associated type.
typedef D dpoint;
- /*! \brief Piter type to browse the points of a generic
+ /*! \brief Point_Iterator type to browse the points of a generic
* neighborhood w.r.t. the ordering of delta-points.
*/
typedef dpoints_fwd_piter<D> fwd_niter;
- /*! \brief Piter type to browse the points of a generic
+ /*! \brief Point_Iterator type to browse the points of a generic
* neighborhood w.r.t. the reverse ordering of delta-points.
*/
typedef dpoints_bkd_piter<D> bkd_niter;
Index: mln/core/concept/value_iterator.hh
--- mln/core/concept/value_iterator.hh (revision 1026)
+++ mln/core/concept/value_iterator.hh (working copy)
@@ -28,13 +28,13 @@
#ifndef MLN_CORE_CONCEPT_VITER_HH
# define MLN_CORE_CONCEPT_VITER_HH
-/*! \file mln/core/concept/viter.hh
+/*! \file mln/core/concept/value_iterator.hh
*
- * \brief Definition of the concept of mln::Viter.
+ * \brief Definition of the concept of mln::Value_Iterator.
*/
# include <mln/core/concept/iterator.hh>
-# include <mln/core/concept/genpoint.hh>
+# include <mln/core/concept/generalized_point.hh>
namespace mln
@@ -46,11 +46,11 @@
* An iterator on values is an iterator that browse over a set of
* values.
*
- * \see mln::doc::Viter for a complete documentation of this class
+ * \see mln::doc::Value_Iterator for a complete documentation of this class
* contents.
*/
template <typename E>
- struct Viter : public Iterator<E>
+ struct Value_Iterator : public Iterator<E>
{
/*
typedef value;
@@ -58,7 +58,7 @@
*/
protected:
- Viter();
+ Value_Iterator();
};
@@ -72,17 +72,17 @@
*
* \return The modified output stream \p ostr.
*
- * \relates mln::Viter
+ * \relates mln::Value_Iterator
*/
template <typename E>
- std::ostream& operator<<(std::ostream& ostr, const Viter<E>& v);
+ std::ostream& operator<<(std::ostream& ostr, const Value_Iterator<E>& v);
# ifndef MLN_INCLUDE_ONLY
template <typename E>
- Viter<E>::Viter()
+ Value_Iterator<E>::Value_Iterator()
{
typedef mln_value(E) value;
value (E::*m)() const = & E::operator value;
@@ -90,7 +90,7 @@
}
template <typename E>
- std::ostream& operator<<(std::ostream& ostr, const Viter<E>& v)
+ std::ostream& operator<<(std::ostream& ostr, const Value_Iterator<E>& v)
{
mln_precondition(exact(v).is_valid());
return ostr << mln_value(E)(exact(v));
Index: mln/core/concept/value_set.hh
--- mln/core/concept/value_set.hh (revision 1026)
+++ mln/core/concept/value_set.hh (working copy)
@@ -32,7 +32,7 @@
* \brief Definition of the concept of mln::Value_Set.
*/
-# include <mln/core/concept/viter.hh>
+# include <mln/core/concept/value_iterator.hh>
namespace mln
Index: mln/core/concept/point.hh
--- mln/core/concept/point.hh (revision 1026)
+++ mln/core/concept/point.hh (working copy)
@@ -33,7 +33,7 @@
* \brief Definition of the concept of mln::Point.
*/
-# include <mln/core/concept/psite.hh>
+# include <mln/core/concept/point_site.hh>
namespace mln
@@ -47,7 +47,7 @@
* discrete square grid of the 2D plane.
*/
template <typename P>
- struct Point : public Psite<P>
+ struct Point : public Point_Site<P>
{
/*! \brief The associated point type is itself.
*/
Index: mln/core/concept/pixel_iterator.hh
--- mln/core/concept/pixel_iterator.hh (revision 1026)
+++ mln/core/concept/pixel_iterator.hh (working copy)
@@ -34,7 +34,7 @@
*/
# include <mln/core/concept/iterator.hh>
-# include <mln/core/concept/genpixel.hh>
+# include <mln/core/concept/generalized_pixel.hh>
namespace mln
@@ -51,7 +51,7 @@
*/
template <typename E>
struct Pixel_Iterator : public Iterator<E>,
- public GenPixel<E>
+ public Generalized_Pixel<E>
{
/*
typedef lvalue;
Index: mln/core/concept/generalized_pixel.hh
--- mln/core/concept/generalized_pixel.hh (revision 1026)
+++ mln/core/concept/generalized_pixel.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_CONCEPT_GENPIXEL_HH
# define MLN_CORE_CONCEPT_GENPIXEL_HH
-/*! \file mln/core/concept/genpixel.hh
+/*! \file mln/core/concept/generalized_pixel.hh
*
* \brief Definition of the concept of mln::Genpixel.
*/
@@ -40,21 +40,21 @@
namespace mln
{
- // FIXME: \class GenPixel GenPixel.hh "mln/core/concept/doc/GenPixel.hh"
+ // FIXME: \class Generalized_Pixel Generalized_Pixel.hh "mln/core/concept/doc/Generalized_Pixel.hh"
/*! \brief Base class for implementation classes that are pixels or that
* have the behavior of pixels.
*
- * "GenPixel" is "Generalized Pixel" for short.
+ * "Generalized_Pixel" is "Generalized Pixel" for short.
*
* \warning This class does \em not derive from mln::Object; it is
* for use as a parallel hierarchy.
*
- * \see mln::doc::GenPixel for a complete documentation of this
+ * \see mln::doc::Generalized_Pixel for a complete documentation of this
* class contents.
*/
template <typename E>
- struct GenPixel
+ struct Generalized_Pixel
{
/*
typedef value;
@@ -64,14 +64,14 @@
value** address_() const;
*/
protected:
- GenPixel();
+ Generalized_Pixel();
};
# ifndef MLN_INCLUDE_ONLY
template <typename E>
- GenPixel<E>::GenPixel()
+ Generalized_Pixel<E>::Generalized_Pixel()
{
typedef mln_value(E) value;
typedef mln_rvalue(E) rvalue;
Index: mln/core/concept/generalized_point.hh
--- mln/core/concept/generalized_point.hh (revision 1026)
+++ mln/core/concept/generalized_point.hh (working copy)
@@ -28,8 +28,8 @@
#ifndef MLN_CORE_CONCEPT_GENPOINT_HH
# define MLN_CORE_CONCEPT_GENPOINT_HH
-/*! \file mln/core/concept/genpoint.hh
- * \brief Definition of the concept of mln::GenPoint.
+/*! \file mln/core/concept/generalized_point.hh
+ * \brief Definition of the concept of mln::Generalized_Point.
*/
# include <mlc/equal.hh>
# include <mlc/same_point.hh>
@@ -42,21 +42,21 @@
namespace mln
{
- // FIXME: \class GenPoint genpoint.hh "mln/core/concept/doc/genpoint.hh"
+ // FIXME: \class Generalized_Point generalized_point.hh "mln/core/concept/doc/generalized_point.hh"
/*! \brief Base class for implementation classes that are points or that
* have the behavior of points.
*
- * "GenPoint" is "Generalized Point" for short.
+ * "Generalized_Point" is "Generalized Point" for short.
*
* \warning This class does \em not derive from mln::Object; it is
* for use as a parallel hierarchy.
*
- * \see mln::doc::GenPoint for a complete documentation of this
+ * \see mln::doc::Generalized_Point for a complete documentation of this
* class contents.
*/
template <typename E>
- struct GenPoint
+ struct Generalized_Point
{
/*
@@ -75,7 +75,7 @@
*/
protected:
- GenPoint();
+ Generalized_Point();
};
@@ -93,10 +93,10 @@
* \return True if both generalized points have the same
* coordinates, otherwise false.
*
- * \relates mln::GenPoint
+ * \relates mln::Generalized_Point
*/
template <typename Pl, typename Pr>
- bool operator=(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
+ bool operator=(const Generalized_Point<Pl>& lhs, const Generalized_Point<Pr>& rhs);
/*! \brief Ordering "less than" comparison between a couple of generalized
@@ -117,10 +117,10 @@
* \return True if \p lhs is before \p rhs in the sense of the
* coordinates lexicographic comparison, otherwise false.
*
- * \relates mln::GenPoint
+ * \relates mln::Generalized_Point
*/
template <typename Pl, typename Pr>
- bool operator<(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
+ bool operator<(const Generalized_Point<Pl>& lhs, const Generalized_Point<Pr>& rhs);
/*! \brief Difference between a couple of generalized point \p lhs and \p
@@ -142,11 +142,11 @@
* \return A delta-point (temporary object).
*
* \see mln::Dpoint
- * \relates mln::GenPoint
+ * \relates mln::Generalized_Point
*/
template <typename Pl, typename Pr>
mln_dpoint(Pl)
- operator-(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
+ operator-(const Generalized_Point<Pl>& lhs, const Generalized_Point<Pr>& rhs);
/*! \brief Add a delta-point \p rhs to a generalized point \p lhs.
@@ -160,14 +160,14 @@
* \return A point (temporary object).
*
* \see mln::Dpoint
- * \relates mln::GenPoint
+ * \relates mln::Generalized_Point
*
* \todo Introduce the notion of "generalized dpoint" and
- * add the more general extra operator+(GenPoint, GenDpoint).
+ * add the more general extra operator+(Generalized_Point, GenDpoint).
*/
template <typename P>
mln_point(P)
- operator+(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs);
+ operator+(const Generalized_Point<P>& lhs, const mln_dpoint(P)& rhs);
/*! \brief Substract a delta-point \p rhs to a generalized point \p lhs.
@@ -181,11 +181,11 @@
* \return A point (temporary object).
*
* \see mln::Dpoint
- * \relates mln::GenPoint
+ * \relates mln::Generalized_Point
*/
template <typename P>
mln_point(P)
- operator-(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs);
+ operator-(const Generalized_Point<P>& lhs, const mln_dpoint(P)& rhs);
/*! \brief Print a generalized point \p p into the output stream \p
@@ -196,10 +196,10 @@
*
* \return The modified output stream \p ostr.
*
- * \relates mln::GenPoint
+ * \relates mln::Generalized_Point
*/
template <typename P>
- std::ostream& operator<<(std::ostream& ostr, const GenPoint<P>& p);
+ std::ostream& operator<<(std::ostream& ostr, const Generalized_Point<P>& p);
@@ -207,7 +207,7 @@
template <typename E>
- GenPoint<E>::GenPoint()
+ Generalized_Point<E>::Generalized_Point()
{
int dim = E::dim;
mln_invariant(dim > 0);
@@ -223,7 +223,7 @@
template <typename Pl, typename Pr>
- bool operator=(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs)
+ bool operator=(const Generalized_Point<Pl>& lhs, const Generalized_Point<Pr>& rhs)
{
// FIXME: mlc::same_grid<Pl, Pr>::check();
const Pl& lhs_ = internal::force_exact<Pl>(lhs);
@@ -236,7 +236,7 @@
}
template <typename Pl, typename Pr>
- bool operator<(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs)
+ bool operator<(const Generalized_Point<Pl>& lhs, const Generalized_Point<Pr>& rhs)
{
// FIXME: mlc::same_grid<Pl, Pr>::check();
const Pl& lhs_ = internal::force_exact<Pl>(lhs);
@@ -252,7 +252,7 @@
template <typename Pl, typename Pr>
mln_dpoint(Pl)
- operator-(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs)
+ operator-(const Generalized_Point<Pl>& lhs, const Generalized_Point<Pr>& rhs)
{
mlc::equal<mln_dpoint(Pl), mln_dpoint(Pr)>::check();
// FIXME: mlc::same_grid<Pl, Pr>::check();
@@ -268,7 +268,7 @@
template <typename P>
mln_point(P)
- operator+(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs)
+ operator+(const Generalized_Point<P>& lhs, const mln_dpoint(P)& rhs)
{
const P& lhs_ = internal::force_exact<P>(lhs);
mln_point(P) tmp;
@@ -279,7 +279,7 @@
template <typename P>
mln_point(P)
- operator-(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs)
+ operator-(const Generalized_Point<P>& lhs, const mln_dpoint(P)& rhs)
{
const P& lhs_ = internal::force_exact<P>(lhs);
mln_point(P) tmp;
@@ -289,7 +289,7 @@
}
template <typename P>
- std::ostream& operator<<(std::ostream& ostr, const GenPoint<P>& p)
+ std::ostream& operator<<(std::ostream& ostr, const Generalized_Point<P>& p)
{
const P& p_ = internal::force_exact<P>(p);
Index: mln/core/concept/point_iterator.hh
--- mln/core/concept/point_iterator.hh (revision 1026)
+++ mln/core/concept/point_iterator.hh (working copy)
@@ -28,13 +28,13 @@
#ifndef MLN_CORE_CONCEPT_PITER_HH
# define MLN_CORE_CONCEPT_PITER_HH
-/*! \file mln/core/concept/piter.hh
+/*! \file mln/core/concept/point_iterator.hh
*
- * \brief Definition of the concept of mln::Piter.
+ * \brief Definition of the concept of mln::Point_Iterator.
*/
# include <mln/core/concept/iterator.hh>
-# include <mln/core/concept/genpoint.hh>
+# include <mln/core/concept/generalized_point.hh>
namespace mln
@@ -46,12 +46,12 @@
* An iterator on points is an iterator that browse over a set of
* points.
*
- * \see mln::doc::Piter for a complete documentation of this class
+ * \see mln::doc::Point_Iterator for a complete documentation of this class
* contents.
*/
template <typename E>
- struct Piter : public Iterator<E>,
- public GenPoint<E>
+ struct Point_Iterator : public Iterator<E>,
+ public Generalized_Point<E>
{
/*
typedef psite;
@@ -59,14 +59,14 @@
*/
protected:
- Piter();
+ Point_Iterator();
};
# ifndef MLN_INCLUDE_ONLY
template <typename E>
- Piter<E>::Piter()
+ Point_Iterator<E>::Point_Iterator()
{
typedef mln_psite(E) psite;
psite (E::*m)() const = & E::operator psite;
Index: mln/core/concept/point_set.hh
--- mln/core/concept/point_set.hh (revision 1026)
+++ mln/core/concept/point_set.hh (working copy)
@@ -34,7 +34,7 @@
*/
# include <mln/core/concept/point.hh>
-# include <mln/core/concept/piter.hh>
+# include <mln/core/concept/point_iterator.hh>
namespace mln
Index: mln/core/concept/doc/image.hh
--- mln/core/concept/doc/image.hh (revision 1026)
+++ mln/core/concept/doc/image.hh (working copy)
@@ -127,8 +127,8 @@
*/
typedef void point;
- /*! \brief Psite associated type.
- * \invariant This type has to derive from mln::Psite.
+ /*! \brief Point_Site associated type.
+ * \invariant This type has to derive from mln::Point_Site.
*/
typedef void psite;
@@ -144,12 +144,12 @@
/*! \brief Forward point iterator associated type.
- * \invariant This type has to derive from mln::Piter.
+ * \invariant This type has to derive from mln::Point_Iterator.
*/
typedef void fwd_piter;
/*! \brief Backward point iterator associated type.
- * \invariant This type has to derive from mln::Piter.
+ * \invariant This type has to derive from mln::Point_Iterator.
*/
typedef void bkd_piter;
Index: mln/core/concept/doc/value_iterator.hh
--- mln/core/concept/doc/value_iterator.hh (revision 1026)
+++ mln/core/concept/doc/value_iterator.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file mln/core/concept/doc/viter.hh
- * \brief This file documents the concept of mln::Viter.
+/*! \file mln/core/concept/doc/value_iterator.hh
+ * \brief This file documents the concept of mln::Value_Iterator.
*/
namespace mln
@@ -35,12 +35,12 @@
namespace doc
{
- /*! \brief Documentation class for mln::Viter.
+ /*! \brief Documentation class for mln::Value_Iterator.
*
- * \see mln::Viter
+ * \see mln::Value_Iterator
*/
template <typename E>
- struct Viter : public Iterator<E>
+ struct Value_Iterator : public Iterator<E>
{
/*! \brief Value associated type.
*/
Index: mln/core/concept/doc/value_set.hh
--- mln/core/concept/doc/value_set.hh (revision 1026)
+++ mln/core/concept/doc/value_set.hh (working copy)
@@ -46,11 +46,11 @@
*/
typedef void value;
- /*! \brief Forward Viter associated type.
+ /*! \brief Forward Value_Iterator associated type.
*/
typedef void fwd_viter;
- /*! \brief Backward Viter associated type.
+ /*! \brief Backward Value_Iterator associated type.
*/
typedef void bkd_viter;
Index: mln/core/concept/doc/generalized_pixel.hh
--- mln/core/concept/doc/generalized_pixel.hh (revision 1026)
+++ mln/core/concept/doc/generalized_pixel.hh (working copy)
@@ -28,8 +28,8 @@
#ifndef MLN_CORE_CONCEPT_DOC_GENPIXEL_HH
# define MLN_CORE_CONCEPT_DOC_GENPIXEL_HH
-/*! \file mln/core/concept/doc/genpixel.hh
- * \brief This file documents the concept of mln::GenPixel.
+/*! \file mln/core/concept/doc/generalized_pixel.hh
+ * \brief This file documents the concept of mln::Generalized_Pixel.
*/
@@ -39,12 +39,12 @@
namespace doc
{
- /*! \brief Documentation class for mln::GenPixel.
+ /*! \brief Documentation class for mln::Generalized_Pixel.
*
- * \see mln::GenPixel
+ * \see mln::Generalized_Pixel
*/
template <typename E>
- struct GenPixel
+ struct Generalized_Pixel
{
/// Value associated type.
@@ -70,7 +70,7 @@
value** address_() const;
protected:
- GenPixel();
+ Generalized_Pixel();
};
} // end of namespace mln::doc
Index: mln/core/concept/doc/pixel_iterator.hh
--- mln/core/concept/doc/pixel_iterator.hh (revision 1026)
+++ mln/core/concept/doc/pixel_iterator.hh (working copy)
@@ -41,7 +41,7 @@
*/
template <typename E>
struct Pixel_Iterator : public Iterator<E>,
- public GenPixel<E>
+ public Generalized_Pixel<E>
{
/*! \brief Type returned by the read-write dereference operator.
*/
Index: mln/core/concept/doc/point_iterator.hh
--- mln/core/concept/doc/point_iterator.hh (revision 1026)
+++ mln/core/concept/doc/point_iterator.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file mln/core/concept/doc/piter.hh
- * \brief This file documents the concept of mln::Piter.
+/*! \file mln/core/concept/doc/point_iterator.hh
+ * \brief This file documents the concept of mln::Point_Iterator.
*/
namespace mln
@@ -35,16 +35,16 @@
namespace doc
{
- /*! \brief Documentation class for mln::Piter.
+ /*! \brief Documentation class for mln::Point_Iterator.
*
- * \see mln::Piter
+ * \see mln::Point_Iterator
*/
template <typename E>
- struct Piter : public Iterator<E>,
- public GenPoint<E>
+ struct Point_Iterator : public Iterator<E>,
+ public Generalized_Point<E>
{
- /*! \brief Psite associated type.
- * \invariant This type has to derive from mln::Psite.
+ /*! \brief Point_Site associated type.
+ * \invariant This type has to derive from mln::Point_Site.
*/
typedef void psite;
Index: mln/core/concept/doc/generalized_point.hh
--- mln/core/concept/doc/generalized_point.hh (revision 1026)
+++ mln/core/concept/doc/generalized_point.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file mln/core/concept/doc/genpoint.hh
- * \brief This file documents the concept of mln::GenPoint.
+/*! \file mln/core/concept/doc/generalized_point.hh
+ * \brief This file documents the concept of mln::Generalized_Point.
*/
namespace mln
@@ -35,12 +35,12 @@
namespace doc
{
- /*! \brief Documentation class for mln::GenPoint.
+ /*! \brief Documentation class for mln::Generalized_Point.
*
- * \see mln::GenPoint
+ * \see mln::Generalized_Point
*/
template <typename E>
- struct GenPoint
+ struct Generalized_Point
{
/*! \var dim
* \brief Dimension of the space.
Index: mln/core/concept/doc/point_set.hh
--- mln/core/concept/doc/point_set.hh (revision 1026)
+++ mln/core/concept/doc/point_set.hh (working copy)
@@ -46,15 +46,15 @@
*/
typedef void point;
- /*! \brief Psite associated type.
+ /*! \brief Point_Site associated type.
*/
typedef void psite;
- /*! \brief Forward Piter associated type.
+ /*! \brief Forward Point_Iterator associated type.
*/
typedef void fwd_piter;
- /*! \brief Backward Piter associated type.
+ /*! \brief Backward Point_Iterator associated type.
*/
typedef void bkd_piter;
Index: mln/core/concept/doc/window.hh
--- mln/core/concept/doc/window.hh (revision 1026)
+++ mln/core/concept/doc/window.hh (working copy)
@@ -45,17 +45,17 @@
template <typename E>
struct Window : public Object<E>
{
- /*! \brief Piter type associated to this window to browse its
+ /*! \brief Point_Iterator type associated to this window to browse its
* points.
*/
typedef void qiter;
- /*! \brief Piter type associated to this window to browse its
+ /*! \brief Point_Iterator type associated to this window to browse its
* points in a forward way.
*/
typedef void fwd_qiter;
- /*! \brief Piter type associated to this window to browse its
+ /*! \brief Point_Iterator type associated to this window to browse its
* points in a backward way.
*/
typedef void bkd_qiter;
Index: mln/core/concept/doc/neighborhood.hh
--- mln/core/concept/doc/neighborhood.hh (revision 1026)
+++ mln/core/concept/doc/neighborhood.hh (working copy)
@@ -42,17 +42,17 @@
template <typename E>
struct Neighborhood : public Object<E>
{
- /*! \brief Piter type associated to this neighborhood to browse
+ /*! \brief Point_Iterator type associated to this neighborhood to browse
* neighbors.
*/
typedef void niter;
- /*! \brief Piter type associated to this neighborhood to browse
+ /*! \brief Point_Iterator type associated to this neighborhood to browse
* neighbors in a forward way.
*/
typedef void fwd_niter;
- /*! \brief Piter type associated to this neighborhood to browse
+ /*! \brief Point_Iterator type associated to this neighborhood to browse
* neighbors in a backward way.
*/
typedef void bkd_niter;
Index: mln/core/concept/point_site.hh
--- mln/core/concept/point_site.hh (revision 1026)
+++ mln/core/concept/point_site.hh (working copy)
@@ -28,11 +28,11 @@
#ifndef MLN_CORE_CONCEPT_PSITE_HH
# define MLN_CORE_CONCEPT_PSITE_HH
-/*! \file mln/core/concept/psite.hh
- * \brief Definition of the concept of mln::Psite.
+/*! \file mln/core/concept/point_site.hh
+ * \brief Definition of the concept of mln::Point_Site.
*/
-# include <mln/core/concept/genpoint.hh>
+# include <mln/core/concept/generalized_point.hh>
namespace mln
@@ -46,7 +46,7 @@
* is either a point or designates a point: regular points, deriving
* from mln::Point, are point sites, yet some point sites are not
* points.) A point site has the behavior expected from every
- * point; see mln::GenPoint.
+ * point; see mln::Generalized_Point.
*
* When a point site is not a point, it is automatically convertible
* to the point it designates.
@@ -61,8 +61,8 @@
* proper point site is a pair (index of run, index within the run).
*/
template <typename E>
- struct Psite : public Object<E>,
- public GenPoint<E>
+ struct Point_Site : public Object<E>,
+ public Generalized_Point<E>
{
/*
const point* pointer_() const
@@ -72,14 +72,14 @@
*/
protected:
- Psite();
+ Point_Site();
};
# ifndef MLN_INCLUDE_ONLY
template <typename E>
- Psite<E>::Psite()
+ Point_Site<E>::Point_Site()
{
}
Index: mln/core/vline2d.hh
--- mln/core/vline2d.hh (revision 1026)
+++ mln/core/vline2d.hh (working copy)
@@ -62,12 +62,12 @@
/// Dpoint associated type.
typedef dpoint2d dpoint;
- /*! \brief Piter type to browse a vline such as: "for each row
+ /*! \brief Point_Iterator type to browse a vline such as: "for each row
* (increasing), for each column (increasing)."
*/
typedef dpoints_fwd_piter<dpoint2d> fwd_qiter;
- /*! \brief Piter type to browse a vline such as: "for each row
+ /*! \brief Point_Iterator type to browse a vline such as: "for each row
* (decreasing), for each column (decreasing)."
*/
typedef internal::fixme bkd_qiter;
Index: mln/level/approx/median.hh
--- mln/level/approx/median.hh (revision 1026)
+++ mln/level/approx/median.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_LEVEL_APPROX_MEDIAN_HH
# define MLN_LEVEL_APPROX_MEDIAN_HH
-/*! \file mln/level/median.hh
+/*! \file mln/level/approx/median.hh
*
* \brief Approximates of some median filters of an image.
*/
Index: mln/value/lut_vec.hh
--- mln/value/lut_vec.hh (revision 1026)
+++ mln/value/lut_vec.hh (working copy)
@@ -63,10 +63,10 @@
/// Value associated type.
typedef T value;
- /// Forward Viter associated type.
+ /// Forward Value_Iterator associated type.
typedef fwd_viter_< lut_vec<S,T> > fwd_viter;
- /// Backward Viter associated type.
+ /// Backward Value_Iterator associated type.
typedef bkd_viter_< lut_vec<S,T> > bkd_viter;
/// Give the \p i-th value.
Index: mln/value/viter.hh
--- mln/value/viter.hh (revision 1026)
+++ mln/value/viter.hh (working copy)
@@ -33,7 +33,7 @@
* \brief Definition of iterators on value sets.
*/
-# include <mln/core/concept/viter.hh>
+# include <mln/core/concept/value_iterator.hh>
@@ -49,7 +49,7 @@
* The parameter \c S is the type of value set.
*/
template <typename S>
- struct fwd_viter_ : public Viter< fwd_viter_<S> >
+ struct fwd_viter_ : public Value_Iterator< fwd_viter_<S> >
{
/// Value associated type.
typedef mln_value(S) value;
@@ -86,7 +86,7 @@
* The parameter \c S is the type of value set.
*/
template <typename S>
- struct bkd_viter_ : public Viter< bkd_viter_<S> >
+ struct bkd_viter_ : public Value_Iterator< bkd_viter_<S> >
{
/// Value associated type.
typedef mln_value(S) value;
Index: mln/value/set.hh
--- mln/value/set.hh (revision 1026)
+++ mln/value/set.hh (working copy)
@@ -58,10 +58,10 @@
/// Value associated type.
typedef T value;
- /// Forward Viter associated type.
+ /// Forward Value_Iterator associated type.
typedef fwd_viter_< set_<T> > fwd_viter;
- /// Backward Viter associated type.
+ /// Backward Value_Iterator associated type.
typedef bkd_viter_< set_<T> > bkd_viter;
/// Test if \p v belongs to this set: always true!
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Handle low quantization and fast properties.
* tests/transform.cc: New.
* tests/fill.cc: New.
* mln/core/macros.hh (mln_value_kind, mln_vset): New.
* mln/core/trait/is_fast.hh: New.
* mln/core/trait/all.hh: New.
* mln/core/trait/is_lowq.hh: New.
* mln/core/internal/image_base.hh
(select_image_concept_): New.
* mln/core/concept/image.hh (vset, values): New.
Update.
* mln/core/concept/fast_image.hh (operator[]): New.
* mln/metal/math.hh: New.
* mln/metal/bool.hh: New.
* mln/metal/bexpr.hh: New.
* mln/value/lut_vec.hh: New.
* mln/value/int_u.hh (nbits, card): New.
* tests/README (g++-2.95): New hints.
* tests/pixter_dpoint2d.cc: Fix warning.
* tests/erosion.cc: Fix doc.
* doc/Doxyfile.in: Update.
* mln/debug/iota.hh: New overload.
* mln/fun/pw_value.hh (function_): Rename as...
(select_function_): ...this.
* mln/core/trait/pixter.hh
(pixter, qixter, nixter): Remove; obsolete.
* mln/core/concept/value_set.hh (viter): Likewise.
* mln/core/concept/doc/image.hh,
* mln/core/concept/doc/value_set.hh,
* mln/core/concept/doc/fast_image.hh: Update.
* mln/core/image2d_b.hh: Update.
* mln/metal/none.hh: Fix doc.
* mln/morpho/erosion.hh: Update.
* mln/level/fill.hh: Add todos.
New overload.
* mln/level/fast_median.hh: Fix doc.
* mln/level/transform.hh: New overload.
* mln/value/props.hh (min): Change to var.
* mln/value/kind.hh: Fix doc.
* mln/value/set.hh (viter): Remove; obsolete.
doc/Doxyfile.in | 1
mln/core/concept/doc/fast_image.hh | 25 +++++
mln/core/concept/doc/image.hh | 17 +++
mln/core/concept/doc/value_set.hh | 4
mln/core/concept/fast_image.hh | 20 +++-
mln/core/concept/image.hh | 6 +
mln/core/concept/value_set.hh | 2
mln/core/image2d_b.hh | 65 +++++++++++++-
mln/core/internal/image_base.hh | 20 ++++
mln/core/macros.hh | 12 ++
mln/core/tags.hh | 1
mln/core/trait/all.hh | 52 +++++++++++
mln/core/trait/is_fast.hh | 60 +++++++++++++
mln/core/trait/is_lowq.hh | 65 ++++++++++++++
mln/core/trait/pixter.hh | 15 ---
mln/debug/iota.hh | 23 +++++
mln/fun/pw_value.hh | 6 -
mln/level/fast_median.hh | 2
mln/level/fill.hh | 75 ++++++++++++++--
mln/level/transform.hh | 56 +++++++++++-
mln/metal/bexpr.hh | 102 ++++++++++++++++++++++
mln/metal/bool.hh | 76 +++++++++++++++++
mln/metal/math.hh | 63 ++++++++++++++
mln/metal/none.hh | 2
mln/morpho/erosion.hh | 2
mln/value/int_u.hh | 3
mln/value/kind.hh | 2
mln/value/lut_vec.hh | 165 +++++++++++++++++++++++++++++++++++++
mln/value/props.hh | 85 ++++++++++---------
mln/value/set.hh | 11 --
tests/README | 4
tests/erosion.cc | 4
tests/fill.cc | 63 ++++++++++++++
tests/pixter_dpoint2d.cc | 2
tests/transform.cc | 66 ++++++++++++++
35 files changed, 1066 insertions(+), 111 deletions(-)
Index: tests/README
--- tests/README (revision 1025)
+++ tests/README (working copy)
@@ -1 +1,3 @@
-g++-4.1 -I.. -ansi -pedantic -W -Wall -Wextra -Wconversion sample.cc
+g++-4.1 -ansi -pedantic -W -Wall -Wextra -Wconversion -I.. sample.cc
+
+g++-2.95 -ansi -pedantic -W -Wall -Wconversion -ftemplate-depth-51 -I.. sample.cc
\ No newline at end of file
Index: tests/transform.cc
--- tests/transform.cc (revision 0)
+++ tests/transform.cc (revision 0)
@@ -0,0 +1,66 @@
+// 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/transform.cc
+ *
+ * \brief Tests on mln::level::transform
+ */
+
+#include <cmath>
+
+#include <mln/core/image2d_b.hh>
+#include <mln/level/transform.hh>
+#include <mln/debug/iota.hh>
+
+
+struct mysqrt : mln::Function_v2v<mysqrt>
+{
+ typedef unsigned short result;
+ result operator()(unsigned short c) const
+ {
+ return result( std::sqrt(float(c)) );
+ }
+};
+
+
+
+int main()
+{
+ using namespace mln;
+
+ const unsigned size = 10000;
+ image2d_b<unsigned short>
+ ima(size, size);
+
+ (std::cout << "iota... ").flush();
+ debug::iota(ima);
+ std::cout << "done" << std::endl;
+
+ (std::cout << "transform... ").flush();
+ level::transform(ima, mysqrt(), ima);
+ std::cout << "done" << std::endl;
+}
Index: tests/pixter_dpoint2d.cc
--- tests/pixter_dpoint2d.cc (revision 1025)
+++ tests/pixter_dpoint2d.cc (working copy)
@@ -67,7 +67,7 @@
qixter qix(ima, win, p);
for_all(p)
- if (p[0] > 0 && p[1] > 0 && p[0] < size - 1 && p[1] < size - 1)
+ if (p[0] > 0 && p[1] > 0 && p[0] < int(size - 1) && p[1] < int(size - 1))
for_all(qix)
mln_assertion(*qix = value);
}
Index: tests/erosion.cc
--- tests/erosion.cc (revision 1025)
+++ tests/erosion.cc (working copy)
@@ -25,9 +25,9 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/median.cc
+/*! \file tests/erosion.cc
*
- * \brief Test on mln::level::median.
+ * \brief Test on mln::morpho::erosion.
*/
#include <mln/core/image2d_b.hh>
Index: tests/fill.cc
--- tests/fill.cc (revision 0)
+++ tests/fill.cc (revision 0)
@@ -0,0 +1,63 @@
+// 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/fill.cc
+ *
+ * \brief Tests on mln::level::fill
+ */
+
+#include <mln/core/image2d_b.hh>
+#include <mln/level/fill.hh>
+
+#include <mln/debug/println.hh>
+#include <mln/value/props.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+
+ unsigned u = 300;
+ unsigned char uc = u;
+ mln_assertion(uc = 44);
+
+// {
+// const unsigned size = 3;
+// image2d_b<unsigned> ima(size, size);
+// level::fill(ima, u);
+// debug::println(ima);
+// }
+
+ {
+ const unsigned size = 10000;
+ image2d_b<unsigned char> ima(size, size);
+ for (unsigned i = 0; i < 5; ++i)
+ level::fill(ima, uc);
+ }
+
+}
Index: doc/Doxyfile.in
--- doc/Doxyfile.in (revision 1025)
+++ doc/Doxyfile.in (working copy)
@@ -1055,6 +1055,7 @@
"mln_fwd_viter(T)=typename T::fwd_viter" \
"mln_bkd_viter(T)=typename T::bkd_viter" \
"mln_value(T)=typename T::value" \
+ "mln_vset(T)=typename T::vset" \
"mln_rvalue(T)=typename T::rvalue" \
"mln_lvalue(T)=typename T::lvalue" \
"mln_coord(T)=typename T::coord" \
Index: mln/debug/iota.hh
--- mln/debug/iota.hh (revision 1025)
+++ mln/debug/iota.hh (working copy)
@@ -49,6 +49,9 @@
# ifndef MLN_INCLUDE_ONLY
+ namespace impl
+ {
+
template <typename I>
void iota(Image<I>& input_)
{
@@ -59,6 +62,26 @@
input(p) = ++i;
}
+ template <typename I>
+ void iota(Fast_Image<I>& input_)
+ {
+ unsigned i = 0;
+ I& input = exact(input_);
+ mln_pixter(I) p(input);
+ for_all(p)
+ *p = ++i;
+ }
+
+ } // end of namespace mln::debug::impl
+
+
+ template <typename I>
+ void iota(Image<I>& input)
+ {
+ mln_precondition(exact(input).has_data());
+ impl::iota(exact(input));
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::debug
Index: mln/fun/pw_value.hh
--- mln/fun/pw_value.hh (revision 1025)
+++ mln/fun/pw_value.hh (working copy)
@@ -63,11 +63,11 @@
{
template <typename K, typename E>
- struct function_ : Function_p2v<E>
+ struct select_function_ : Function_p2v<E>
{};
template <typename E>
- struct function_< value::binary_kind, E > : Function_p2b<E>
+ struct select_function_< value::binary_kind, E > : Function_p2b<E>
{};
} // end of namespace mln::fun::internal
@@ -76,7 +76,7 @@
// FIXME: Doc!
template <typename I>
- struct pw_value : public internal::function_< mln_kind(I), pw_value<I> >
+ struct pw_value : public internal::select_function_< mln_value_kind(I), pw_value<I> >
{
typedef mln_value(I) result;
pw_value(const I& ima);
Index: mln/core/macros.hh
--- mln/core/macros.hh (revision 1025)
+++ mln/core/macros.hh (working copy)
@@ -105,14 +105,14 @@
// p
-/// Shortcut to access the piter type associated to T.
+/// Shortcut 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
-/// Shortcut to access the pset type associated to T.
+/// Shortcut to access the type of point set (pset) associated to T.
# define mln_pset(T) typename T::pset
-/// Shortcut to access the psite type associated to T.
+/// Shortcut to access the type of point site (psite) associated to T.
# define mln_psite(T) typename T::psite
/// Shortcut to access the point type associated to T.
@@ -145,6 +145,12 @@
/// Shortcut to access the value type associated to T.
# define mln_value(T) typename T::value
+/// Shortcut to the kind of values for an image with type \c I.
+# define mln_value_kind(T) typename mln::value::props< mln_value(I) >::kind
+
+/// Shortcut to access the type of value set (vset) associated to T.
+# define mln_vset(T) typename T::vset
+
/// Shortcut to access the viter type associated to T.
# define mln_viter(T) typename T::fwd_viter
Index: mln/core/trait/is_fast.hh
--- mln/core/trait/is_fast.hh (revision 0)
+++ mln/core/trait/is_fast.hh (revision 0)
@@ -0,0 +1,60 @@
+// 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_TRAIT_IS_FAST_HH
+# define MLN_CORE_TRAIT_IS_FAST_HH
+
+/*! \file mln/core/trait/is_fast.hh
+ *
+ * \brief Definition of the is_fast image trait.
+ */
+
+# include <mln/metal/bool.hh>
+
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+
+ // FIXME: Doc!
+
+ template <typename I>
+ struct is_fast
+ {
+ typedef metal::false_ ret;
+ };
+
+
+ } // end of namespace mln::trait
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_TRAIT_IS_FAST_HH
Index: mln/core/trait/all.hh
--- mln/core/trait/all.hh (revision 0)
+++ mln/core/trait/all.hh (revision 0)
@@ -0,0 +1,52 @@
+// 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_TRAIT_ALL_HH
+# define MLN_CORE_TRAIT_ALL_HH
+
+/*! \file mln/core/trait/all.hh
+ *
+ * \brief File that includes all traits.
+ */
+
+
+namespace mln
+{
+
+ /*! Namespace for image traits.
+ */
+ namespace trait {}
+
+}
+
+
+# include <mln/core/trait/is_fast.hh>
+# include <mln/core/trait/is_lowq.hh>
+# include <mln/core/trait/pixter.hh>
+
+
+#endif // ! MLN_CORE_TRAIT_ALL_HH
Index: mln/core/trait/pixter.hh
--- mln/core/trait/pixter.hh (revision 1025)
+++ mln/core/trait/pixter.hh (working copy)
@@ -57,11 +57,6 @@
typedef metal::none ret;
};
- template <typename I>
- struct pixter : fwd_pixter<I>
- {
- };
-
// qixter
@@ -77,11 +72,6 @@
typedef metal::none ret;
};
- template <typename I, typename W>
- struct qixter : fwd_qixter<I, W>
- {
- };
-
// nixter
@@ -97,11 +87,6 @@
typedef metal::none ret;
};
- template <typename I, typename N>
- struct nixter : fwd_nixter<I, N>
- {
- };
-
} // end of namespace mln::trait
Index: mln/core/trait/is_lowq.hh
--- mln/core/trait/is_lowq.hh (revision 0)
+++ mln/core/trait/is_lowq.hh (revision 0)
@@ -0,0 +1,65 @@
+// 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_TRAIT_IS_LOWQ_HH
+# define MLN_CORE_TRAIT_IS_LOWQ_HH
+
+/*! \file mln/core/trait/is_lowq.hh
+ *
+ * \brief Definition of the is_lowq image trait.
+ */
+
+# include <mln/metal/bool.hh>
+# include <mln/value/props.hh>
+
+
+# define mln_is_lowq(I) typename mln::trait::is_lowq< I >::ret
+
+
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+
+ // FIXME: Doc!
+
+ template <typename I>
+ struct is_lowq
+ {
+ typedef typename metal::bool_<( mln_card(mln_value(I)) != 0 )>::type ret;
+ };
+
+
+ } // end of namespace mln::trait
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_TRAIT_IS_LOWQ_HH
Index: mln/core/internal/image_base.hh
--- mln/core/internal/image_base.hh (revision 1025)
+++ mln/core/internal/image_base.hh (working copy)
@@ -42,12 +42,30 @@
namespace internal
{
+
+
+ template <typename Is_fast, typename E>
+ struct select_image_concept_;
+
+ template <typename E>
+ struct select_image_concept_< metal::true_, E >
+ : public Fast_Image<E>
+ {};
+
+ template <typename E>
+ struct select_image_concept_< metal::false_, E >
+ : public Image<E>
+ {};
+
+
+
/*! \brief A base class for images.
*
* \internal
*/
template <typename S, typename E>
- struct image_base_ : public Image<E>
+ struct image_base_ : public select_image_concept_< typename trait::is_fast<E>::ret,
+ E >
{
/// Point_Set associated type.
typedef S pset;
Index: mln/core/concept/image.hh
--- mln/core/concept/image.hh (revision 1025)
+++ mln/core/concept/image.hh (working copy)
@@ -33,6 +33,7 @@
*/
# include <mln/core/concept/point_set.hh>
+# include <mln/core/trait/all.hh>
namespace mln
@@ -52,8 +53,10 @@
typedef value;
typedef rvalue;
typedef lvalue;
+ typedef vset;
bool has_data() const;
+ const vset& values() const;
bool owns_(const psite& p) const;
const pset& domain() const;
@@ -138,4 +141,7 @@
} // end of namespace mln
+# include <mln/core/concept/fast_image.hh>
+
+
#endif // ! MLN_CORE_CONCEPT_IMAGE_HH
Index: mln/core/concept/value_set.hh
--- mln/core/concept/value_set.hh (revision 1025)
+++ mln/core/concept/value_set.hh (working copy)
@@ -48,7 +48,6 @@
{
/*
typedef value;
- typedef viter;
typedef fwd_viter;
typedef bkd_viter;
@@ -71,7 +70,6 @@
Value_Set<E>::Value_Set()
{
typedef mln_value(E) value;
- typedef mln_viter(E) viter;
typedef mln_fwd_viter(E) fwd_viter;
typedef mln_bkd_viter(E) bkd_viter;
Index: mln/core/concept/fast_image.hh
--- mln/core/concept/fast_image.hh (revision 1025)
+++ mln/core/concept/fast_image.hh (working copy)
@@ -33,7 +33,6 @@
*/
# include <mln/core/concept/image.hh>
-# include <mln/core/trait/pixter.hh>
namespace mln
@@ -55,6 +54,9 @@
point point_at_offset(unsigned o) const;
const value* buffer() const;
+
+ rvalue operator[](unsigned o) const;
+ lvalue operator[](unsigned o);
*/
protected:
@@ -69,7 +71,6 @@
{
typedef mln_point(E) point;
typedef mln_dpoint(E) dpoint;
- typedef mln_value(E) value;
typedef mln_fwd_pixter(E) fwd_pixter;
typedef mln_bkd_pixter(E) bkd_pixter;
@@ -80,11 +81,22 @@
m2 = 0;
point (E::*m3)(unsigned) const = & E::point_at_offset;
m3 = 0;
- const value* (E::*m4)() const = & E::buffer;
+ unsigned (E::*m4)() const = & E::border;
m4 = 0;
- unsigned (E::*m5)() const = & E::border;
+
+ typedef mln_value(E) value;
+
+ const value* (E::*m5)() const = & E::buffer;
m5 = 0;
+ typedef mln_rvalue(E) rvalue;
+ typedef mln_lvalue(E) lvalue;
+
+ rvalue (E::*m6)(unsigned) const = & E::operator[];
+ m6 = 0;
+ lvalue (E::*m7)(unsigned) = & E::operator[];
+ m7 = 0;
+
// FIXME: how to check that qixter are defined when W is unknown!
}
Index: mln/core/concept/doc/image.hh
--- mln/core/concept/doc/image.hh (revision 1025)
+++ mln/core/concept/doc/image.hh (working copy)
@@ -56,6 +56,11 @@
*/
typedef void lvalue;
+ /*! \brief Value set associated type.
+ * \invariant This type has to derive from mln::Value_Set.
+ */
+ typedef void vset;
+
/*! \brief Test if the image have been initialized.
*/
bool has_data() const;
@@ -73,13 +78,19 @@
*/
const pset& domain() const;
- /*! \brief Read access to the image value located at \p p.
+ /*! \brief Give the set of values of the image.
+ *
+ * \return A reference to the value set.
+ */
+ const vset& values() const;
+
+ /*! \brief Read-only access to the image value located at \p p.
*
* \param[in] p A point site.
*
* \pre The image has to own the site \p p.
*
- * \return The value at \p p.
+ * \return The value at \p p (not assignable).
*/
rvalue operator()(const psite& p) const;
@@ -89,7 +100,7 @@
*
* \pre The image has to own the site \p p.
*
- * \return The value at \p p.
+ * \return The value at \p p (assignable).
*/
lvalue operator()(const psite& p);
Index: mln/core/concept/doc/value_set.hh
--- mln/core/concept/doc/value_set.hh (revision 1025)
+++ mln/core/concept/doc/value_set.hh (working copy)
@@ -46,10 +46,6 @@
*/
typedef void value;
- /*! \brief Viter associated type.
- */
- typedef void viter;
-
/*! \brief Forward Viter associated type.
*/
typedef void fwd_viter;
Index: mln/core/concept/doc/fast_image.hh
--- mln/core/concept/doc/fast_image.hh (revision 1025)
+++ mln/core/concept/doc/fast_image.hh (working copy)
@@ -51,7 +51,7 @@
/*! \brief Give the offset corresponding to the delta-point \p
* dp.
*
- * \param[in] p A delta-point.
+ * \param[in] dp A delta-point.
*
* \pre The image has to be initialized.
*/
@@ -69,7 +69,7 @@
/*! \brief Give the point at offset \p o.
*
- * \param[in] p An offset.
+ * \param[in] o An offset.
*
* \pre The image has to be initialized.
* \pre o < ncells()
@@ -85,6 +85,27 @@
*/
const value* buffer() const;
+ /*! \brief Read-only access to the image value at offset \p o.
+ *
+ * \param[in] o An offset.
+ *
+ * \pre o < ncells()
+ *
+ * \return The value at \p o (not assignable).
+ */
+ rvalue operator[](unsigned o) const;
+
+
+ /*! \brief Read-write access to the image value at offset \p o.
+ *
+ * \param[in] o An offset.
+ *
+ * \pre o < ncells()
+ *
+ * \return The value at \p o (assignable).
+ */
+ lvalue operator[](unsigned o);
+
};
} // end of namespace mln::doc
Index: mln/core/tags.hh
--- mln/core/tags.hh (revision 1025)
+++ mln/core/tags.hh (working copy)
@@ -42,6 +42,7 @@
// FIXME: ...
+
} // end of namespace mln::core
} // end of namespace mln
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1025)
+++ mln/core/image2d_b.hh (working copy)
@@ -38,6 +38,7 @@
# include <mln/core/box2d.hh>
# include <mln/border/thickness.hh>
+# include <mln/value/set.hh>
# include <mln/fun/all.hh>
@@ -50,6 +51,23 @@
namespace mln
{
+ // Fwd decl.
+ template <typename T> struct image2d_b;
+
+
+ namespace trait
+ {
+
+ template <typename T>
+ struct is_fast< image2d_b<T> >
+ {
+ typedef metal::true_ ret;
+ };
+
+ } // end of mln::trait
+
+
+
/*! \brief Basic 2D image class.
*
* The parameter \c T is the type of pixel values. This image class
@@ -71,6 +89,7 @@
// end of warning
+
// FIXME:
// /// Forward pixel iterator associated to image2d
@@ -99,6 +118,9 @@
typedef image2d_b<U> ret;
};
+ /// Value_Set associated type.
+ typedef mln::value::set_<T> vset;
+
/// Constructor without argument.
image2d_b();
@@ -134,6 +156,9 @@
/// Test if this image has been initialized.
bool has_data() const;
+ /// Give the set of values of the image.
+ const vset& values() const;
+
/// Give the definition domain.
const box2d& domain() const;
@@ -143,12 +168,18 @@
/// Give the number of cells (points including border ones).
std::size_t ncells() const;
- /// Read-only access to the image value located at \p p.
+ /// Read-only access to the image value located at point \p p.
const T& operator()(const point2d& p) const;
- /// Read-write access to the image value located at \p p.
+ /// Read-write access to the image value located at point \p p.
T& operator()(const point2d& p);
+ /// Read-only access to the image value located at offset \p o.
+ const T& operator[](unsigned o) const;
+
+ /// Read-write access to the image value located at offset \p o.
+ T& operator[](unsigned o);
+
/// Read-only access to the image value located at (\p row, \p col).
const T& at(int row, int col) const;
@@ -279,6 +310,13 @@
}
template <typename T>
+ const typename image2d_b<T>::vset&
+ image2d_b<T>::values() const
+ {
+ return vset::the();
+ }
+
+ template <typename T>
const box2d&
image2d_b<T>::domain() const
{
@@ -328,6 +366,22 @@
template <typename T>
const T&
+ image2d_b<T>::operator[](unsigned o) const
+ {
+ mln_precondition(o < ncells());
+ return *(buffer_ + o);
+ }
+
+ template <typename T>
+ T&
+ image2d_b<T>::operator[](unsigned o)
+ {
+ mln_precondition(o < ncells());
+ return *(buffer_ + o);
+ }
+
+ template <typename T>
+ const T&
image2d_b<T>::at(int row, int col) const
{
mln_precondition(this->owns_(make::point2d(row, col)));
@@ -380,7 +434,6 @@
image2d_b<T>::point_at_offset(unsigned o) const
{
mln_precondition(o < ncells());
- mln_precondition(this->has_data());
point2d p = make::point2d(o / vb_.len(1) + vb_.min_row(),
o % vb_.len(1) + vb_.min_col());
mln_postcondition(& this->operator()(p) = this->buffer_ + o);
@@ -462,6 +515,12 @@
};
template <typename T>
+ struct fwd_pixter< const image2d_b<T> >
+ {
+ typedef fwd_pixter2d_b< const image2d_b<T> > ret;
+ };
+
+ template <typename T>
struct bkd_pixter< image2d_b<T> >
{
typedef internal::fixme ret;
Index: mln/metal/math.hh
--- mln/metal/math.hh (revision 0)
+++ mln/metal/math.hh (revision 0)
@@ -0,0 +1,63 @@
+// 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_METAL_MATH_HH
+# define MLN_METAL_MATH_HH
+
+/*! \file mln/metal/math.hh
+ *
+ * \brief Definition of some mathematical static functions.
+ */
+
+
+namespace mln
+{
+
+ namespace metal
+ {
+
+ // pow<x, n>
+
+ template <int x, unsigned n>
+ struct pow
+ {
+ enum { value = x * pow<x, n-1>::value };
+ };
+
+ template <int x>
+ struct pow< x, 0 >
+ {
+ enum { value = 1 };
+ };
+
+
+ } // end of namespace mln::metal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_METAL_MATH_HH
Index: mln/metal/bool.hh
--- mln/metal/bool.hh (revision 0)
+++ mln/metal/bool.hh (revision 0)
@@ -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.
+
+#ifndef MLN_METAL_BOOL_HH
+# define MLN_METAL_BOOL_HH
+
+/*! \file mln/metal/bool.hh
+ *
+ * \brief Definition of a Boolean value type.
+ */
+
+
+namespace mln
+{
+
+ namespace metal
+ {
+
+ // Fwd decls.
+ struct true_;
+ struct false_;
+
+
+
+ // FIXME: Doc!
+
+ template <bool b> struct bool_;
+
+ template <>
+ struct bool_< true >
+ {
+ typedef true_ type;
+ static const bool value = true;
+ };
+
+ template <>
+ struct bool_< false >
+ {
+ typedef false_ type;
+ static const bool value = false;
+ };
+
+
+ } // end of namespace mln::metal
+
+} // end of namespace mln
+
+
+# include <mln/metal/bexpr.hh>
+
+
+#endif // ! MLN_METAL_BOOL_HH
Index: mln/metal/none.hh
--- mln/metal/none.hh (revision 1025)
+++ mln/metal/none.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_CORE_METAL_NONE_HH
# define MLN_CORE_METAL_NONE_HH
-/*! \file mln/core/metal/none.hh
+/*! \file mln/metal/none.hh
*
* \brief Definition of a type that means "none".
*/
Index: mln/metal/bexpr.hh
--- mln/metal/bexpr.hh (revision 0)
+++ mln/metal/bexpr.hh (revision 0)
@@ -0,0 +1,102 @@
+// 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_METAL_BEXPR_HH
+# define MLN_METAL_BEXPR_HH
+
+/*! \file mln/metal/bexpr.hh
+ *
+ * \brief Definition of types for static Boolean expressions.
+ */
+
+# include <mln/metal/bool.hh>
+
+
+
+namespace mln
+{
+
+ namespace metal
+ {
+
+
+ /// "true" type.
+ struct true_
+ {
+ static void check();
+ typedef true_ eval;
+ enum { to_bool = true };
+ };
+
+
+ /// "false" type.
+ struct false_
+ {
+ typedef false_ eval;
+ enum { to_bool = false };
+ };
+
+
+ /// Negate type.
+ template <typename B>
+ struct not_ : bool_<( ! B::to_bool )>::type
+ {};
+
+
+ /// And type.
+ template <typename L, typename R>
+ struct and_ : bool_<( L::to_bool && R::to_bool )>::type
+ {};
+
+
+ /// Or type.
+ template <typename L, typename R>
+ struct or_ : bool_<( L::to_bool || R::to_bool )>::type
+ {};
+
+
+ /// Xor type.
+ template <typename L, typename R>
+ struct xor_ : bool_<( L::to_bool ^ R::to_bool )>::type
+ {};
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ void true_::check()
+ {
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::metal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_METAL_BOOL_HH
Index: mln/morpho/erosion.hh
--- mln/morpho/erosion.hh (revision 1025)
+++ mln/morpho/erosion.hh (working copy)
@@ -132,7 +132,7 @@
template <typename I, typename W, typename O>
void erosion_wrt_win(const Image<I>& input, const Window<W>& win, Image<O>& output)
{
- erosion_wrt_value(mln_kind(I)(), exact(input), exact(win), output);
+ erosion_wrt_value(mln_value_kind(I)(), exact(input), exact(win), output);
// |
// --> call stage 2: dispatch w.r.t. the value kind
}
Index: mln/level/fill.hh
--- mln/level/fill.hh (revision 1025)
+++ mln/level/fill.hh (working copy)
@@ -33,6 +33,8 @@
* \brief Fill an image, that is, set pixel values.
*/
+# include <cstring>
+
# include <mln/core/concept/image.hh>
# include <mln/core/concept/function.hh>
@@ -49,6 +51,8 @@
* \param[in] v The value to assign to all pixels.
*
* \pre \p ima has to be initialized.
+ *
+ * \todo Optimize when \p ima is large and sizeof(mln_value(I)) > 1.
*/
template <typename I>
void fill(Image<I>& ima, const mln_value(I)& v);
@@ -60,6 +64,8 @@
* \param[in] f The function.
*
* \pre \p ima has to be initialized.
+ *
+ * \todo Take benefit from quantization when possible.
*/
template <typename I, typename F>
void fill(Image<I>& ima, const Function_p2v<F>& f);
@@ -74,6 +80,8 @@
* " value f(const point& p) "
*
* \pre \p ima has to be initialized.
+ *
+ * \todo Take benefit from quantization when possible.
*/
template <typename I>
void fill(Image<I>& ima, mln_value(I) (*f)(const mln_point(I)& p));
@@ -103,28 +111,70 @@
* the one of \p data.
*
* \pre \p ima.domain <= \p data.domain.
+ *
+ * \todo Use memcpy when possible.
*/
template <typename I, typename J>
void fill(Image<I>& ima, const Image<J>& data);
+
# ifndef MLN_INCLUDE_ONLY
+ namespace impl
+ {
+
+
+ // fill_with_value
+
template <typename I>
- void fill(Image<I>& ima_,
- const mln_value(I)& value)
+ void fill_with_value(Image<I>& ima_, const mln_value(I)& value,
+ bool force_call = false)
{
+ force_call = false; // just to avoid warning ("unused param")
I& ima = exact(ima_);
- mln_precondition(ima.has_data());
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = value;
}
+ template <typename I>
+ void fill_with_value(Fast_Image<I>& ima_, const mln_value(I)& value)
+ {
+ I& ima = exact(ima_);
+ if (sizeof(mln_value(I)) = 1)
+ {
+ std::memset((void*)(ima.buffer()),
+ value,
+ sizeof(mln_value(I)) * ima.ncells());
+ }
+ else
+ {
+ // FIXME: Use memcpy on a chunck when image size is large!
+ fill_with_value(ima, value, true);
+ }
+ }
+
+
+ } // end of namespace mln::level::impl
+
+
+
+ // with: value
+
+ template <typename I>
+ void fill(Image<I>& ima, const mln_value(I)& value)
+ {
+ mln_precondition(exact(ima).has_data());
+ impl::fill_with_value(exact(ima), value);
+ }
+
+
+ // with: Function_p2v<F>
+
template <typename I, typename F>
- void fill(Image<I>& ima_,
- const Function_p2v<F>& f_)
+ void fill(Image<I>& ima_, const Function_p2v<F>& f_)
{
I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -134,6 +184,9 @@
ima(p) = f(p);
}
+
+ // with: value f(const point&)
+
template <typename I>
void fill(Image<I>& ima_,
mln_value(I) (*f)(const mln_point(I)& p))
@@ -145,9 +198,11 @@
ima(p) = f(p);
}
+
+ // with: value arr[N]
+
template <typename I, unsigned N>
- void fill(Image<I>& ima_,
- mln_value(I) (&arr)[N])
+ void fill(Image<I>& ima_, mln_value(I) (&arr)[N])
{
I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -158,9 +213,11 @@
ima(p) = arr[i++];
}
+
+ // with: Image<J>
+
template <typename I, typename J>
- void fill(Image<I>& ima_,
- const Image<J>& data_)
+ void fill(Image<I>& ima_, const Image<J>& data_)
{
I& ima = exact(ima_);
const J& data = exact(data_);
Index: mln/level/fast_median.hh
--- mln/level/fast_median.hh (revision 1025)
+++ mln/level/fast_median.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_LEVEL_FAST_MEDIAN_HH
# define MLN_LEVEL_FAST_MEDIAN_HH
-/*! \file mln/level/median.hh
+/*! \file mln/level/fast_median.hh
*
* \brief Fast Median filtering of an image.
*/
Index: mln/level/transform.hh
--- mln/level/transform.hh (revision 1025)
+++ mln/level/transform.hh (working copy)
@@ -36,6 +36,9 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/function.hh>
+# include <mln/value/set.hh>
+# include <mln/value/lut_vec.hh>
+
namespace mln
{
@@ -61,20 +64,67 @@
# ifndef MLN_INCLUDE_ONLY
+ namespace impl
+ {
+
template <typename I, typename F, typename O>
- void transform(const Image<I>& input_, const Function_v2v<F>& f_, Image<O>& output_)
+ void transform(metal::false_, // general case
+ const Image<I>& input_, const Function_v2v<F>& f_, Image<O>& output_)
{
const I& input = exact(input_);
const F& f = exact(f_);
O& output = exact(output_);
- mln_precondition(output.domain() >= input.domain());
-
mln_piter(I) p(input.domain());
for_all(p)
output(p) = f( input(p) );
}
+ template <typename I, typename F, typename O>
+ void transform(metal::true_, // low quantization
+ const Image<I>& input_, const Function_v2v<F>& f_, Image<O>& output_)
+ {
+ const I& input = exact(input_);
+ const F& f = exact(f_);
+ O& output = exact(output_);
+
+ value::lut_vec<mln_vset(I), mln_result(F)> lut(input.values(), f);
+ mln_piter(I) p(input.domain());
+ for_all(p)
+ output(p) = lut(input(p));
+ }
+
+// template <typename I, typename F, typename O>
+// void transform(metal::true_, // low quantization
+// const Fast_Image<I>& input_, const Function_v2v<F>& f_, Image<O>& output_)
+// {
+// const I& input = exact(input_);
+// const F& f = exact(f_);
+// O& output = exact(output_);
+
+// value::lut_vec<mln_vset(I), mln_result(F)> lut(input.values(), f);
+// mln_pixter(const I) pi(input); // FIXME
+// mln_pixter(O) po(output);
+// po.start();
+// for_all(pi)
+// {
+// *po = lut(*pi);
+// po.next();
+// }
+// }
+
+ } // end of namespace mln::level::impl
+
+
+ template <typename I, typename F, typename O>
+ void transform(const Image<I>& input, const Function_v2v<F>& f, Image<O>& output)
+ {
+ mln_precondition(exact(output).domain() >= exact(input).domain());
+ impl::transform(mln_is_lowq(I)(),
+ exact(input), exact(f), exact(output));
+ }
+
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::level
Index: mln/value/lut_vec.hh
--- mln/value/lut_vec.hh (revision 0)
+++ mln/value/lut_vec.hh (revision 0)
@@ -0,0 +1,165 @@
+// 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_VALUE_LUT_VEC_HH
+# define MLN_VALUE_LUT_VEC_HH
+
+/*! \file mln/value/lut_vec.hh
+ *
+ * \brief Define some basic lut_vecs of values from value types.
+ */
+
+# include <vector>
+
+# include <mln/core/concept/value_set.hh>
+# include <mln/core/concept/function.hh>
+# include <mln/value/props.hh>
+
+
+namespace mln
+{
+
+ namespace value
+ {
+
+ // Fwd decls.
+ template <typename S> struct fwd_viter_;
+ template <typename S> struct bkd_viter_;
+
+
+ /*! Class that defines FIXME
+ *
+ * \warning This is a multi-set!!!
+ * FIXME
+ *
+ */
+ template <typename S, typename T>
+ struct lut_vec : public Value_Set< lut_vec<S,T> >
+ {
+ /// Value associated type.
+ typedef T value;
+
+ /// Forward Viter associated type.
+ typedef fwd_viter_< lut_vec<S,T> > fwd_viter;
+
+ /// Backward Viter associated type.
+ typedef bkd_viter_< lut_vec<S,T> > bkd_viter;
+
+ /// Give the \p i-th value.
+ T operator[](std::size_t i) const;
+
+ /// Give the number of values.
+ std::size_t nvalues() const;
+
+ // Apply the look-up-table. FIXME: Doc!
+ T operator()(const mln_value(S)& val) const;
+
+ /// Test if \p v belongs to this set.
+ bool has(const value& v) const;
+
+ /// Give the index of value \p v in this set.
+ std::size_t index_of(const value& v) const;
+
+ /// Ctor. FIXME!
+ template <typename F>
+ lut_vec(const S& vset, const Function_v2v<F>& f);
+
+ protected:
+
+ const S& vset_;
+ std::vector<T> vec_;
+ unsigned n_;
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename S, typename T>
+ bool
+ lut_vec<S,T>::has(const T&) const
+ {
+ mln_invariant(0); // FIXME
+ return false;
+ }
+
+ template <typename S, typename T>
+ std::size_t
+ lut_vec<S,T>::index_of(const T& v) const
+ {
+ mln_invariant(0); // FIXME
+ return 0;
+ }
+
+ template <typename S, typename T>
+ template <typename F>
+ lut_vec<S,T>::lut_vec(const S& vset, const Function_v2v<F>& f)
+ : vset_(vset)
+ {
+ const F& f_ = exact(f);
+ n_ = vset.nvalues();
+ vec_.reserve(n_);
+ for (unsigned i = 0; i < n_; ++i)
+ vec_[i] = f_(vset[i]);
+ }
+
+ template <typename S, typename T>
+ T
+ lut_vec<S,T>::operator()(const mln_value(S)& val) const
+ {
+ unsigned i = vset_.index_of(val);
+ mln_precondition(i < n_);
+ return vec_[vset_.index_of(val)];
+ }
+
+ template <typename S, typename T>
+ T
+ lut_vec<S,T>::operator[](std::size_t i) const
+ {
+ mln_precondition(i < nvalues());
+ return vec_[i];
+ }
+
+ template <typename S, typename T>
+ std::size_t
+ lut_vec<S,T>::nvalues() const
+ {
+ return vec_.size();
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::value
+
+
+} // end of namespace mln
+
+
+# include <mln/value/viter.hh>
+
+
+#endif // ! MLN_VALUE_LUT_VEC_HH
Index: mln/value/props.hh
--- mln/value/props.hh (revision 1025)
+++ mln/value/props.hh (working copy)
@@ -41,19 +41,19 @@
/// Get the minimum value of type \c T.
-# define mln_min(T) mln::value::props<T>::min()
+# define mln_min(T) mln::value::props< T >::min
/// Get the maximum value of type \c T.
-# define mln_max(T) mln::value::props<T>::max()
+# define mln_max(T) mln::value::props< T >::max
/// Get the number of values for value type \c T.
-# define mln_card(T) mln::value::props<T>::card()
+# define mln_card(T) mln::value::props< T >::card
-/// Get the kind of the value type of image \c I.
-# define mln_kind(I) typename mln::value::props< mln_value(I) >::kind
+/// Get the kind of value type \c T.
+# define mln_kind(T) typename mln::value::props< T >::kind
@@ -71,119 +71,124 @@
struct props
{
/// Minimum value for type \c T.
- static T min();
+ static const T min;
/// Maximum value for type \c T.
- static T max();
+ static const T max;
/// Number of values for type \c T.
- static std::size_t card();
+ static const std::size_t card;
};
-# ifndef MLN_INCLUDE_ONLY
+
+ // bool
template <>
struct props<bool>
{
- static bool min() { return false; }
- static bool max() { return true; }
- static std::size_t card() { return 2; }
+ static const bool min = false;
+ static const bool max = true;
+ static const std::size_t card = 2;
typedef binary_kind kind;
};
+
// integers
template <>
struct props<unsigned char>
{
- static unsigned char min() { return 0; }
- static unsigned char max() { return 255; }
- static std::size_t card() { return 256; }
+ static const unsigned char min = 0;
+ static const unsigned char max = 255;
+ static const std::size_t card = 256;
typedef data_kind kind;
};
template <>
struct props<signed char>
{
- static signed char min() { return -128; }
- static signed char max() { return 127; }
- static std::size_t card() { return 256; }
+ static const signed char min = -128;
+ static const signed char max = 127;
+ static const std::size_t card = 256;
typedef data_kind kind;
};
template <>
struct props<unsigned short>
{
- static unsigned short min() { return 0; }
- static unsigned short max() { return 65535; }
- static std::size_t card() { return 65536; }
+ static const unsigned short min = 0;
+ static const unsigned short max = 65535;
+ static const std::size_t card = 65536;
typedef data_kind kind;
};
template <>
struct props<signed short>
{
- static signed short min() { return -32768; }
- static signed short max() { return 32767; }
- static std::size_t card() { return 655356; }
+ static const signed short min = -32768;
+ static const signed short max = 32767;
+ static const std::size_t card = 655356;
typedef data_kind kind;
};
template <>
struct props<unsigned int>
{
- static unsigned int min() { return 0; }
- static unsigned int max() { return UINT_MAX; }
- static std::size_t card() { return std::size_t(UINT_MAX) + 1; }
+ static const unsigned int min = 0;
+ static const unsigned int max = UINT_MAX;
typedef data_kind kind;
+ static const std::size_t card = 0;
};
template <>
struct props<signed int>
{
- static signed int min() { return INT_MIN; }
- static signed int max() { return INT_MAX; }
- static std::size_t card() { return std::size_t(UINT_MAX) + 1; }
+ static const signed int min = INT_MIN;
+ static const signed int max = INT_MAX;
typedef data_kind kind;
+ static const std::size_t card = 0;
};
template <>
struct props<unsigned long int>
{
- static unsigned long int min() { return 0; }
- static unsigned long int max() { return ULONG_MAX; }
+ static const unsigned long int min = 0;
+ static const unsigned long int max = ULONG_MAX;
typedef data_kind kind;
+ static const std::size_t card = 0;
};
template <>
struct props<signed long int>
{
- static signed long int min() { return LONG_MIN; }
- static signed long int max() { return LONG_MAX; }
+ static const signed long int min = LONG_MIN;
+ static const signed long int max = LONG_MAX;
typedef data_kind kind;
+ static const std::size_t card = 0;
};
+
// floating
template <>
struct props<float>
{
- static float min() { return FLT_MIN; }
- static float max() { return FLT_MAX; }
+ static const float min() { return FLT_MIN; }
+ static const float max() { return FLT_MAX; }
typedef data_kind kind;
+ static const std::size_t card = 0;
};
template <>
struct props<double>
{
- static double min() { return DBL_MIN; }
- static double max() { return DBL_MAX; }
+ static const double min() { return DBL_MIN; }
+ static const double max() { return DBL_MAX; }
typedef data_kind kind;
+ static const std::size_t card = 0;
};
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln::value
} // end of namespace mln
Index: mln/value/kind.hh
--- mln/value/kind.hh (revision 1025)
+++ mln/value/kind.hh (working copy)
@@ -28,7 +28,7 @@
#ifndef MLN_VALUE_KIND_HH
# define MLN_VALUE_KIND_HH
-/*! \file mln/value/tags.hh
+/*! \file mln/value/kind.hh
*
* \brief Define the set of kinds of value.
*/
Index: mln/value/set.hh
--- mln/value/set.hh (revision 1025)
+++ mln/value/set.hh (working copy)
@@ -64,9 +64,6 @@
/// Backward Viter associated type.
typedef bkd_viter_< set_<T> > bkd_viter;
- /// Viter associated type.
- typedef fwd_viter viter;
-
/// Test if \p v belongs to this set: always true!
bool has(const T& v) const;
@@ -129,14 +126,6 @@
} // end of namespace mln::value
-
- // FIXME: Turn definitions into objects!
- typedef value::set_<bool> Booleans;
- typedef value::set_<int> integers;
- typedef value::set_<unsigned> naturals;
-
-
-
} // end of namespace mln
Index: mln/value/int_u.hh
--- mln/value/int_u.hh (revision 1025)
+++ mln/value/int_u.hh (working copy)
@@ -34,6 +34,7 @@
*/
# include <mln/core/concept/value.hh>
+# include <mln/metal/math.hh>
# include <mln/value/internal/value_like.hh>
# include <mln/value/props.hh>
@@ -83,6 +84,8 @@
template <unsigned n>
struct props< int_u_<n> > : public props< typename internal::encoding_<n>::ret >
{
+ static const unsigned nbits = n;
+ static const std::size_t card = metal::pow<2, n>::value;
};
1
0