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
October 2007
- 8 participants
- 229 discussions
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Add float_f value.
* mln/value/float01_f.hh: New.
* tests/value_float01_f.cc: New.
---
mln/value/float01_f.hh | 129 +++++++++++++++++++++++++++++++++++++++++++++++
tests/value_float01_f.cc | 39 ++++++++++++++
2 files changed, 168 insertions(+)
Index: trunk/milena/tests/value_float01_f.cc
===================================================================
--- trunk/milena/tests/value_float01_f.cc (revision 0)
+++ trunk/milena/tests/value_float01_f.cc (revision 1258)
@@ -0,0 +1,39 @@
+// 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.
+
+#include <iostream>
+#include <mln/value/float01_f.hh>
+
+int main()
+{
+ using typename mln::value::float01_f;
+ float01_f x = 0.5;
+
+ std::cout << x + 21.25 << std::endl;
+
+ x = x + 34;
+}
Index: trunk/milena/mln/value/float01_f.hh
===================================================================
--- trunk/milena/mln/value/float01_f.hh (revision 0)
+++ trunk/milena/mln/value/float01_f.hh (revision 1258)
@@ -0,0 +1,129 @@
+// 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
+// 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_VALUE_FLOAT01_F_HH
+# define MLN_CORE_VALUE_FLOAT01_F_HH
+
+# include <iostream>
+# include <mln/value/internal/value_like.hh>
+# include <mln/value/concept/floating.hh>
+# include <mln/value/props.hh>
+
+namespace mln
+{
+
+ namespace value
+ {
+
+ /// Fwd decl.
+ class float01;
+
+
+ /// General float01-level class on n bits.
+ class float01_f
+ : public Floating< float01_f >,
+ public internal::value_like_< float,
+ float01_f >
+ {
+ public:
+
+ /// Ctor.
+ float01_f();
+
+ /// Ctor.
+ float01_f(const float val);
+
+ /// Access to std type.
+ float value() const;
+
+ /// Op encoding_t.
+ operator float() const;
+
+ float01_f& operator=(const float val);
+ /// Op==.
+ // bool operator==(const float01_f& rhs) const;
+
+ protected:
+ float val_;
+ };
+
+ template <>
+ struct props< float01_f >
+ {
+ static const std::size_t card_ = 0;
+ static const float min() { return 0; }
+ static const float max() { return 1; }
+ //static const unsigned nbits = n;
+ typedef trait::kind::data kind;
+ typedef float sum;
+ typedef float interop;
+ };
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // Float01_F.
+
+ float01_f::float01_f()
+ : val_(0)
+ {
+ }
+
+ float01_f::float01_f(const float val)
+ : val_(val)
+ {
+ mln_precondition(val >= 0);
+ mln_precondition(val <= 1);
+ }
+
+ float
+ float01_f::value() const
+ {
+ return (val_);
+ }
+
+ float01_f&
+ float01_f::operator=(const float val)
+ {
+ mln_precondition(val >= 0);
+ mln_precondition(val <= 1);
+ this->val_ = val;
+ return *this;
+ }
+
+ float01_f::operator float() const
+ {
+ return val_;
+ }
+
+# endif
+
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+#endif // ! MLN_CORE_VALUE_FLOAT01_F_HH
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Fix in rgb.
* mln/value/rgb.hh: Fix.
---
rgb.hh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: trunk/milena/mln/value/rgb.hh
===================================================================
--- trunk/milena/mln/value/rgb.hh (revision 1256)
+++ trunk/milena/mln/value/rgb.hh (revision 1257)
@@ -59,7 +59,7 @@
public:
/// Encoding associated type.
- typedef int_u<n> enc[3];
+ typedef int_u<n> enc;
/// Equivalent associated type.
typedef int_u<n> equiv[3];
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Add scalar() to "scalarise" values.
* mln/metal/vec.hh: Add equiv and enc typedef.
* mln/value/concept/floating.hh,
* mln/value/concept/integer.hh,
* mln/value/concept/scalar.hh,
* mln/value/concept/structured.hh,
* mln/value/concept/symbolic.hh,
* mln/value/concept/vectorial.hh: Fix include order.
* mln/value/rgb.hh: Fix enc typedef.
---
metal/vec.hh | 3 +++
value/concept/floating.hh | 6 +++---
value/concept/integer.hh | 6 +++---
value/concept/scalar.hh | 9 ++++-----
value/concept/structured.hh | 9 ++++-----
value/concept/symbolic.hh | 9 ++++-----
value/concept/vectorial.hh | 9 ++++-----
value/rgb.hh | 2 +-
8 files changed, 26 insertions(+), 27 deletions(-)
Index: trunk/milena/mln/metal/vec.hh
===================================================================
--- trunk/milena/mln/metal/vec.hh (revision 1255)
+++ trunk/milena/mln/metal/vec.hh (revision 1256)
@@ -130,6 +130,9 @@
public:
+ typedef T equiv[n];
+ typedef T enc[n];
+
typedef T value_type;
enum { dim = n };
Index: trunk/milena/mln/value/concept/symbolic.hh
===================================================================
--- trunk/milena/mln/value/concept/symbolic.hh (revision 1255)
+++ trunk/milena/mln/value/concept/symbolic.hh (revision 1256)
@@ -25,16 +25,14 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_SYMBOLIC_HH
-# define MLN_VALUE_SYMBOLIC_HH
+#ifndef MLN_VALUE_CONCEPT_VALUE_SYMBOLIC_HH
+# define MLN_VALUE_CONCEPT_VALUE_SYMBOLIC_HH
/*! \file mln/value/symbolic.hh
*
* \brief Define a generic class for symbolic values.
*/
-# include <mln/core/concept/value.hh>
-
namespace mln
{
@@ -70,5 +68,6 @@
} // end of namespace mln
+# include <mln/core/concept/value.hh>
-#endif // ! MLN_VALUE_SYMBOLIC_HH
+#endif // ! MLN_VALUE_CONCEPT_VALUE_SYMBOLIC_HH
Index: trunk/milena/mln/value/concept/floating.hh
===================================================================
--- trunk/milena/mln/value/concept/floating.hh (revision 1255)
+++ trunk/milena/mln/value/concept/floating.hh (revision 1256)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_FLOATING_HH
-# define MLN_VALUE_FLOATING_HH
+#ifndef MLN_VALUE_CONCEPT_VALUE_FLOATING_HH
+# define MLN_VALUE_CONCEPT_VALUE_FLOATING_HH
/*! \file mln/value/floating.hh
*
@@ -66,4 +66,4 @@
} // end of namespace mln
-#endif // ! MLN_VALUE_FLOATING_HH
+#endif // ! MLN_VALUE_CONCEPT_VALUE_FLOATING_HH
Index: trunk/milena/mln/value/concept/structured.hh
===================================================================
--- trunk/milena/mln/value/concept/structured.hh (revision 1255)
+++ trunk/milena/mln/value/concept/structured.hh (revision 1256)
@@ -25,16 +25,14 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_STRUCTURED_HH
-# define MLN_VALUE_STRUCTURED_HH
+#ifndef MLN_VALUE_CONCEPT_VALUE_STRUCTURED_HH
+# define MLN_VALUE_CONCEPT_VALUE_STRUCTURED_HH
/*! \file mln/value/structured.hh
*
* \brief Define a generic class for structured values.
*/
-# include <mln/core/concept/value.hh>
-
namespace mln
{
@@ -69,5 +67,6 @@
} // end of namespace mln
+# include <mln/core/concept/value.hh>
-#endif // ! MLN_VALUE_STRUCTURED_HH
+#endif // ! MLN_VALUE_CONCEPT_VALUE_STRUCTURED_HH
Index: trunk/milena/mln/value/concept/scalar.hh
===================================================================
--- trunk/milena/mln/value/concept/scalar.hh (revision 1255)
+++ trunk/milena/mln/value/concept/scalar.hh (revision 1256)
@@ -25,16 +25,14 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_SCALAR_HH
-# define MLN_VALUE_SCALAR_HH
+#ifndef MLN_VALUE_CONCEPT_VALUE_SCALAR_HH
+# define MLN_VALUE_CONCEPT_VALUE_SCALAR_HH
/*! \file mln/value/scalar.hh
*
* \brief Define a generic class for scalar values.
*/
-# include <mln/core/concept/value.hh>
-
namespace mln
{
@@ -68,5 +66,6 @@
} // end of namespace mln
+# include <mln/core/concept/value.hh>
-#endif // ! MLN_VALUE_SCALAR_HH
+#endif // ! MLN_VALUE_CONCEPT_VALUE_SCALAR_HH
Index: trunk/milena/mln/value/concept/vectorial.hh
===================================================================
--- trunk/milena/mln/value/concept/vectorial.hh (revision 1255)
+++ trunk/milena/mln/value/concept/vectorial.hh (revision 1256)
@@ -25,16 +25,14 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_VECTORIEL_HH
-# define MLN_VALUE_VECTORIEL_HH
+#ifndef MLN_VALUE_CONCEPT_VALUE_VECTORIEL_HH
+# define MLN_VALUE_CONCEPT_VALUE_VECTORIEL_HH
/*! \file mln/value/vectorial.hh
*
* \brief Define a generic class for vectorial values.
*/
-# include <mln/core/concept/value.hh>
-
namespace mln
{
@@ -70,5 +68,6 @@
} // end of namespace mln
+# include <mln/core/concept/value.hh>
-#endif // ! MLN_VALUE_VECTORIEL_HH
+#endif // ! MLN_VALUE_CONCEPT_VALUE_VECTORIEL_HH
Index: trunk/milena/mln/value/concept/integer.hh
===================================================================
--- trunk/milena/mln/value/concept/integer.hh (revision 1255)
+++ trunk/milena/mln/value/concept/integer.hh (revision 1256)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_INTEGER_HH
-# define MLN_VALUE_INTEGER_HH
+#ifndef MLN_VALUE_CONCEPT_VALUE_INTEGER_HH
+# define MLN_VALUE_CONCEPT_VALUE_INTEGER_HH
/*! \file mln/value/integer.hh
*
@@ -65,4 +65,4 @@
} // end of namespace mln
-#endif // ! MLN_VALUE_INTEGER_HH
+#endif // ! MLN_VALUE_CONCEPT_VALUE_INTEGER_HH
Index: trunk/milena/mln/value/rgb.hh
===================================================================
--- trunk/milena/mln/value/rgb.hh (revision 1255)
+++ trunk/milena/mln/value/rgb.hh (revision 1256)
@@ -59,7 +59,7 @@
public:
/// Encoding associated type.
- typedef int_u<n> enc;
+ typedef int_u<n> enc[3];
/// Equivalent associated type.
typedef int_u<n> equiv[3];
1
0
05 Oct '07
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Prepare the 'fetch impl / check impl' image mechanism.
* mln/core/internal/image_base.hh (image_checked_): New.
(image_impled_): New.
(image_base_): Change inheritance to image_impled_.
The plug to select_image_concept_---soon obsolete---is
now handled by image_checked_.
(super_): Remove.
* mln/core/internal/check: New directory.
* mln/core/internal/check/image_all.hh: New.
* mln/core/concept/fastest_image.hh: Move static checks into...
* mln/core/internal/check/image_fastest.hh: ...this new file.
* mln/core/concept/image.hh: Include extra metal files.
concept/fastest_image.hh | 41 --------------------
concept/image.hh | 3 +
internal/check/image_all.hh | 68 +++++++++++++++++++++++++++++++++
internal/check/image_fastest.hh | 82 ++++++++++++----------------------------
internal/image_base.hh | 36 +++++++++++++----
5 files changed, 125 insertions(+), 105 deletions(-)
Index: mln/core/internal/image_base.hh
--- mln/core/internal/image_base.hh (revision 1254)
+++ mln/core/internal/image_base.hh (working copy)
@@ -35,8 +35,8 @@
# include <mln/core/concept/image.hh>
# include <mln/core/grids.hh>
+# include <mln/core/internal/check/image_all.hh>
# include <mln/util/tracked_ptr.hh>
-# include <mln/metal/equal.hh>
@@ -97,6 +97,29 @@
+ template <typename E>
+ struct image_checked_
+ :
+ public check::image_all_<E>,
+
+ // FIXME: first check impl w.r.t. properties, then:
+ public select_image_concept_< typename mlc_equal(mln_trait_image_speed(E),
+ trait::speed::fastest)::eval,
+ E > // FIXME: Change to Image<E>
+ {
+ };
+
+
+ template <typename E>
+ struct image_impled_
+ :
+ // FIXME: first fetch default impl w.r.t. properties, then:
+ image_checked_<E>
+ {
+ };
+
+
+
/*! \brief A base class for images.
*
* Parameter \p S is a point set type.
@@ -105,10 +128,9 @@
*/
template <typename S, typename E>
struct image_base_
+ :
+ public image_impled_<E>
- : public select_image_concept_< typename mlc_equal(mln_trait_image_speed(E),
- trait::speed::fastest)::eval,
- E >
{
/// Point_Set associated type.
typedef S pset;
@@ -171,10 +193,6 @@
// Internal data, sharable by several images.
util::tracked_ptr< internal::data_<E> > data_;
-
- typedef select_image_concept_< typename mlc_equal(mln_trait_image_speed(E),
- trait::speed::fastest)::eval,
- E > super_;
};
@@ -188,7 +206,7 @@
template <typename S, typename E>
image_base_<S,E>::image_base_(const image_base_& rhs)
- : super_()
+ : image_impled_<E>()
{
mln_precondition(exact(rhs).has_data()); // FIXME: Is-it too restrictive?
this->data_ = rhs.data_;
Index: mln/core/internal/check/image_all.hh
--- mln/core/internal/check/image_all.hh (revision 0)
+++ mln/core/internal/check/image_all.hh (revision 0)
@@ -0,0 +1,68 @@
+// 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_INTERNAL_CHECK_IMAGE_ALL_HH
+# define MLN_CORE_INTERNAL_CHECK_IMAGE_ALL_HH
+
+/*! \file mln/core/internal/check/image_all.hh
+ *
+ * \brief File that includes all image-related internal checks.
+ */
+
+
+# include <mln/core/internal/check/image_fastest.hh>
+// ...
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+ /*! Namespace of all image-related internal checks.
+ */
+ namespace check
+ {
+
+ template <typename E>
+ struct image_all_
+ :
+ public image_fastest_< E, typename mlc_equal(mln_trait_image_speed(E),
+ trait::speed::fastest)::eval >
+ // , ...
+ {
+ };
+
+ } // end of namespace mln::internal::check
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_CHECK_IMAGE_ALL_HH
Index: mln/core/internal/check/image_fastest.hh
--- mln/core/internal/check/image_fastest.hh (revision 0)
+++ mln/core/internal/check/image_fastest.hh (working copy)
@@ -25,83 +25,47 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_CONCEPT_FASTEST_IMAGE_HH
-# define MLN_CORE_CONCEPT_FASTEST_IMAGE_HH
+#ifndef MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
+# define MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
/*! \file mln/core/concept/fastest_image.hh
* \brief Definition of the concept of mln::Fastest_Image.
*/
-# include <mln/core/concept/image.hh>
-# include <mln/core/concept/generalized_point.hh>
-# include <mln/core/trait/qlf_value.hh>
-
namespace mln
{
- /*! \brief Base class for implementation of fastest image classes.
+ namespace internal
+ {
+
+ namespace check
+ {
+
+ /*! \brief FIXME
*
* \see mln::doc::Fastest_Image for a complete documentation of this
* class contents.
*/
- template <typename E>
- struct Fastest_Image : public Image<E>
+ template < typename E, typename B = metal::true_ >
+ struct image_fastest_
{
- /*
- unsigned border();
-
- int offset(const dpoint& dp) const; // FIXME: std::ptr_diff_t?
- 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);
-
- std::size_t ncells() const;
- */
+ protected:
+ image_fastest_();
+ };
- /*! \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_at(const Generalized_Point<P>& p) const;
-
- protected:
- Fastest_Image();
+ template <typename E>
+ struct image_fastest_< E, metal::false_ >
+ {
+ // Nothing.
};
# ifndef MLN_INCLUDE_ONLY
- template <typename E>
- template <typename P>
- unsigned // FIXME: std::size_t?
- Fastest_Image<E>::offset_at(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>
- Fastest_Image<E>::Fastest_Image()
+ template <typename E, typename B>
+ image_fastest_<E,B>::image_fastest_()
{
typedef mln_point(E) point;
typedef mln_dpoint(E) dpoint;
@@ -139,7 +103,11 @@
# endif // ! MLN_INCLUDE_ONLY
+ } // end of namespace mln::internal::check
+
+ } // end of namespace mln::internal
+
} // end of namespace mln
-#endif // ! MLN_CORE_CONCEPT_FASTEST_IMAGE_HH
+#endif // ! MLN_CORE_INTERNAL_CHECK_IMAGE_FASTEST_HH
Index: mln/core/concept/image.hh
--- mln/core/concept/image.hh (revision 1254)
+++ mln/core/concept/image.hh (working copy)
@@ -36,10 +36,13 @@
# include <mln/core/concept/mesh.hh>
# include <mln/core/trait/all.hh> // FIXME: Move out of core!
+# include <mln/core/macros.hh>
# include <mln/trait/concrete.hh> // FIXME: Should be in all.hh!
# include <mln/trait/images.hh>
# include <mln/metal/is_a.hh>
+# include <mln/metal/equal.hh>
+
# include <mln/tag/init.hh>
Index: mln/core/concept/fastest_image.hh
--- mln/core/concept/fastest_image.hh (revision 1254)
+++ mln/core/concept/fastest_image.hh (working copy)
@@ -77,13 +77,13 @@
unsigned
offset_at(const Generalized_Point<P>& p) const;
- protected:
- Fastest_Image();
};
# ifndef MLN_INCLUDE_ONLY
+ // FIXME: Move in internal/image/impl...
+
template <typename E>
template <typename P>
unsigned // FIXME: std::size_t?
@@ -100,43 +100,6 @@
return o;
}
- template <typename E>
- Fastest_Image<E>::Fastest_Image()
- {
- typedef mln_point(E) point;
- typedef mln_dpoint(E) dpoint;
-
- typedef mln_fwd_pixter(E) fwd_pixter;
- typedef mln_bkd_pixter(E) bkd_pixter;
-
- int (E::*m1)(const dpoint&) const = & E::offset;
- m1 = 0;
- point (E::*m2)(unsigned) const = & E::point_at_offset;
- m2 = 0;
- unsigned (E::*m3)() const = & E::border;
- m3 = 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;
-
- 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;
-
- std::size_t (E::*m8)() const = & E::ncells;
- m8 = 0;
-
- // FIXME: how to check that qixter are defined when W is unknown!
- }
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Dispatch by speed traits (was Fastest_Image).
* mln/arith/min.hh,
* mln/arith/minus.hh,
* mln/arith/plus.hh,
* mln/arith/revert.hh,
* mln/border/duplicate.hh,
* mln/border/fill.hh,
* mln/border/get.hh,
* mln/border/mirror.hh,
* mln/border/resize.hh,
* mln/debug/iota.hh,
* mln/debug/println_with_border.hh,
* mln/histo/compute.hh,
* mln/io/internal/pnm/save.hh,
* mln/labeling/level.hh,
* mln/level/apply.hh,
* mln/level/assign.hh,
* mln/level/fill.hh,
* mln/level/memset_.hh,
* mln/level/take.hh,
* mln/linear/convolve.hh,
* mln/linear/local/convolve.hh,
* mln/logical/and.hh,
* mln/logical/and_not.hh,
* mln/logical/not.hh,
* mln/logical/or.hh,
* mln/test/predicate.hh,
* tests/labeling_level_fast.cc: New dispatch system.
Fix (was identical as hline2d)
* mln/core/win/vline2d.hh: Fix.
---
mln/arith/min.hh | 38 +++++++++++++++++-------------
mln/arith/minus.hh | 38 +++++++++++++++++-------------
mln/arith/plus.hh | 48 +++++++++++++++++++++++----------------
mln/arith/revert.hh | 18 ++++++++------
mln/border/duplicate.hh | 15 +++++-------
mln/border/fill.hh | 21 ++++++++---------
mln/border/get.hh | 10 ++++----
mln/border/mirror.hh | 7 ++++-
mln/border/resize.hh | 1
mln/core/win/vline2d.hh | 4 +--
mln/debug/iota.hh | 8 ++----
mln/debug/println_with_border.hh | 19 +++++++--------
mln/histo/compute.hh | 8 ++----
mln/io/internal/pnm/save.hh | 31 +++++++++++++++++--------
mln/labeling/level.hh | 34 +++++++++------------------
mln/level/apply.hh | 9 +++----
mln/level/assign.hh | 13 ++++------
mln/level/fill.hh | 11 ++++----
mln/level/memset_.hh | 7 +++--
mln/level/take.hh | 9 +++----
mln/linear/convolve.hh | 18 +++++++-------
mln/linear/local/convolve.hh | 9 +++----
mln/logical/and.hh | 25 ++++++++++++--------
mln/logical/and_not.hh | 25 ++++++++++++--------
mln/logical/not.hh | 18 ++++++++------
mln/logical/or.hh | 25 ++++++++++++--------
mln/test/predicate.hh | 7 +++--
tests/labeling_level_fast.cc | 2 -
28 files changed, 256 insertions(+), 222 deletions(-)
Index: trunk/milena/tests/labeling_level_fast.cc
===================================================================
--- trunk/milena/tests/labeling_level_fast.cc (revision 1253)
+++ trunk/milena/tests/labeling_level_fast.cc (revision 1254)
@@ -56,7 +56,7 @@
unsigned n;
image2d_b<value::int_u8> out(i1.domain(), border);
- labeling::level_fast(i1, 2, c4(), out, n);
+ labeling::level(i1, 2, c4(), out, n);
std::cout << "n = " << n << std::endl;
debug::println(out);
Index: trunk/milena/mln/histo/compute.hh
===================================================================
--- trunk/milena/mln/histo/compute.hh (revision 1253)
+++ trunk/milena/mln/histo/compute.hh (revision 1254)
@@ -54,9 +54,8 @@
{
template <typename I>
- data<mln_vset(I)> compute(const Image<I>& input_)
+ data<mln_vset(I)> compute(mln::trait::speed::any, const I& input)
{
- const I& input = exact(input_);
data<mln_vset(I)> h(input.values());
mln_piter(I) p(input.domain());
for_all(p)
@@ -65,9 +64,8 @@
}
template <typename I>
- data<mln_vset(I)> compute(const Fastest_Image<I>& input_)
+ data<mln_vset(I)> compute(mln::trait::speed::fastest, const I& input)
{
- const I& input = exact(input_);
data<mln_vset(I)> h(input.values());
mln_pixter(const I) p(input);
for_all(p)
@@ -82,7 +80,7 @@
data<mln_vset(I)> compute(const Image<I>& input)
{
mln_precondition(exact(input).has_data());
- return impl::compute(exact(input));
+ return impl::compute(mln_trait_image_speed(I)(), exact(input));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/debug/iota.hh
===================================================================
--- trunk/milena/mln/debug/iota.hh (revision 1253)
+++ trunk/milena/mln/debug/iota.hh (revision 1254)
@@ -53,20 +53,18 @@
{
template <typename I>
- void iota(Image<I>& input_)
+ void iota(mln::trait::speed::any, I& input)
{
unsigned i = 0;
- I& input = exact(input_);
mln_piter(I) p(input.domain());
for_all(p)
input(p) = ++i;
}
template <typename I>
- void iota(Fastest_Image<I>& input_)
+ void iota(mln::trait::speed::fastest, I& input)
{
unsigned i = 0;
- I& input = exact(input_);
mln_pixter(I) p(input);
for_all(p)
p.val() = ++i;
@@ -79,7 +77,7 @@
void iota(Image<I>& input)
{
mln_precondition(exact(input).has_data());
- impl::iota(exact(input));
+ impl::iota(mln_trait_image_speed(I)(), exact(input));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/debug/println_with_border.hh
===================================================================
--- trunk/milena/mln/debug/println_with_border.hh (revision 1253)
+++ trunk/milena/mln/debug/println_with_border.hh (revision 1254)
@@ -48,7 +48,7 @@
/// Print the image \p input on the standard output.
template <typename I>
- void println_with_border(const Fastest_Image<I>& input);
+ void println_with_border(const Image<I>& input);
# ifndef MLN_INCLUDE_ONLY
@@ -58,9 +58,8 @@
// generic version
template <typename S, typename I>
- void println_with_border(const S&, const Fastest_Image<I>& input_)
+ void println_with_border(const S&, const I& input)
{
- const I& input = exact(input_);
for (size_t i = 0; i < input.ncells(); i++)
std::cout << format( input.buffer()[i] ) << ' ';
std::cout << std::endl;
@@ -68,9 +67,8 @@
// 2D version
template <typename I>
- void println_with_border(const box2d& b, const Fastest_Image<I>& input_)
+ void println_with_border(const box2d& b, const I& input)
{
- const I& input = exact(input_);
const std::size_t ncols = b.ncols() + 2 * input.border();
for (size_t i = 0; i < input.ncells(); i++)
{
@@ -83,15 +81,14 @@
// 3D version
template <typename I>
- void println_with_border(const box3d& b, const Fastest_Image<I>& input_)
+ void println_with_border(const box3d& b, const I& input)
{
- const I& ima = exact(input_);
typedef mln_point(I) P;
std::size_t len_s = b.len(P::dim - 3);
std::size_t len_r = b.len(P::dim - 2);
std::size_t len_c = b.len(P::dim - 1);
- std::size_t border = ima.border ();
+ std::size_t border = input.border ();
std::size_t real_len_s = len_s + 2 * border;
std::size_t real_len_r = len_r + 2 * border;
std::size_t real_len_c = len_c + 2 * border;
@@ -101,7 +98,7 @@
for (std::size_t j = 0; j < real_len_r; ++j)
{
for (std::size_t i = 0; i < real_len_c; ++i)
- std::cout << format(ima[k * (real_len_r * real_len_c) + j * real_len_c + i])
+ std::cout << format(input[k * (real_len_r * real_len_c) + j * real_len_c + i])
<< ' ';
std::cout << std::endl;
}
@@ -115,8 +112,10 @@
// facade
template <typename I>
- void println_with_border(const Fastest_Image<I>& input)
+ void println_with_border(const Image<I>& input)
{
+ mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
+
impl::println_with_border(exact(input).bbox(), exact(input));
}
Index: trunk/milena/mln/core/win/vline2d.hh
===================================================================
--- trunk/milena/mln/core/win/vline2d.hh (revision 1253)
+++ trunk/milena/mln/core/win/vline2d.hh (revision 1254)
@@ -52,9 +52,9 @@
* o \n
* x \n
* o \n
- * is defined with length = 5.
+ * is defined with length = 3.
*/
- typedef line<grid::square, 1, int> vline2d;
+ typedef line<grid::square, 0, int> vline2d;
} // end of namespace mln::win
Index: trunk/milena/mln/arith/min.hh
===================================================================
--- trunk/milena/mln/arith/min.hh (revision 1253)
+++ trunk/milena/mln/arith/min.hh (revision 1254)
@@ -76,31 +76,31 @@
{
template <typename L, typename R, typename O>
- void min_(const Image<L>& lhs_, const Image<R>& rhs_, Image<O>& output_)
+ void min_(mln::trait::speed::any, const L& lhs,
+ mln::trait::speed::any, const R& rhs,
+ mln::trait::speed::any, O& output)
{
- const L& lhs = exact(lhs_);
- const R& rhs = exact(rhs_);
- O& output = exact(output_);
mln_piter(L) p(lhs.domain());
for_all(p)
output(p) = lhs(p) < rhs(p) ? lhs(p) : rhs(p);
}
template <typename L, typename R, typename O>
- void min_(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
- {
- mln_pixter(const L) lp(exact(lhs));
- mln_pixter(const R) rp(exact(rhs));
- mln_pixter(O) op(exact(output));
+ void min_(mln::trait::speed::fastest, const L& lhs,
+ mln::trait::speed::fastest, const R& rhs,
+ mln::trait::speed::fastest, O& output)
+ {
+ mln_pixter(const L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ mln_pixter(O) op(output);
for_all_3(lp, rp, op)
op.val() = lp.val() < rp.val() ? lp.val() : rp.val();
}
template <typename L, typename R>
- void min_inplace_(Image<L>& lhs_, const Image<R>& rhs_)
+ void min_inplace_(mln::trait::speed::any, L& lhs,
+ mln::trait::speed::any, const R& rhs)
{
- L& lhs = exact(lhs_);
- const R& rhs = exact(rhs_);
mln_piter(R) p(rhs.domain());
for_all(p)
if (rhs(p) < lhs(p))
@@ -108,10 +108,11 @@
}
template <typename L, typename R>
- void min_inplace_(Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs)
+ void min_inplace_(mln::trait::speed::fastest, L& lhs,
+ mln::trait::speed::fastest, const R& rhs)
{
- mln_pixter(L) lp(exact(lhs));
- mln_pixter(const R) rp(exact(rhs));
+ mln_pixter(L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
for_all_2(rp, lp)
if (rp.val() < lp.val())
lp.val() = rp.val();
@@ -127,14 +128,17 @@
{
mln_precondition(exact(rhs).domain() == exact(lhs).domain());
mln_precondition(exact(output).domain() == exact(lhs).domain());
- impl::min_(exact(lhs), exact(rhs), exact(output));
+ impl::min_(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs),
+ mln_trait_image_speed(O)(), exact(output));
}
template <typename L, typename R>
void min_inplace(Image<L>& lhs, const Image<R>& rhs)
{
mln_precondition(exact(rhs).domain() <= exact(lhs).domain());
- impl::min_inplace_(exact(lhs), exact(rhs));
+ impl::min_inplace_(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/arith/plus.hh
===================================================================
--- trunk/milena/mln/arith/plus.hh (revision 1253)
+++ trunk/milena/mln/arith/plus.hh (revision 1254)
@@ -107,41 +107,42 @@
{
template <typename L, typename R, typename O>
- void plus_(const Image<L>& lhs_, const Image<R>& rhs_, Image<O>& output_)
+ void plus_(mln::trait::speed::any, const L& lhs,
+ mln::trait::speed::any, const R& rhs,
+ mln::trait::speed::any, O& output)
{
- const L& lhs = exact(lhs_);
- const R& rhs = exact(rhs_);
- O& output = exact(output_);
mln_piter(L) p(lhs.domain());
for_all(p)
output(p) = lhs(p) + rhs(p);
}
template <typename L, typename R, typename O>
- void plus_(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
- {
- mln_pixter(const L) lp(exact(lhs));
- mln_pixter(const R) rp(exact(rhs));
- mln_pixter(O) op(exact(output));
+ void plus_(mln::trait::speed::fastest, const L& lhs,
+ mln::trait::speed::fastest, const R& rhs,
+ mln::trait::speed::fastest, O& output)
+ {
+ mln_pixter(const L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ mln_pixter(O) op(output);
for_all_3(lp, rp, op)
op.val() = lp.val() + rp.val();
}
template <typename L, typename R>
- void plus_inplace_(Image<L>& lhs_, const Image<R>& rhs_)
+ void plus_inplace_(mln::trait::speed::any, L& lhs,
+ mln::trait::speed::any, const R& rhs)
{
- L& lhs = exact(lhs_);
- const R& rhs = exact(rhs_);
mln_piter(R) p(rhs.domain());
for_all(p)
lhs(p) += rhs(p);
}
template <typename L, typename R>
- void plus_inplace_(Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs)
+ void plus_inplace_(mln::trait::speed::fastest, L& lhs,
+ mln::trait::speed::fastest, const R& rhs)
{
- mln_pixter(L) lp(exact(lhs));
- mln_pixter(const R) rp(exact(rhs));
+ mln_pixter(L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
for_all_2(rp, lp)
lp.val() += rp.val();
}
@@ -157,7 +158,9 @@
{
mln_precondition(exact(rhs).domain() == exact(lhs).domain());
mln_precondition(exact(output).domain() == exact(lhs).domain());
- impl::plus_(exact(lhs), exact(rhs), exact(output));
+ impl::plus_(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs),
+ mln_trait_image_speed(O)(), exact(output));
}
@@ -175,21 +178,28 @@
void plus_cst(const Image<I>& input, const V& val, Image<O>& output)
{
mln_precondition(exact(output).domain() == exact(input).domain());
- plus(input, pw::cst(val) | exact(input).domain(), output); // Calls the previous version.
+ trait::speed::any any;
+ impl::plus_(mln_trait_image_speed(I)(), exact(input),
+ any, pw::cst(val) | exact(input).domain(),
+ mln_trait_image_speed(O)(), exact(output)); // Calls the previous version.
}
template <typename L, typename R>
void plus_inplace(Image<L>& lhs, const Image<R>& rhs)
{
mln_precondition(exact(rhs).domain() <= exact(lhs).domain());
- impl::plus_inplace_(exact(lhs), exact(rhs));
+ impl::plus_inplace_(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs));
}
template <typename I, typename V>
void plus_cst_inplace(Image<I>& input, const V& val)
{
mln_precondition(exact(input).has_data());
- plus_inplace(input, pw::cst(val) | exact(input).domain()); // Calls the previous version.
+ trait::speed::any any;
+ plus_inplace(mln_trait_image_speed(I)(), exact(input),
+ any, pw::cst(val) | exact(input).domain());
+ // Calls the previous version.
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/arith/revert.hh
===================================================================
--- trunk/milena/mln/arith/revert.hh (revision 1253)
+++ trunk/milena/mln/arith/revert.hh (revision 1254)
@@ -78,10 +78,9 @@
{
template <typename I, typename O>
- void revert_(const Image<I>& input_, Image<O>& output_)
+ void revert_(mln::trait::speed::any, const I& input,
+ mln::trait::speed::any, O& output)
{
- const I& input = exact(input_);
- O& output = exact(output_);
typedef mln_value(I) V;
mln_piter(I) p(input.domain());
for_all(p)
@@ -89,11 +88,12 @@
}
template <typename I, typename O>
- void revert_(const Fastest_Image<I>& input, Fastest_Image<O>& output)
+ void revert_(mln::trait::speed::fastest, const I& input,
+ mln::trait::speed::fastest, O& output)
{
typedef mln_value(I) V;
- mln_pixter(const I) ip(exact(input));
- mln_pixter(O) op(exact(output));
+ mln_pixter(const I) ip(input);
+ mln_pixter(O) op(output);
for_all_2(ip, op)
op.val() = mln_min(V) + (mln_max(V) - ip.val());
}
@@ -107,14 +107,16 @@
void revert(const Image<I>& input, Image<O>& output)
{
mln_precondition(exact(output).domain() == exact(input).domain());
- impl::revert_(exact(input), exact(output));
+ impl::revert_(mln_trait_image_speed(I)(), exact(input),
+ mln_trait_image_speed(O)(), exact(output));
}
template <typename I>
void revert_inplace(Image<I>& input)
{
mln_precondition(exact(input).has_data());
- impl::revert_(exact(input), exact(input));
+ impl::revert_(mln_trait_image_speed(I)(), exact(input),
+ mln_trait_image_speed(I)(), exact(input));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/arith/minus.hh
===================================================================
--- trunk/milena/mln/arith/minus.hh (revision 1253)
+++ trunk/milena/mln/arith/minus.hh (revision 1254)
@@ -75,41 +75,42 @@
{
template <typename L, typename R, typename O>
- void minus_(const Image<L>& lhs_, const Image<R>& rhs_, Image<O>& output_)
+ void minus_(mln::trait::speed::any, const L& lhs,
+ mln::trait::speed::any, const R& rhs,
+ mln::trait::speed::any, O& output)
{
- const L& lhs = exact(lhs_);
- const R& rhs = exact(rhs_);
- O& output = exact(output_);
mln_piter(L) p(lhs.domain());
for_all(p)
output(p) = lhs(p) - rhs(p);
}
template <typename L, typename R, typename O>
- void minus_(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
- {
- mln_pixter(const L) lp(exact(lhs));
- mln_pixter(const R) rp(exact(rhs));
- mln_pixter(O) op(exact(output));
+ void minus_(mln::trait::speed::fastest, const L& lhs,
+ mln::trait::speed::fastest, const R& rhs,
+ mln::trait::speed::fastest, O& output)
+ {
+ mln_pixter(const L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ mln_pixter(O) op(output);
for_all_3(lp, rp, op)
op.val() = lp.val() - rp.val();
}
template <typename L, typename R>
- void minus_inplace_(Image<L>& lhs_, const Image<R>& rhs_)
+ void minus_inplace_(mln::trait::speed::any, L& lhs,
+ mln::trait::speed::any, const R& rhs)
{
- L& lhs = exact(lhs_);
- const R& rhs = exact(rhs_);
mln_piter(R) p(rhs.domain());
for_all(p)
lhs(p) -= rhs(p);
}
template <typename L, typename R>
- void minus_inplace_(Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs)
+ void minus_inplace_(mln::trait::speed::fastest, L& lhs,
+ mln::trait::speed::fastest, const R& rhs)
{
- mln_pixter(L) lp(exact(lhs));
- mln_pixter(const R) rp(exact(rhs));
+ mln_pixter(L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
for_all_2(rp, lp)
lp.val() -= rp.val();
}
@@ -124,14 +125,17 @@
{
mln_precondition(exact(rhs).domain() == exact(lhs).domain());
mln_precondition(exact(output).domain() == exact(lhs).domain());
- impl::minus_(exact(lhs), exact(rhs), exact(output));
+ impl::minus_(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs),
+ mln_trait_image_speed(O)(), exact(output));
}
template <typename L, typename R>
void minus_inplace(Image<L>& lhs, const Image<R>& rhs)
{
mln_precondition(exact(rhs).domain() <= exact(lhs).domain());
- impl::minus_inplace_(exact(lhs), exact(rhs));
+ impl::minus_inplace_(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/level/take.hh
===================================================================
--- trunk/milena/mln/level/take.hh (revision 1253)
+++ trunk/milena/mln/level/take.hh (revision 1254)
@@ -63,18 +63,16 @@
{
template <typename A, typename I>
- void take(const Image<I>& input_, A& a)
+ void take(mln::trait::speed::any, const I& input, A& a)
{
- const I& input = exact(input_);
mln_piter(I) p(input.domain());
for_all(p)
a.take(input(p));
}
template <typename A, typename I>
- void take(const Fastest_Image<I>& input_, A& a)
+ void take(mln::trait::speed::fastest, const I& input, A& a)
{
- const I& input = exact(input_);
mln_pixter(const I) pxl(input);
for_all(pxl)
a.take(pxl.val());
@@ -89,7 +87,8 @@
void take(const Image<I>& input, Accumulator<A>& a)
{
mln_precondition(exact(input).has_data());
- impl::take(exact(input), exact(a));
+ impl::take(mln_trait_image_speed(I)(), exact(input),
+ exact(a));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/level/assign.hh
===================================================================
--- trunk/milena/mln/level/assign.hh (revision 1253)
+++ trunk/milena/mln/level/assign.hh (revision 1254)
@@ -65,20 +65,18 @@
{
template <typename L, typename R>
- void assign(Image<L>& target_, const Image<R>& data_)
+ void assign(mln::trait::speed::any, L& target,
+ mln::trait::speed::any, const 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(Fastest_Image<L>& target_, const Fastest_Image<R>& data_)
+ void assign(mln::trait::speed::fastest, L& target,
+ mln::trait::speed::fastest, const 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)
@@ -92,7 +90,8 @@
void assign(Image<L>& target, const Image<R>& data)
{
mln_precondition(exact(data).domain() == exact(target).domain());
- impl::assign(exact(target), exact(data));
+ impl::assign(mln_trait_image_speed(L)(), exact(target),
+ mln_trait_image_speed(R)(), exact(data));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/level/apply.hh
===================================================================
--- trunk/milena/mln/level/apply.hh (revision 1253)
+++ trunk/milena/mln/level/apply.hh (revision 1254)
@@ -67,18 +67,16 @@
{
template <typename I, typename F>
- void apply_(Image<I>& input_, const F& f)
+ void apply_(mln::trait::speed::any, I& input, const F& f)
{
- I& input = exact(input_);
mln_piter(I) p(input.domain());
for_all(p)
input(p) = f(input(p));
}
template <typename I, typename F>
- void apply_(Fastest_Image<I>& input_, const F& f)
+ void apply_(mln::trait::speed::fastest, I& input, const F& f)
{
- I& input = exact(input_);
mln_pixter(I) pxl(input);
for_all(pxl)
pxl.val() = f(pxl.val());
@@ -93,7 +91,8 @@
void apply(Image<I>& input, const Function_v2v<F>& f)
{
mln_precondition(exact(input).has_data());
- impl::apply_(exact(input), exact(f));
+ impl::apply_(mln_trait_image_speed(I)(), exact(input),
+ exact(f));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/level/fill.hh
===================================================================
--- trunk/milena/mln/level/fill.hh (revision 1253)
+++ trunk/milena/mln/level/fill.hh (revision 1254)
@@ -132,18 +132,18 @@
// fill_with_value
template <typename I>
- void fill_with_value(Image<I>& ima_, const mln_value(I)& value)
+ void fill_with_value(mln::trait::speed::any, I& ima,
+ const mln_value(I)& value)
{
- I& ima = exact(ima_);
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = value;
}
template <typename I>
- void fill_with_value(Fastest_Image<I>& ima_, const mln_value(I)& value)
+ void fill_with_value(mln::trait::speed::fastest, I& ima,
+ const mln_value(I)& value)
{
- I& ima = exact(ima_);
level::memset_(ima, ima.point_at_offset(0), value, ima.ncells());
}
@@ -159,7 +159,8 @@
{
mlc_is(mln_trait_image_io(I), trait::io::write)::check(); // FIXME: Only the upcoming general facade!!!
mln_precondition(exact(ima).has_data());
- impl::fill_with_value(exact(ima), value);
+ impl::fill_with_value(mln_trait_image_speed(I)(), exact(ima),
+ value);
}
Index: trunk/milena/mln/level/memset_.hh
===================================================================
--- trunk/milena/mln/level/memset_.hh (revision 1253)
+++ trunk/milena/mln/level/memset_.hh (revision 1254)
@@ -66,7 +66,7 @@
* \pre \p input has to be initialized. FIXME: More.
*/
template <typename I>
- void memset_(Fastest_Image<I>& input, const mln_point(I)& p,
+ void memset_(I& input, const mln_point(I)& p,
const mln_value(I)& v, std::size_t n);
@@ -111,10 +111,11 @@
}
template <typename I>
- void memset_(Fastest_Image<I>& input_, const mln_point(I)& p,
+ void memset_(I& input, const mln_point(I)& p,
const mln_value(I)& v, std::size_t n)
{
- I& input = exact(input_);
+ mlc_is(mln_trait_image_speed(I), trait::speed::fastest)::check();
+
mln_precondition(input.has_data());
mln_precondition(input.owns_(p));
mln_precondition(input.offset_at(p) + n <= input.ncells());
Index: trunk/milena/mln/linear/convolve.hh
===================================================================
--- trunk/milena/mln/linear/convolve.hh (revision 1253)
+++ trunk/milena/mln/linear/convolve.hh (revision 1254)
@@ -67,12 +67,11 @@
{
template <typename I, typename W, typename O>
- void convolve_(const Image<I>& input_, const Weighted_Window<W>& w_win_,
- Image<O>& output_)
+ void convolve_(mln::trait::speed::any, const I& input,
+ const Weighted_Window<W>& w_win_,
+ mln::trait::speed::any, O& output)
{
- const I& input = exact(input_);
const W& w_win = exact(w_win_);
- O& output = exact(output_);
mln_piter(I) p(input.domain());
mln_qiter(W) q(w_win, p);
@@ -87,12 +86,11 @@
}
template <typename I, typename W, typename O>
- void convolve_(const Fastest_Image<I>& input_, const Weighted_Window<W>& w_win_,
- Fastest_Image<O>& output_)
+ void convolve_(mln::trait::speed::fastest, const I& input,
+ const Weighted_Window<W>& w_win_,
+ mln::trait::speed::fastest, O& output)
{
- const I& input = exact(input_);
const W& w_win = exact(w_win_);
- O& output = exact(output_);
border::resize(input, w_win.delta());
border::duplicate(input);
@@ -122,7 +120,9 @@
Image<O>& output)
{
mln_precondition(exact(output).domain() == exact(input).domain());
- impl::convolve_(exact(input), exact(w_win), exact(output));
+ impl::convolve_(mln_trait_image_speed(I)(), exact(input),
+ exact(w_win),
+ mln_trait_image_speed(O)(), exact(output));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/linear/local/convolve.hh
===================================================================
--- trunk/milena/mln/linear/local/convolve.hh (revision 1253)
+++ trunk/milena/mln/linear/local/convolve.hh (revision 1254)
@@ -87,12 +87,11 @@
{
template <typename I, typename P, typename W, typename R>
- void convolve(const Image<I>& input_,
+ void convolve(mln::trait::speed::any, const I& input,
const Generalized_Point<P>& p_,
const W& w_win,
R& result)
{
- const I& input = exact(input_);
const P& p = internal::force_exact<P>(p_);
R tmp = 0; // FIXME: zero?
@@ -103,12 +102,11 @@
}
template <typename I, typename P, typename W, typename R>
- void convolve(const Fastest_Image<I>& input_,
+ void convolve(mln::trait::speed::fastest, const I& input,
const Generalized_Point<P>& p_,
const W& w_win,
R& result)
{
- const I& input = exact(input_);
const P& p = internal::force_exact<P>(p_);
mln_precondition(input.border() >= w_win.delta());
@@ -151,7 +149,8 @@
R& result)
{
mln_precondition(exact(input).has_data());
- impl::convolve(exact(input), p, exact(w_win), result);
+ impl::convolve(mln_trait_image_speed(I)(), exact(input),
+ p, exact(w_win), result);
}
template <typename P, typename W, typename R>
Index: trunk/milena/mln/border/resize.hh
===================================================================
--- trunk/milena/mln/border/resize.hh (revision 1253)
+++ trunk/milena/mln/border/resize.hh (revision 1254)
@@ -67,6 +67,7 @@
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
+ mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
if (ima.border() >= thickness)
return;
mln::internal::fixme();
Index: trunk/milena/mln/border/fill.hh
===================================================================
--- trunk/milena/mln/border/fill.hh (revision 1253)
+++ trunk/milena/mln/border/fill.hh (revision 1254)
@@ -53,7 +53,7 @@
* \todo Implement it + optimize with memset if possible.
*/
template <typename I>
- void fill(const Fastest_Image<I>& ima, const mln_value(I)& v);
+ void fill(const Image<I>& ima, const mln_value(I)& v);
# ifndef MLN_INCLUDE_ONLY
@@ -61,13 +61,12 @@
{
template <typename I>
- void fill_size_1_(const Fastest_Image<I>& ima_, const mln_value(I)& v)
+ void fill_size_1_(const I& ima, const mln_value(I)& v)
{
typedef mln_point(I) P;
- const I& ima = exact(ima_);
typedef mln_point(I) P;
typename I::line_piter pl(ima.domain());
- std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
+ std::size_t len_r = ima.bbox().len(P::dim - 1);
std::size_t st = 0;
for_all (pl)
@@ -84,13 +83,11 @@
}
template <typename I>
- void fill_size_n_(const Fastest_Image<I>& ima_, const mln_value(I)& v)
+ void fill_size_n_(const I& ima, const mln_value(I)& v)
{
typedef mln_point(I) P;
- const I& ima = exact(ima_);
- typedef mln_point(I) P;
typename I::line_piter pl(ima.domain());
- std::size_t len_r = exact(ima).bbox().len(P::dim - 1);
+ std::size_t len_r = ima.bbox().len(P::dim - 1);
std::size_t st = 0;
for_all (pl)
@@ -108,18 +105,20 @@
// Facade.
template <typename I>
- void fill(const Fastest_Image<I>& ima_, const mln_value(I)& v)
+ void fill(const Image<I>& ima_, const mln_value(I)& v)
{
trace::entering("border::fill");
typedef mln_point(I) P;
const I& ima = exact(ima_);
+
+ mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
mln_precondition(ima.has_data());
if (!ima.border ())
return;
if (sizeof(mln_value(I)) == 1)
- impl::fill_size_1_(ima_, v);
+ impl::fill_size_1_(ima, v);
else
- impl::fill_size_n_(ima_, v);
+ impl::fill_size_n_(ima, v);
trace::exiting("border::fill");
}
Index: trunk/milena/mln/border/duplicate.hh
===================================================================
--- trunk/milena/mln/border/duplicate.hh (revision 1253)
+++ trunk/milena/mln/border/duplicate.hh (revision 1254)
@@ -55,7 +55,7 @@
* \todo Implement it + optimize with memcpy if possible.
*/
template <typename I>
- void duplicate(const Fastest_Image<I>& ima);
+ void duplicate(const Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
@@ -64,9 +64,8 @@
{
template <typename I>
- void duplicate_1d_(const Fastest_Image<I>& ima_)
+ void duplicate_1d_(const I& ima)
{
- const I& ima = exact(ima_);
mln_precondition(ima.has_data());
typedef mln_point(I) P;
@@ -83,9 +82,8 @@
}
template <typename I>
- void duplicate_2d_(const Fastest_Image<I>& ima_)
+ void duplicate_2d_(const I& ima)
{
- const I& ima = exact(ima_);
mln_precondition(ima.has_data());
typedef mln_point(I) P;
@@ -196,15 +194,16 @@
typedef mln_point(I) P;
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
+ mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
if (!ima.border ())
return;
if (P::dim == 1)
- impl::duplicate_1d_(ima_);
+ impl::duplicate_1d_(ima);
if (P::dim == 2)
- impl::duplicate_2d_(ima_);
+ impl::duplicate_2d_(ima);
if (P::dim == 3)
- impl::duplicate_3d_(ima_);
+ impl::duplicate_3d_(ima);
trace::exiting("border::duplicate");
}
Index: trunk/milena/mln/border/mirror.hh
===================================================================
--- trunk/milena/mln/border/mirror.hh (revision 1253)
+++ trunk/milena/mln/border/mirror.hh (revision 1254)
@@ -53,15 +53,18 @@
* \todo Implement it + optimize with memset if possible.
*/
template <typename I>
- void mirror(const Fastest_Image<I>& ima);
+ void mirror(const Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- void mirror(const Fastest_Image<I>& ima_)
+ void mirror(const Image<I>& ima_)
{
const I& ima = exact(ima_);
+
+ mlc_is(mln_trait_image_speed(I), mln::trait::speed::fastest)::check();
+
mln_precondition(ima.has_data());
mln::internal::fixme();
}
Index: trunk/milena/mln/border/get.hh
===================================================================
--- trunk/milena/mln/border/get.hh (revision 1253)
+++ trunk/milena/mln/border/get.hh (revision 1254)
@@ -69,15 +69,15 @@
}
template <typename I>
- unsigned get_(const Image<I>& ima)
+ unsigned get_(mln::trait::speed::any, const I& ima)
{
- return border::impl::get__(exact(ima));
+ return border::impl::get__(ima);
}
template <typename I>
- unsigned get_(const Fastest_Image<I>& ima)
+ unsigned get_(mln::trait::speed::fastest, const I& ima)
{
- return exact(ima).border();
+ return ima.border();
}
} // end of namespace mln::border::impl
@@ -89,7 +89,7 @@
unsigned get(const Image<I>& ima)
{
mln_precondition(exact(ima).has_data());
- return border::impl::get_(exact(ima));
+ return border::impl::get_(mln_trait_image_speed(I)(), exact(ima));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/test/predicate.hh
===================================================================
--- trunk/milena/mln/test/predicate.hh (revision 1253)
+++ trunk/milena/mln/test/predicate.hh (revision 1254)
@@ -69,7 +69,7 @@
{
template <typename I, typename F>
- bool predicate_(const Image<I>& ima_, const F& f)
+ bool predicate_(mln::trait::speed::any, const I& ima_, const F& f)
{
const I& ima = exact(ima_);
mln_piter(I) p(ima.domain());
@@ -80,7 +80,7 @@
}
template <typename I, typename F>
- bool predicate_(const Fastest_Image<I>& ima_, const F& f)
+ bool predicate_(mln::trait::speed::fastest, const I& ima_, const F& f)
{
const I& ima = exact(ima_);
mln_pixter(const I) pxl(ima);
@@ -109,7 +109,8 @@
bool predicate(const Image<I>& ima, const Function_v2b<F>& f)
{
mln_precondition(exact(ima).has_data());
- return impl::predicate_(exact(ima), exact(f));
+ return impl::predicate_(mln_trait_image_speed(I)(), exact(ima),
+ exact(f));
}
template <typename S, typename F>
Index: trunk/milena/mln/io/internal/pnm/save.hh
===================================================================
--- trunk/milena/mln/io/internal/pnm/save.hh (revision 1253)
+++ trunk/milena/mln/io/internal/pnm/save.hh (revision 1254)
@@ -65,8 +65,16 @@
namespace pnm
{
+ // FIXME: Doc.
+ template <typename I>
+ void save(const int type, const Image<I>& ima_, const std::string& filename);
+
+
# ifndef MLN_INCLUDE_ONLY
+ namespace impl
+ {
+
// write a rgb value into for uncontiguous datas
template <unsigned int n>
void write_value(std::ofstream& file,
@@ -96,10 +104,8 @@
// save data for (sizeof(int_u8) != 1) and non fastest images
template <typename I>
void save_data_uncontiguous(std::ofstream& file,
- const Image< I >& ima_)
+ const I& ima)
{
- const I& ima = exact(ima_);
-
const int
min_row = geom::min_row(ima),
max_row = geom::max_row(ima),
@@ -116,7 +122,7 @@
// (faster)
template <typename I>
void save_data_contiguous(std::ofstream& file,
- const Fastest_Image<I>& ima_)
+ const I& ima_)
{
const I& ima = exact(ima_);
const int
@@ -132,8 +138,8 @@
// caller for fastest images
template <typename I>
- void save_data(std::ofstream& file,
- const Fastest_Image<I>& ima)
+ void save_data_(std::ofstream& file,
+ mln::trait::speed::fastest, const I& ima)
{
if (sizeof(value::int_u8) == 1)
save_data_contiguous(file, ima);
@@ -143,13 +149,17 @@
// caller for non fastest images
template <typename I>
- void save_data(std::ofstream& file,
- const Image<I>& ima)
+ void save_data_(std::ofstream& file,
+ mln::trait::speed::any, const I& ima)
{
save_data_uncontiguous(file, ima);
}
- // main function : save header and data
+ } // end of namespace mln::io::internal::pnm::impl
+
+
+ // Facades.
+
template <typename I>
void save(const int type, const Image<I>& ima_, const std::string& filename)
{
@@ -157,7 +167,8 @@
std::ofstream file(filename.c_str());
io::internal::pnm::save_header(type, ima, filename, file);
- save_data(file, ima);
+ impl::save_data_(file,
+ mln_trait_image_speed(I)(), ima);
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/logical/and.hh
===================================================================
--- trunk/milena/mln/logical/and.hh (revision 1253)
+++ trunk/milena/mln/logical/and.hh (revision 1254)
@@ -77,22 +77,23 @@
{
template <typename L, typename R, typename O>
- void and__(const Image<L>& lhs_, const Image<R>& rhs_, Image<O>& output_)
+ void and__(mln::trait::speed::any, const L& lhs,
+ mln::trait::speed::any, const R& rhs,
+ mln::trait::speed::any, O& output)
{
- const L& lhs = exact(lhs_);
- const R& rhs = exact(rhs_);
- O& output = exact(output_);
mln_piter(L) p(lhs.domain());
for_all(p)
output(p) = lhs(p) && rhs(p);
}
template <typename L, typename R, typename O>
- void and__(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
+ void and__(mln::trait::speed::fastest, const L& lhs,
+ mln::trait::speed::fastest, const R& rhs,
+ mln::trait::speed::fastest, O& output)
{
- mln_pixter(const L) lp(exact(lhs));
- mln_pixter(const R) rp(exact(rhs));
- mln_pixter(O) op(exact(output));
+ mln_pixter(const L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ mln_pixter(O) op(output);
for_all_3(lp, rp, op)
op.val() = lp.val() && rp.val();
}
@@ -107,14 +108,18 @@
{
mln_precondition(exact(rhs).domain() == exact(lhs).domain());
mln_precondition(exact(output).domain() == exact(lhs).domain());
- impl::and__(exact(lhs), exact(rhs), exact(output));
+ impl::and__(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs),
+ mln_trait_image_speed(O)(), exact(output));
}
template <typename L, typename R>
void and_inplace(Image<L>& lhs, const Image<R>& rhs)
{
mln_precondition(exact(rhs).domain() <= exact(lhs).domain());
- impl::and__(exact(lhs), exact(rhs), exact(lhs));
+ impl::and__(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs),
+ mln_trait_image_speed(L)(), exact(lhs));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/logical/and_not.hh
===================================================================
--- trunk/milena/mln/logical/and_not.hh (revision 1253)
+++ trunk/milena/mln/logical/and_not.hh (revision 1254)
@@ -77,22 +77,23 @@
{
template <typename L, typename R, typename O>
- void and_not_(const Image<L>& lhs_, const Image<R>& rhs_, Image<O>& output_)
+ void and_not_(mln::trait::speed::any, const L& lhs,
+ mln::trait::speed::any, const R& rhs,
+ mln::trait::speed::any, O& output)
{
- const L& lhs = exact(lhs_);
- const R& rhs = exact(rhs_);
- O& output = exact(output_);
mln_piter(L) p(lhs.domain());
for_all(p)
output(p) = lhs(p) && ! rhs(p);
}
template <typename L, typename R, typename O>
- void and_not_(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
+ void and_not_(mln::trait::speed::fastest, const L& lhs,
+ mln::trait::speed::fastest, const R& rhs,
+ mln::trait::speed::fastest, O& output)
{
- mln_pixter(const L) lp(exact(lhs));
- mln_pixter(const R) rp(exact(rhs));
- mln_pixter(O) op(exact(output));
+ mln_pixter(const L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ mln_pixter(O) op(output);
for_all_3(lp, rp, op)
op.val() = lp.val() && ! rp.val();
}
@@ -107,14 +108,18 @@
{
mln_precondition(exact(rhs).domain() == exact(lhs).domain());
mln_precondition(exact(output).domain() == exact(lhs).domain());
- impl::and_not_(exact(lhs), exact(rhs), exact(output));
+ impl::and_not_(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs),
+ mln_trait_image_speed(O)(), exact(output));
}
template <typename L, typename R>
void and_not_inplace(Image<L>& lhs, const Image<R>& rhs)
{
mln_precondition(exact(rhs).domain() <= exact(lhs).domain());
- impl::and_not_(exact(lhs), exact(rhs), exact(lhs));
+ impl::and_not_(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs),
+ mln_trait_image_speed(L)(), exact(lhs));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/logical/or.hh
===================================================================
--- trunk/milena/mln/logical/or.hh (revision 1253)
+++ trunk/milena/mln/logical/or.hh (revision 1254)
@@ -77,22 +77,23 @@
{
template <typename L, typename R, typename O>
- void or__(const Image<L>& lhs_, const Image<R>& rhs_, Image<O>& output_)
+ void or__(mln::trait::speed::any, const L& lhs,
+ mln::trait::speed::any, const R& rhs,
+ mln::trait::speed::any, O& output)
{
- const L& lhs = exact(lhs_);
- const R& rhs = exact(rhs_);
- O& output = exact(output_);
mln_piter(L) p(lhs.domain());
for_all(p)
output(p) = lhs(p) || rhs(p);
}
template <typename L, typename R, typename O>
- void or__(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
+ void or__(mln::trait::speed::fastest, const L& lhs,
+ mln::trait::speed::fastest, const R& rhs,
+ mln::trait::speed::fastest, O& output)
{
- mln_pixter(const L) lp(exact(lhs));
- mln_pixter(const R) rp(exact(rhs));
- mln_pixter(O) op(exact(output));
+ mln_pixter(const L) lp(lhs);
+ mln_pixter(const R) rp(rhs);
+ mln_pixter(O) op(output);
for_all_3(lp, rp, op)
op.val() = lp.val() || rp.val();
}
@@ -107,14 +108,18 @@
{
mln_precondition(exact(rhs).domain() == exact(lhs).domain());
mln_precondition(exact(output).domain() == exact(lhs).domain());
- impl::or__(exact(lhs), exact(rhs), exact(output));
+ impl::or__(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs),
+ mln_trait_image_speed(O)(), exact(output));
}
template <typename L, typename R>
void or_inplace(Image<L>& lhs, const Image<R>& rhs)
{
mln_precondition(exact(rhs).domain() <= exact(lhs).domain());
- impl::or__(exact(lhs), exact(rhs), exact(lhs));
+ impl::or__(mln_trait_image_speed(L)(), exact(lhs),
+ mln_trait_image_speed(R)(), exact(rhs),
+ mln_trait_image_speed(L)(), exact(lhs));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/logical/not.hh
===================================================================
--- trunk/milena/mln/logical/not.hh (revision 1253)
+++ trunk/milena/mln/logical/not.hh (revision 1254)
@@ -73,20 +73,20 @@
{
template <typename I, typename O>
- void not__(const Image<I>& input_, Image<O>& output_)
+ void not__(mln::trait::speed::any, const I& input,
+ mln::trait::speed::any, O& output)
{
- const I& input = exact(input_);
- O& output = exact(output_);
mln_piter(I) p(input.domain());
for_all(p)
output(p) = ! input(p);
}
template <typename I, typename O>
- void not__(const Fastest_Image<I>& input, Fastest_Image<O>& output)
+ void not__(mln::trait::speed::fastest, const I& input,
+ mln::trait::speed::fastest, O& output)
{
- mln_pixter(const I) ip(exact(input));
- mln_pixter(O) op(exact(output));
+ mln_pixter(const I) ip(input);
+ mln_pixter(O) op(output);
for_all_2(ip, op)
op.val() = ! ip.val();
}
@@ -100,14 +100,16 @@
void not_(const Image<I>& input, Image<O>& output)
{
mln_precondition(exact(output).domain() == exact(input).domain());
- impl::not__(exact(input), exact(output));
+ impl::not__(mln_trait_image_speed(I)(), exact(input),
+ mln_trait_image_speed(O)(), exact(output));
}
template <typename I>
void not_inplace(Image<I>& input)
{
mln_precondition(exact(input).has_data());
- impl::not__(exact(input), exact(input));
+ impl::not__(mln_trait_image_speed(I)(), exact(input),
+ mln_trait_image_speed(I)(), exact(input));
}
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/labeling/level.hh
===================================================================
--- trunk/milena/mln/labeling/level.hh (revision 1253)
+++ trunk/milena/mln/labeling/level.hh (revision 1254)
@@ -61,11 +61,6 @@
bool level(const Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
Image<O>& output, unsigned& nlabels);
- template <typename I, typename N, typename O>
- bool level_fast(const Fastest_Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
- Fastest_Image<O>& output, unsigned& nlabels);
-
-
# ifndef MLN_INCLUDE_ONLY
namespace impl
@@ -101,11 +96,12 @@
// Routines.
template <typename I, typename N, typename O>
- bool level_(const Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
- Image<O>& output, unsigned& nlabels)
+ bool level_(mln::trait::speed::any, const I& input,
+ const mln_value(I)& val, const Neighborhood<N>& nbh,
+ mln::trait::speed::any, O& output, unsigned& nlabels)
{
typedef impl::level_t<I,N,O> F;
- F f(exact(input), val, exact(nbh), exact(output));
+ F f(input, val, exact(nbh), output);
canvas::labeling<F> run(f);
nlabels = f.nlabels;
return f.status;
@@ -136,20 +132,19 @@
template <typename I, typename N, typename O>
- bool level_fast_(const Fastest_Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
- Fastest_Image<O>& output, unsigned& nlabels)
+ bool level_(mln::trait::speed::fastest, const I& input,
+ const mln_value(I)& val, const Neighborhood<N>& nbh,
+ mln::trait::speed::fastest, O& output, unsigned& nlabels)
{
typedef level_fast_t<I,N,O> F;
- F f(exact(input), val, exact(nbh), exact(output));
+ F f(input, val, exact(nbh), output);
canvas::labeling_fast<F> run(f);
nlabels = f.nlabels;
return f.status;
}
-
} // end of namespace mln::labeling::impl
-
// Facade.
template <typename I, typename N, typename O>
@@ -157,15 +152,10 @@
Image<O>& output, unsigned& nlabels)
{
mln_precondition(exact(output).domain() == exact(input).domain());
- return impl::level_(exact(input), val, nbh, output, nlabels);
- }
-
- template <typename I, typename N, typename O>
- bool level_fast(const Fastest_Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
- Fastest_Image<O>& output, unsigned& nlabels)
- {
- mln_precondition(exact(output).domain() == exact(input).domain());
- return impl::level_fast_(exact(input), val, nbh, output, nlabels);
+ return impl::level_(mln_trait_image_speed(I)(), exact(input),
+ val, nbh,
+ mln_trait_image_speed(O)(), exact(output),
+ nlabels);
}
# endif // ! MLN_INCLUDE_ONLY
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Add categories for value types.
* mln/value/builtin.hh: Remove tests.
* mln/value/concept/floating.hh,
* mln/value/concept/integer.hh,
* mln/value/concept/scalar.hh,
* mln/value/concept/structured.hh,
* mln/value/concept/symbolic.hh,
* mln/value/concept/vectorial.hh: Add categories for each of these
types (in namespace value).
---
builtin.hh | 46 +++++++++++-----------------------------------
concept/floating.hh | 10 ++++++++++
concept/integer.hh | 11 ++++++++++-
concept/scalar.hh | 13 +++++++++++++
concept/structured.hh | 14 ++++++++++++++
concept/symbolic.hh | 13 +++++++++++++
concept/vectorial.hh | 13 +++++++++++++
7 files changed, 84 insertions(+), 36 deletions(-)
Index: trunk/milena/mln/value/concept/symbolic.hh
===================================================================
--- trunk/milena/mln/value/concept/symbolic.hh (revision 1252)
+++ trunk/milena/mln/value/concept/symbolic.hh (revision 1253)
@@ -38,6 +38,9 @@
namespace mln
{
+ // Fwd decl.
+ template <typename E> struct Value;
+
namespace trait
{
@@ -48,6 +51,16 @@
namespace value
{
+ // Fwd decl.
+ template <typename E> struct Symbolic;
+
+ // Category flag type.
+ template <>
+ struct Symbolic<void>
+ {
+ typedef Value<void> super;
+ };
+
template <typename E>
struct Symbolic : public Value<E>
{
Index: trunk/milena/mln/value/concept/floating.hh
===================================================================
--- trunk/milena/mln/value/concept/floating.hh (revision 1252)
+++ trunk/milena/mln/value/concept/floating.hh (revision 1253)
@@ -46,6 +46,16 @@
namespace value
{
+ // Fwd decl.
+ template <typename E> struct Floating;
+
+ // Category flag type.
+ template <>
+ struct Floating<void>
+ {
+ typedef Scalar<void> super;
+ };
+
template <typename E>
struct Floating : public Scalar<E>
{
Index: trunk/milena/mln/value/concept/structured.hh
===================================================================
--- trunk/milena/mln/value/concept/structured.hh (revision 1252)
+++ trunk/milena/mln/value/concept/structured.hh (revision 1253)
@@ -38,6 +38,9 @@
namespace mln
{
+ // Fwd decl.
+ template <typename E> struct Value;
+
namespace trait
{
// FIXME
@@ -46,6 +49,17 @@
namespace value
{
+
+ // Fwd decl.
+ template <typename E> struct Structured;
+
+ // Category flag type.
+ template <>
+ struct Structured<void>
+ {
+ typedef Value<void> super;
+ };
+
template <typename E>
struct Structured : public Value<E>
{
Index: trunk/milena/mln/value/concept/scalar.hh
===================================================================
--- trunk/milena/mln/value/concept/scalar.hh (revision 1252)
+++ trunk/milena/mln/value/concept/scalar.hh (revision 1253)
@@ -38,6 +38,9 @@
namespace mln
{
+ // Fwd decl.
+ template <typename E> struct Value;
+
namespace trait
{
// FIXME
@@ -46,6 +49,16 @@
namespace value
{
+ // Fwd decl.
+ template <typename E> struct Scalar;
+
+ // Category flag type.
+ template <>
+ struct Scalar<void>
+ {
+ typedef Value<void> super;
+ };
+
template <typename E>
struct Scalar : public Value<E>
{
Index: trunk/milena/mln/value/concept/vectorial.hh
===================================================================
--- trunk/milena/mln/value/concept/vectorial.hh (revision 1252)
+++ trunk/milena/mln/value/concept/vectorial.hh (revision 1253)
@@ -38,6 +38,9 @@
namespace mln
{
+ // Fwd decl.
+ template <typename E> struct Value;
+
namespace trait
{
@@ -48,6 +51,16 @@
namespace value
{
+ // Fwd decl.
+ template <typename E> struct Vectorial;
+
+ // Category flag type.
+ template <>
+ struct Vectorial<void>
+ {
+ typedef Value<void> super;
+ };
+
template <typename E>
struct Vectorial : public Value<E>
{
Index: trunk/milena/mln/value/concept/integer.hh
===================================================================
--- trunk/milena/mln/value/concept/integer.hh (revision 1252)
+++ trunk/milena/mln/value/concept/integer.hh (revision 1253)
@@ -37,7 +37,6 @@
namespace mln
{
-
namespace trait
{
// FIXME
@@ -46,6 +45,16 @@
namespace value
{
+ // Fwd decl.
+ template <typename E> struct Integer;
+
+ // Category flag type.
+ template <>
+ struct Integer<void>
+ {
+ typedef Scalar<void> super;
+ };
+
template <typename E>
struct Integer : public Scalar<E>
{
Index: trunk/milena/mln/value/builtin.hh
===================================================================
--- trunk/milena/mln/value/builtin.hh (revision 1252)
+++ trunk/milena/mln/value/builtin.hh (revision 1253)
@@ -32,6 +32,9 @@
* \brief Some definitions about builtins.
*/
+# include <mln/value/concept/symbolic.hh>
+# include <mln/value/concept/integer.hh>
+# include <mln/value/concept/floating.hh>
namespace mln
{
@@ -42,50 +45,23 @@
// The case of built-in types.
- template <typename E>
- struct Built_In;
+ // Fwd decl.
+ template <typename E> struct Built_In;
+ // Category flag type.
template <>
struct Built_In<void>
{
typedef void* super; // Every builtin belongs to a sub-category of Value but we do not know which one.
};
+ template <> struct category< bool > { typedef Built_In<void> ret; typedef value::Symbolic<void> super; };
- template <typename E> struct Symbolic;
-
- template <>
- struct Symbolic<void>
- {
- typedef Value<void> super;
- };
-
-
- template <typename E> struct Integer;
-
- template <>
- struct Integer<void>
- {
- typedef Value<void> super;
- };
-
-
- template <typename E> struct Floating;
-
- template <>
- struct Floating<void>
- {
- typedef Value<void> super;
- };
-
-
- template <> struct category< bool > { typedef Built_In<void> ret; typedef Symbolic<void> super; };
-
- template <> struct category< int > { typedef Built_In<void> ret; typedef Integer<void> super; };
- template <> struct category< unsigned > { typedef Built_In<void> ret; typedef Integer<void> super; };
+ template <> struct category< int > { typedef Built_In<void> ret; typedef value::Integer<void> super; };
+ template <> struct category< unsigned > { typedef Built_In<void> ret; typedef value::Integer<void> super; };
- template <> struct category< float > { typedef Built_In<void> ret; typedef Floating<void> super; };
- template <> struct category< double > { typedef Built_In<void> ret; typedef Floating<void> super; };
+ template <> struct category< float > { typedef Built_In<void> ret; typedef value::Floating<void> super; };
+ template <> struct category< double > { typedef Built_In<void> ret; typedef value::Floating<void> super; };
// FIXME: ...
1
0
05 Oct '07
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Move value concepts into value/concept directory.
* mln/value/concept: New.
* mln/value/internal/floating.hh,
* mln/value/internal/scalar.hh,
* mln/value/internal/structured.hh,
* mln/value/internal/symbolic.hh,
* mln/value/internal/vectoriel.hh: Rename as ...
* mln/value/concept/floating.hh,
* mln/value/concept/integer.hh,
* mln/value/concept/scalar.hh,
* mln/value/concept/structured.hh,
* mln/value/concept/symbolic.hh,
* mln/value/concept/vectorial.hh: ... This.
Update value types inheritance and concept includes.
* mln/value/float01_.hh,
* mln/value/gray.hh,
* mln/value/graylevel.hh,
* mln/value/int_s.hh,
* mln/value/int_u.hh,
* mln/value/int_u_sat.hh,
* mln/value/label.hh,
* mln/value/quat.hh,
* mln/value/rgb.hh: Update.
Add a missing test for float01 values.
* tests/value_float01.hh: New.
---
mln/value/concept/floating.hh | 59 ++++++++++++++++++++++++++++++++++++++
mln/value/concept/integer.hh | 59 ++++++++++++++++++++++++++++++++++++++
mln/value/concept/scalar.hh | 59 ++++++++++++++++++++++++++++++++++++++
mln/value/concept/structured.hh | 59 ++++++++++++++++++++++++++++++++++++++
mln/value/concept/symbolic.hh | 61 ++++++++++++++++++++++++++++++++++++++++
mln/value/concept/vectorial.hh | 61 ++++++++++++++++++++++++++++++++++++++++
mln/value/float01_.hh | 4 +-
mln/value/gray.hh | 4 +-
mln/value/graylevel.hh | 4 +-
mln/value/int_s.hh | 4 +-
mln/value/int_u.hh | 4 +-
mln/value/int_u_sat.hh | 4 +-
mln/value/label.hh | 4 +-
mln/value/quat.hh | 4 +-
mln/value/rgb.hh | 4 +-
tests/value_float01.hh | 53 ++++++++++++++++++++++++++++++++++
16 files changed, 429 insertions(+), 18 deletions(-)
Index: trunk/milena/tests/value_float01.hh
===================================================================
--- trunk/milena/tests/value_float01.hh (revision 0)
+++ trunk/milena/tests/value_float01.hh (revision 1252)
@@ -0,0 +1,53 @@
+// 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.
+
+#include <iostream>
+#include <mln/value/float01_8.hh>
+#include <mln/value/float01_16.hh>
+
+int main()
+{
+ using namespace mln::value;
+
+// float01_8 a;
+
+ std::cout << "a = " << std::endl;
+ std::cout << "testsetestest\n"<< std::endl;
+
+// gl8 a = white;
+// gl16 b = white;
+// assert((a == b) == true);
+// gl8 c = (a + b) / 2;
+// assert(c == white);
+// c = a;
+// assert(c == white);
+
+// c = (a * 2) / 2;
+// assert(c == white);
+
+ std::cout << "testsetestest\n"<< std::endl;
+}
Index: trunk/milena/mln/value/int_u_sat.hh
===================================================================
--- trunk/milena/mln/value/int_u_sat.hh (revision 1251)
+++ trunk/milena/mln/value/int_u_sat.hh (revision 1252)
@@ -36,7 +36,7 @@
# include <mln/metal/math.hh>
# include <mln/value/internal/value_like.hh>
-# include <mln/value/internal/integer.hh>
+# include <mln/value/concept/integer.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/props.hh>
# include <mln/debug/format.hh>
@@ -55,7 +55,7 @@
*/
template <unsigned n>
struct int_u_sat
- : public internal::Integer< int_u_sat<n> >,
+ : public Integer< int_u_sat<n> >,
public internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
int_u_sat<n> >
{
Index: trunk/milena/mln/value/graylevel.hh
===================================================================
--- trunk/milena/mln/value/graylevel.hh (revision 1251)
+++ trunk/milena/mln/value/graylevel.hh (revision 1252)
@@ -33,7 +33,7 @@
# include <mln/metal/math.hh>
# include <mln/metal/bexpr.hh>
# include <mln/value/internal/value_like.hh>
-# include <mln/value/internal/integer.hh>
+# include <mln/value/concept/integer.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/gray.hh>
# include <mln/value/props.hh>
@@ -51,7 +51,7 @@
/// General gray-level class on n bits.
template <unsigned n>
class graylevel
- : public internal::Integer< graylevel<n> >,
+ : public Integer< graylevel<n> >,
public internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
graylevel<n> >
{
Index: trunk/milena/mln/value/concept/symbolic.hh
===================================================================
--- trunk/milena/mln/value/concept/symbolic.hh (revision 0)
+++ trunk/milena/mln/value/concept/symbolic.hh (revision 1252)
@@ -0,0 +1,61 @@
+// 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_SYMBOLIC_HH
+# define MLN_VALUE_SYMBOLIC_HH
+
+/*! \file mln/value/symbolic.hh
+ *
+ * \brief Define a generic class for symbolic values.
+ */
+
+# include <mln/core/concept/value.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+ // FIXME
+
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ template <typename E>
+ struct Symbolic : public Value<E>
+ {
+ };
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_SYMBOLIC_HH
Index: trunk/milena/mln/value/concept/floating.hh
===================================================================
--- trunk/milena/mln/value/concept/floating.hh (revision 0)
+++ trunk/milena/mln/value/concept/floating.hh (revision 1252)
@@ -0,0 +1,59 @@
+// 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_FLOATING_HH
+# define MLN_VALUE_FLOATING_HH
+
+/*! \file mln/value/floating.hh
+ *
+ * \brief Define a generic class for float values.
+ */
+
+# include <mln/value/concept/scalar.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+ // FIXME
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ template <typename E>
+ struct Floating : public Scalar<E>
+ {
+ };
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_FLOATING_HH
Index: trunk/milena/mln/value/concept/structured.hh
===================================================================
--- trunk/milena/mln/value/concept/structured.hh (revision 0)
+++ trunk/milena/mln/value/concept/structured.hh (revision 1252)
@@ -0,0 +1,59 @@
+// 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_STRUCTURED_HH
+# define MLN_VALUE_STRUCTURED_HH
+
+/*! \file mln/value/structured.hh
+ *
+ * \brief Define a generic class for structured values.
+ */
+
+# include <mln/core/concept/value.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+ // FIXME
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ template <typename E>
+ struct Structured : public Value<E>
+ {
+ };
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_STRUCTURED_HH
Index: trunk/milena/mln/value/concept/scalar.hh
===================================================================
--- trunk/milena/mln/value/concept/scalar.hh (revision 0)
+++ trunk/milena/mln/value/concept/scalar.hh (revision 1252)
@@ -0,0 +1,59 @@
+// 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_SCALAR_HH
+# define MLN_VALUE_SCALAR_HH
+
+/*! \file mln/value/scalar.hh
+ *
+ * \brief Define a generic class for scalar values.
+ */
+
+# include <mln/core/concept/value.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+ // FIXME
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ template <typename E>
+ struct Scalar : public Value<E>
+ {
+ };
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_SCALAR_HH
Index: trunk/milena/mln/value/concept/vectorial.hh
===================================================================
--- trunk/milena/mln/value/concept/vectorial.hh (revision 0)
+++ trunk/milena/mln/value/concept/vectorial.hh (revision 1252)
@@ -0,0 +1,61 @@
+// 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_VECTORIEL_HH
+# define MLN_VALUE_VECTORIEL_HH
+
+/*! \file mln/value/vectorial.hh
+ *
+ * \brief Define a generic class for vectorial values.
+ */
+
+# include <mln/core/concept/value.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+ // FIXME
+
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ template <typename E>
+ struct Vectorial : public Value<E>
+ {
+ };
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_VECTORIEL_HH
Index: trunk/milena/mln/value/concept/integer.hh
===================================================================
--- trunk/milena/mln/value/concept/integer.hh (revision 0)
+++ trunk/milena/mln/value/concept/integer.hh (revision 1252)
@@ -0,0 +1,59 @@
+// 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_INTEGER_HH
+# define MLN_VALUE_INTEGER_HH
+
+/*! \file mln/value/integer.hh
+ *
+ * \brief Define a generic class for integer values.
+ */
+
+# include <mln/value/concept/scalar.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+ // FIXME
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ template <typename E>
+ struct Integer : public Scalar<E>
+ {
+ };
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_INTEGER_HH
Index: trunk/milena/mln/value/gray.hh
===================================================================
--- trunk/milena/mln/value/gray.hh (revision 1251)
+++ trunk/milena/mln/value/gray.hh (revision 1252)
@@ -31,7 +31,7 @@
# include <iostream>
# include <mln/value/graylevel.hh>
-# include <mln/value/internal/integer.hh>
+# include <mln/value/concept/integer.hh>
namespace mln
@@ -46,7 +46,7 @@
/// General gray-level class where n bits is not know at compile-time.
/// This class is used for exchange between gray-level types purpose.
- class gray : public internal::Integer< gray >
+ class gray : public Integer< gray >
{
public:
Index: trunk/milena/mln/value/float01_.hh
===================================================================
--- trunk/milena/mln/value/float01_.hh (revision 1251)
+++ trunk/milena/mln/value/float01_.hh (revision 1252)
@@ -33,7 +33,7 @@
# include <mln/metal/math.hh>
# include <mln/metal/bexpr.hh>
# include <mln/value/internal/value_like.hh>
-# include <mln/value/internal/floating.hh>
+# include <mln/value/concept/floating.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/float01.hh>
# include <mln/value/props.hh>
@@ -51,7 +51,7 @@
/// General float01-level class on n bits.
template <unsigned n>
class float01_
- : public internal::Floating< float01_<n> >,
+ : public Floating< float01_<n> >,
public internal::value_like_< float,
float01_<n> >
{
Index: trunk/milena/mln/value/rgb.hh
===================================================================
--- trunk/milena/mln/value/rgb.hh (revision 1251)
+++ trunk/milena/mln/value/rgb.hh (revision 1252)
@@ -34,7 +34,7 @@
* 8-bit encoded.
*/
-# include <mln/value/internal/structured.hh>
+# include <mln/value/concept/structured.hh>
# include <mln/value/int_u8.hh>
@@ -54,7 +54,7 @@
* 8-bit encoded.
*/
template <unsigned n>
- struct rgb : public internal::Structured< rgb<n> >
+ struct rgb : public Structured< rgb<n> >
{
public:
Index: trunk/milena/mln/value/quat.hh
===================================================================
--- trunk/milena/mln/value/quat.hh (revision 1251)
+++ trunk/milena/mln/value/quat.hh (revision 1252)
@@ -33,7 +33,7 @@
# include <mln/metal/vec.hh>
# include <mln/norm/l2.hh>
# include <mln/value/props.hh>
-# include <mln/value/internal/vectoriel.hh>
+# include <mln/value/concept/vectorial.hh>
namespace mln
{
@@ -42,7 +42,7 @@
{
//FIXME doesn't compile
- class quat :// public internal::Vectoriel< quat >,
+ class quat :// public Vectorial< quat >,
public metal::vec<4, float>
{
typedef metal::vec<4, float> super_;
Index: trunk/milena/mln/value/int_s.hh
===================================================================
--- trunk/milena/mln/value/int_s.hh (revision 1251)
+++ trunk/milena/mln/value/int_s.hh (revision 1252)
@@ -35,7 +35,7 @@
# include <mln/metal/math.hh>
# include <mln/value/internal/value_like.hh>
-# include <mln/value/internal/integer.hh>
+# include <mln/value/concept/integer.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/props.hh>
# include <mln/trait/all.hh>
@@ -96,7 +96,7 @@
*/
template <unsigned n>
struct int_s
- : public internal::Integer< int_s<n> >,
+ : public Integer< int_s<n> >,
public internal::value_like_< typename internal::encoding_signed_<n>::ret,
int_s<n> >
{
Index: trunk/milena/mln/value/internal/symbolic.hh (deleted)
===================================================================
Index: trunk/milena/mln/value/internal/floating.hh (deleted)
===================================================================
Index: trunk/milena/mln/value/internal/structured.hh (deleted)
===================================================================
Index: trunk/milena/mln/value/internal/scalar.hh (deleted)
===================================================================
Index: trunk/milena/mln/value/internal/vectoriel.hh (deleted)
===================================================================
Index: trunk/milena/mln/value/int_u.hh
===================================================================
--- trunk/milena/mln/value/int_u.hh (revision 1251)
+++ trunk/milena/mln/value/int_u.hh (revision 1252)
@@ -36,7 +36,7 @@
# include <mln/metal/math.hh>
# include <mln/value/internal/value_like.hh>
# include <mln/value/internal/encoding.hh>
-# include <mln/value/internal/integer.hh>
+# include <mln/value/concept/integer.hh>
# include <mln/value/props.hh>
# include <mln/trait/all.hh>
# include <mln/debug/format.hh>
@@ -93,7 +93,7 @@
*/
template <unsigned n>
struct int_u
- : public internal::Integer< int_u<n> >,
+ : public Integer< int_u<n> >,
public internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
int_u<n> >
{
Index: trunk/milena/mln/value/label.hh
===================================================================
--- trunk/milena/mln/value/label.hh (revision 1251)
+++ trunk/milena/mln/value/label.hh (revision 1252)
@@ -35,7 +35,7 @@
# include <mln/metal/math.hh>
# include <mln/value/internal/value_like.hh>
-# include <mln/value/internal/symbolic.hh>
+# include <mln/value/concept/symbolic.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/props.hh>
@@ -53,7 +53,7 @@
* The parameter \c n is the number of encoding bits.
*/
template <unsigned n>
- struct label : public internal::Symbolic< label<n> >
+ struct label : public Symbolic< label<n> >
{
public:
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Fix on accumulators.
* mln/accu/min.hh,
* mln/accu/p.hh: Fix.
New hierachy on value types in order to factorise the traits
declarations.
Value
^
|
---------------------------
| | | |
Scalar Vectoriel Symbolic Structured
^
|
--------
| |
Integer Floating
* mln/value/internal/floating.hh: New.
* mln/value/internal/integer.hh: New.
* mln/value/internal/scalar.hh: New.
* mln/value/internal/structured.hh: New.
* mln/value/internal/symbolic.hh: New.
* mln/value/internal/value_like.hh,
* mln/value/internal/vectoriel.hh: New.
Update value types inheritance.
* mln/value/float01_.hh,
* mln/value/gray.hh,
* mln/value/graylevel.hh,
* mln/value/int_s.hh,
* mln/value/int_u.hh,
* mln/value/int_u_sat.hh,
* mln/value/label.hh,
* mln/value/quat.hh,
* mln/value/rgb.hh: Update.
---
accu/min.hh | 15 ---------
accu/p.hh | 2 -
value/float01_.hh | 4 +-
value/gray.hh | 6 +--
value/graylevel.hh | 8 +++--
value/int_s.hh | 4 +-
value/int_u.hh | 4 +-
value/int_u_sat.hh | 8 +++--
value/internal/floating.hh | 64 +++++++++++++++++++++++++++++++++++++++++
value/internal/integer.hh | 64 +++++++++++++++++++++++++++++++++++++++++
value/internal/scalar.hh | 64 +++++++++++++++++++++++++++++++++++++++++
value/internal/structured.hh | 66 +++++++++++++++++++++++++++++++++++++++++++
value/internal/symbolic.hh | 66 +++++++++++++++++++++++++++++++++++++++++++
value/internal/value_like.hh | 2 -
value/internal/vectoriel.hh | 66 +++++++++++++++++++++++++++++++++++++++++++
value/label.hh | 6 +++
value/quat.hh | 11 ++++++-
value/rgb.hh | 4 +-
18 files changed, 430 insertions(+), 34 deletions(-)
Index: trunk/milena/mln/accu/min.hh
===================================================================
--- trunk/milena/mln/accu/min.hh (revision 1250)
+++ trunk/milena/mln/accu/min.hh (revision 1251)
@@ -86,21 +86,6 @@
-// // FIXME: Sample code.
-
-// template <typename T>
-// struct p_min_ : public p_< min_<T> >
-// {
-// };
-
-// struct p_min : public Meta_Accumulator< p_min >
-// {
-// template <typename T>
-// struct with
-// {
-// typedef p_min_<T> ret;
-// };
-// };
Index: trunk/milena/mln/accu/p.hh
===================================================================
--- trunk/milena/mln/accu/p.hh (revision 1250)
+++ trunk/milena/mln/accu/p.hh (revision 1251)
@@ -53,7 +53,7 @@
template <typename A>
struct p_ : public mln::accu::internal::base_< mln_result(A) , p_<A> >
{
- typedef mln_value(A) argument;
+ typedef mln_argument(A) argument;
typedef mln_result(A) result;
Index: trunk/milena/mln/value/int_u_sat.hh
===================================================================
--- trunk/milena/mln/value/int_u_sat.hh (revision 1250)
+++ trunk/milena/mln/value/int_u_sat.hh (revision 1251)
@@ -36,6 +36,7 @@
# include <mln/metal/math.hh>
# include <mln/value/internal/value_like.hh>
+# include <mln/value/internal/integer.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/props.hh>
# include <mln/debug/format.hh>
@@ -54,17 +55,18 @@
*/
template <unsigned n>
struct int_u_sat
- : public internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
+ : public internal::Integer< int_u_sat<n> >,
+ public internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
int_u_sat<n> >
{
protected:
typedef internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
- int_u_sat<n> > super;
+ int_u_sat<n> > like;
public:
/// Encoding associated type.
- typedef typename super::enc enc;
+ typedef typename like::enc enc;
/// Constructor without argument.
int_u_sat();
Index: trunk/milena/mln/value/graylevel.hh
===================================================================
--- trunk/milena/mln/value/graylevel.hh (revision 1250)
+++ trunk/milena/mln/value/graylevel.hh (revision 1251)
@@ -33,6 +33,7 @@
# include <mln/metal/math.hh>
# include <mln/metal/bexpr.hh>
# include <mln/value/internal/value_like.hh>
+# include <mln/value/internal/integer.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/gray.hh>
# include <mln/value/props.hh>
@@ -50,17 +51,18 @@
/// General gray-level class on n bits.
template <unsigned n>
class graylevel
- : public internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
+ : public internal::Integer< graylevel<n> >,
+ public internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
graylevel<n> >
{
protected:
typedef internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
- graylevel<n> > super;
+ graylevel<n> > like;
public:
/// Encoding associated type.
- typedef typename super::enc enc;
+ typedef typename like::enc enc;
/// Ctor.
graylevel();
Index: trunk/milena/mln/value/gray.hh
===================================================================
--- trunk/milena/mln/value/gray.hh (revision 1250)
+++ trunk/milena/mln/value/gray.hh (revision 1251)
@@ -30,9 +30,8 @@
# include <iostream>
-# include <mln/core/concept/value.hh>
# include <mln/value/graylevel.hh>
-
+# include <mln/value/internal/integer.hh>
namespace mln
@@ -47,7 +46,7 @@
/// General gray-level class where n bits is not know at compile-time.
/// This class is used for exchange between gray-level types purpose.
- class gray : public Value<gray>
+ class gray : public internal::Integer< gray >
{
public:
@@ -142,7 +141,6 @@
template <unsigned N>
gray operator/(const graylevel<N>& lhs, int s)
{
- std::cout << "div div " << s << std::endl;
mln_precondition(s > 0);
gray tmp(N, lhs.value() / s);
return tmp;
Index: trunk/milena/mln/value/float01_.hh
===================================================================
--- trunk/milena/mln/value/float01_.hh (revision 1250)
+++ trunk/milena/mln/value/float01_.hh (revision 1251)
@@ -33,6 +33,7 @@
# include <mln/metal/math.hh>
# include <mln/metal/bexpr.hh>
# include <mln/value/internal/value_like.hh>
+# include <mln/value/internal/floating.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/float01.hh>
# include <mln/value/props.hh>
@@ -50,7 +51,8 @@
/// General float01-level class on n bits.
template <unsigned n>
class float01_
- : public internal::value_like_< float,
+ : public internal::Floating< float01_<n> >,
+ public internal::value_like_< float,
float01_<n> >
{
public:
Index: trunk/milena/mln/value/rgb.hh
===================================================================
--- trunk/milena/mln/value/rgb.hh (revision 1250)
+++ trunk/milena/mln/value/rgb.hh (revision 1251)
@@ -34,7 +34,7 @@
* 8-bit encoded.
*/
-# include <mln/core/concept/value.hh>
+# include <mln/value/internal/structured.hh>
# include <mln/value/int_u8.hh>
@@ -54,7 +54,7 @@
* 8-bit encoded.
*/
template <unsigned n>
- struct rgb : public Value< rgb<n> >
+ struct rgb : public internal::Structured< rgb<n> >
{
public:
Index: trunk/milena/mln/value/quat.hh
===================================================================
--- trunk/milena/mln/value/quat.hh (revision 1250)
+++ trunk/milena/mln/value/quat.hh (revision 1251)
@@ -33,6 +33,7 @@
# include <mln/metal/vec.hh>
# include <mln/norm/l2.hh>
# include <mln/value/props.hh>
+# include <mln/value/internal/vectoriel.hh>
namespace mln
{
@@ -40,13 +41,21 @@
namespace value
{
- class quat : public metal::vec<4, float>
+ //FIXME doesn't compile
+ class quat :// public internal::Vectoriel< quat >,
+ public metal::vec<4, float>
{
typedef metal::vec<4, float> super_;
using super_::data_;
public:
+ /// Encoding associated type.
+ typedef float enc;
+
+ /// Equivalent associated type.
+ typedef float equiv[4];
+
// ctors
quat();
Index: trunk/milena/mln/value/int_s.hh
===================================================================
--- trunk/milena/mln/value/int_s.hh (revision 1250)
+++ trunk/milena/mln/value/int_s.hh (revision 1251)
@@ -35,6 +35,7 @@
# include <mln/metal/math.hh>
# include <mln/value/internal/value_like.hh>
+# include <mln/value/internal/integer.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/props.hh>
# include <mln/trait/all.hh>
@@ -95,7 +96,8 @@
*/
template <unsigned n>
struct int_s
- : public internal::value_like_< typename internal::encoding_signed_<n>::ret,
+ : public internal::Integer< int_s<n> >,
+ public internal::value_like_< typename internal::encoding_signed_<n>::ret,
int_s<n> >
{
protected:
Index: trunk/milena/mln/value/internal/symbolic.hh
===================================================================
--- trunk/milena/mln/value/internal/symbolic.hh (revision 0)
+++ trunk/milena/mln/value/internal/symbolic.hh (revision 1251)
@@ -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.
+
+#ifndef MLN_VALUE_SYMBOLIC_HH
+# define MLN_VALUE_SYMBOLIC_HH
+
+/*! \file mln/value/symbolic.hh
+ *
+ * \brief Define a generic class for symbolic values.
+ */
+
+# include <mln/core/concept/value.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+ // FIXME
+
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ namespace internal
+ {
+
+ template <typename E>
+ struct Symbolic : public Value<E>
+ {
+ };
+
+ } // end of namespace mln::value::internal
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_SYMBOLIC_HH
Index: trunk/milena/mln/value/internal/floating.hh
===================================================================
--- trunk/milena/mln/value/internal/floating.hh (revision 0)
+++ trunk/milena/mln/value/internal/floating.hh (revision 1251)
@@ -0,0 +1,64 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_VALUE_FLOATING_HH
+# define MLN_VALUE_FLOATING_HH
+
+/*! \file mln/value/floating.hh
+ *
+ * \brief Define a generic class for float values.
+ */
+
+# include <mln/value/internal/scalar.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+ // FIXME
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ namespace internal
+ {
+
+ template <typename E>
+ struct Floating : public Scalar<E>
+ {
+ };
+
+ } // end of namespace mln::value::internal
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_FLOATING_HH
Index: trunk/milena/mln/value/internal/structured.hh
===================================================================
--- trunk/milena/mln/value/internal/structured.hh (revision 0)
+++ trunk/milena/mln/value/internal/structured.hh (revision 1251)
@@ -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.
+
+#ifndef MLN_VALUE_STRUCTURED_HH
+# define MLN_VALUE_STRUCTURED_HH
+
+/*! \file mln/value/structured.hh
+ *
+ * \brief Define a generic class for structured values.
+ */
+
+# include <mln/core/concept/value.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+ // FIXME
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+
+ namespace internal
+ {
+
+ template <typename E>
+ struct Structured : public Value<E>
+ {
+ };
+
+
+ } // end of namespace mln::value::internal
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_STRUCTURED_HH
Index: trunk/milena/mln/value/internal/scalar.hh
===================================================================
--- trunk/milena/mln/value/internal/scalar.hh (revision 0)
+++ trunk/milena/mln/value/internal/scalar.hh (revision 1251)
@@ -0,0 +1,64 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_VALUE_SCALAR_HH
+# define MLN_VALUE_SCALAR_HH
+
+/*! \file mln/value/scalar.hh
+ *
+ * \brief Define a generic class for scalar values.
+ */
+
+# include <mln/core/concept/value.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+ // FIXME
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ namespace internal
+ {
+
+ template <typename E>
+ struct Scalar : public Value<E>
+ {
+ };
+
+ } // end of namespace mln::value::internal
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_SCALAR_HH
Index: trunk/milena/mln/value/internal/vectoriel.hh
===================================================================
--- trunk/milena/mln/value/internal/vectoriel.hh (revision 0)
+++ trunk/milena/mln/value/internal/vectoriel.hh (revision 1251)
@@ -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.
+
+#ifndef MLN_VALUE_VECTORIEL_HH
+# define MLN_VALUE_VECTORIEL_HH
+
+/*! \file mln/value/vectoriel.hh
+ *
+ * \brief Define a generic class for vectoriel values.
+ */
+
+# include <mln/core/concept/value.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+
+ // FIXME
+
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ namespace internal
+ {
+
+ template <typename E>
+ struct Vectoriel : public Value<E>
+ {
+ };
+
+ } // end of namespace mln::value::internal
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_VECTORIEL_HH
Index: trunk/milena/mln/value/internal/integer.hh
===================================================================
--- trunk/milena/mln/value/internal/integer.hh (revision 0)
+++ trunk/milena/mln/value/internal/integer.hh (revision 1251)
@@ -0,0 +1,64 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_VALUE_INTEGER_HH
+# define MLN_VALUE_INTEGER_HH
+
+/*! \file mln/value/integer.hh
+ *
+ * \brief Define a generic class for integer values.
+ */
+
+# include <mln/value/internal/scalar.hh>
+
+namespace mln
+{
+
+ namespace trait
+ {
+ // FIXME
+ } // end of namespace mln::trait
+
+ namespace value
+ {
+
+ namespace internal
+ {
+
+ template <typename E>
+ struct Integer : public Scalar<E>
+ {
+ };
+
+ } // end of namespace mln::value::internal
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_INTEGER_HH
Index: trunk/milena/mln/value/internal/value_like.hh
===================================================================
--- trunk/milena/mln/value/internal/value_like.hh (revision 1250)
+++ trunk/milena/mln/value/internal/value_like.hh (revision 1251)
@@ -56,7 +56,7 @@
* exact value type.
*/
template <typename V, typename E>
- struct value_like_ : public Value<E>
+ struct value_like_ // FIXME :Remove -> : public Value<E>
{
/// Encoding associated type.
typedef V enc;
Index: trunk/milena/mln/value/int_u.hh
===================================================================
--- trunk/milena/mln/value/int_u.hh (revision 1250)
+++ trunk/milena/mln/value/int_u.hh (revision 1251)
@@ -36,6 +36,7 @@
# include <mln/metal/math.hh>
# include <mln/value/internal/value_like.hh>
# include <mln/value/internal/encoding.hh>
+# include <mln/value/internal/integer.hh>
# include <mln/value/props.hh>
# include <mln/trait/all.hh>
# include <mln/debug/format.hh>
@@ -92,7 +93,8 @@
*/
template <unsigned n>
struct int_u
- : public internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
+ : public internal::Integer< int_u<n> >,
+ public internal::value_like_< typename internal::encoding_unsigned_<n>::ret,
int_u<n> >
{
protected:
Index: trunk/milena/mln/value/label.hh
===================================================================
--- trunk/milena/mln/value/label.hh (revision 1250)
+++ trunk/milena/mln/value/label.hh (revision 1251)
@@ -35,6 +35,7 @@
# include <mln/metal/math.hh>
# include <mln/value/internal/value_like.hh>
+# include <mln/value/internal/symbolic.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/props.hh>
@@ -52,13 +53,16 @@
* The parameter \c n is the number of encoding bits.
*/
template <unsigned n>
- struct label
+ struct label : public internal::Symbolic< label<n> >
{
public:
/// Encoding associated type.
typedef typename internal::encoding_unsigned_<n>::ret enc;
+ /// Equivalent associated type.
+ typedef typename internal::encoding_unsigned_<n>::ret equiv;
+
/// Constructor without argument.
label();
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-05 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Fix line system.
* mln/core/win/line.hh: Fix.
* mln/core/win/hline2d.hh,
* mln/core/win/vline2d.hh: Are now typedefs of line.
---
hline2d.hh | 23 +----------------------
line.hh | 45 +++++++++++++++++++++------------------------
vline2d.hh | 9 +--------
3 files changed, 23 insertions(+), 54 deletions(-)
Index: trunk/milena/mln/core/win/vline2d.hh
===================================================================
--- trunk/milena/mln/core/win/vline2d.hh (revision 1249)
+++ trunk/milena/mln/core/win/vline2d.hh (revision 1250)
@@ -54,14 +54,7 @@
* o \n
* is defined with length = 5.
*/
- struct vline2d : public line<grid::square, 0, vline2d>
- {
- // Ctor.
- vline2d(unsigned length)
- : line<grid::square, 0, vline2d>(length)
- {
- }
- };
+ typedef line<grid::square, 1, int> vline2d;
} // end of namespace mln::win
Index: trunk/milena/mln/core/win/hline2d.hh
===================================================================
--- trunk/milena/mln/core/win/hline2d.hh (revision 1249)
+++ trunk/milena/mln/core/win/hline2d.hh (revision 1250)
@@ -52,28 +52,7 @@
* o o x o o \n
* is defined with length = 5.
*/
- struct hline2d : public line<grid::square, 1, hline2d>
- {
- // Ctor.
- hline2d(unsigned length)
- : line<grid::square, 1, hline2d>(length)
- {
- }
- };
-
-
-// // FIXME for Simon
-
-// // Was:
-// struct hline2d : public Window< hline2d >,
-// public internal::dpoints_base_< dpoint2d, hline2d >
-// {};
-
-// // Will be:
-// template <typename M, unsigned i, typename C >
-// struct line : public Window< line<M,i,C> >,
-// public internal::dpoints_base_< dpoint_<M, C>, line<M,i,C> >
-// {};
+ typedef line<grid::square, 1, int> hline2d;
} // end of namespace mln::win
Index: trunk/milena/mln/core/win/line.hh
===================================================================
--- trunk/milena/mln/core/win/line.hh (revision 1249)
+++ trunk/milena/mln/core/win/line.hh (revision 1250)
@@ -45,12 +45,9 @@
namespace win
{
- template <typename M, unsigned i, typename E>
- struct line : public Window<E>,
- public internal::dpoints_base_
- <dpoint_
- <M, int>, point_
- <M, int> >
+ template <typename M, unsigned i, typename C>
+ struct line : public Window< line<M,i,C> >,
+ public internal::dpoints_base_<dpoint_<M, C>, point_<M, C> >
{
/// Point associated type.
typedef point_<M, int> point;
@@ -97,7 +94,7 @@
unsigned delta() const;
/// Apply a central symmetry to the target window.
- E& sym();
+ line<M,i,C>& sym();
protected:
unsigned length_;
@@ -114,16 +111,16 @@
*
* \relates mln::win::line
*/
- template <typename M, unsigned i, typename E>
- std::ostream& operator<<(std::ostream& ostr, const line<M,i,E>& win);
+ template <typename M, unsigned i, typename C>
+ std::ostream& operator<<(std::ostream& ostr, const line<M,i,C>& win);
# ifndef MLN_INCLUDE_ONLY
- template <typename M, unsigned i, typename E>
- line<M,i,E>::line(unsigned length)
+ template <typename M, unsigned i, typename C>
+ line<M,i,C>::line(unsigned length)
: length_(length)
{
mln_precondition(i < M::dim);
@@ -137,38 +134,38 @@
}
}
- template <typename M, unsigned i, typename E>
- bool line<M,i,E>::is_centered() const
+ template <typename M, unsigned i, typename C>
+ bool line<M,i,C>::is_centered() const
{
return true;
}
- template <typename M, unsigned i, typename E>
- bool line<M,i,E>::is_symmetric() const
+ template <typename M, unsigned i, typename C>
+ bool line<M,i,C>::is_symmetric() const
{
return true;
}
- template <typename M, unsigned i, typename E>
- unsigned line<M,i,E>::length() const
+ template <typename M, unsigned i, typename C>
+ unsigned line<M,i,C>::length() const
{
return length_;
}
- template <typename M, unsigned i, typename E>
- unsigned line<M,i,E>::delta() const
+ template <typename M, unsigned i, typename C>
+ unsigned line<M,i,C>::delta() const
{
return length_ / 2;
}
- template <typename M, unsigned i, typename E>
- E& line<M,i,E>::sym()
+ template <typename M, unsigned i, typename C>
+ line<M,i,C>& line<M,i,C>::sym()
{
- return exact(*this);
+ return *this;
}
- template <typename M, unsigned i, typename E>
- std::ostream& operator<<(std::ostream& ostr, const line<M,i,E>& win)
+ template <typename M, unsigned i, typename C>
+ std::ostream& operator<<(std::ostream& ostr, const line<M,i,C>& win)
{
ostr << "[line: length=" << win.length() << ']';
return ostr;
1
0
04 Oct '07
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fast is Fastest and speed trait is used in inheritance.
Fast actually is fastEST.
* mln/core/concept/fast_image.hh: Rename as...
* mln/core/concept/fastest_image.hh: ...this new file.
* mln/core/concept/doc/fast_image.hh: Rename as...
* mln/core/concept/doc/fastest_image.hh: ...this new file.
* mln/core/internal/image_base.hh: Use speed trait for
inheritance.
* mln/core/trait/is_fast.hh: Remove; obsolete.
* mln/core/trait/all.hh: Update.
* mln/histo/compute.hh,
* mln/debug/iota.hh,
* mln/debug/println_with_border.hh,
* mln/core/image2d_b.hh,
* mln/core/concept/image.hh,
* mln/core/image1d_b.hh,
* mln/core/image3d_b.hh,
* mln/arith/plus.hh,
* mln/arith/min.hh,
* mln/arith/revert.hh,
* mln/arith/minus.hh,
* mln/level/take.hh,
* mln/level/assign.hh,
* mln/level/apply.hh,
* mln/level/fill.hh,
* mln/level/memcpy_.hh,
* mln/level/memset_.hh,
* mln/level/median.hh,
* mln/level/transform.hh,
* mln/linear/convolve.hh,
* mln/linear/local/convolve.hh,
* mln/accu/take.hh,
* mln/border/resize.hh,
* mln/border/fill.hh,
* mln/border/duplicate.hh,
* mln/border/mirror.hh,
* mln/border/get.hh,
* mln/test/predicate.hh,
* mln/morpho/erosion_fast.hh,
* mln/morpho/dilation_fast.hh,
* mln/io/internal/pnm/save.hh,
* mln/logical/and.hh,
* mln/logical/and_not.hh,
* mln/logical/or.hh,
* mln/logical/not.hh,
* mln/labeling/level.hh,
* mln/labeling/base.hh: Update.
* tests/image2d_b.cc: Augment.
Only keep the generic impl in the main file.
* mln/level/paste.hh: Split file into this and...
* mln/level/paste.spe.hh: ...this new file.
(paste_generic_): Rename as...
(paste_): ...this and move in impl::generic.
* tests/level_paste.cc: Update.
Misc.
* tests/literal_zero.cc,
* mln/core/macros.hh: Clean.
mln/accu/take.hh | 2
mln/arith/min.hh | 4 -
mln/arith/minus.hh | 4 -
mln/arith/plus.hh | 4 -
mln/arith/revert.hh | 2
mln/border/duplicate.hh | 10 ++--
mln/border/fill.hh | 8 +--
mln/border/get.hh | 2
mln/border/mirror.hh | 4 -
mln/border/resize.hh | 4 -
mln/core/concept/doc/fastest_image.hh | 10 ++--
mln/core/concept/fastest_image.hh | 22 ++++-----
mln/core/concept/image.hh | 2
mln/core/image1d_b.hh | 13 -----
mln/core/image2d_b.hh | 16 +++---
mln/core/image3d_b.hh | 11 ----
mln/core/internal/image_base.hh | 17 ++++---
mln/core/macros.hh | 11 +++-
mln/core/trait/all.hh | 1
mln/debug/iota.hh | 2
mln/debug/println_with_border.hh | 10 ++--
mln/histo/compute.hh | 2
mln/io/internal/pnm/save.hh | 12 ++---
mln/labeling/base.hh | 2
mln/labeling/level.hh | 18 +++----
mln/level/apply.hh | 2
mln/level/assign.hh | 2
mln/level/fill.hh | 4 -
mln/level/median.hh | 2
mln/level/memcpy_.hh | 4 -
mln/level/memset_.hh | 8 +--
mln/level/paste.hh | 59 +++++++------------------
mln/level/paste.spe.hh | 79 ++++++++--------------------------
mln/level/take.hh | 2
mln/level/transform.hh | 2
mln/linear/convolve.hh | 4 -
mln/linear/local/convolve.hh | 2
mln/logical/and.hh | 2
mln/logical/and_not.hh | 2
mln/logical/not.hh | 2
mln/logical/or.hh | 2
mln/morpho/dilation_fast.hh | 2
mln/morpho/erosion_fast.hh | 2
mln/test/predicate.hh | 2
tests/image2d_b.cc | 8 +++
tests/level_paste.cc | 2
tests/literal_zero.cc | 1
47 files changed, 158 insertions(+), 230 deletions(-)
Index: tests/literal_zero.cc
--- tests/literal_zero.cc (revision 1248)
+++ tests/literal_zero.cc (working copy)
@@ -31,7 +31,6 @@
*/
#include <mln/literal/zero.hh>
-// #include <mln/core/concept/object.hh>
int main()
Index: tests/image2d_b.cc
--- tests/image2d_b.cc (revision 1248)
+++ tests/image2d_b.cc (working copy)
@@ -36,6 +36,12 @@
#include <mln/core/init.hh>
+template <typename I>
+void check_fastest(const mln::Fastest_Image<I>&)
+{
+}
+
+
int main()
{
using namespace mln;
@@ -48,4 +54,6 @@
mln_assertion(f.npoints() = geom::nrows(f) * geom::ncols(f));
mln_assertion(f.ncells() = (nrows + 2 * border) * (ncols + 2 * border));
+
+ check_fastest(f);
}
Index: tests/level_paste.cc
--- tests/level_paste.cc (revision 1248)
+++ tests/level_paste.cc (working copy)
@@ -58,5 +58,5 @@
level::paste(ima, ima2); // Fast version.
debug::println(ima2);
- level::impl::paste_generic_(ima, ima2); // Not so fast version...
+ level::impl::generic::paste_(ima, ima2); // Not so fast version...
}
Index: mln/histo/compute.hh
--- mln/histo/compute.hh (revision 1248)
+++ mln/histo/compute.hh (working copy)
@@ -65,7 +65,7 @@
}
template <typename I>
- data<mln_vset(I)> compute(const Fast_Image<I>& input_)
+ data<mln_vset(I)> compute(const Fastest_Image<I>& input_)
{
const I& input = exact(input_);
data<mln_vset(I)> h(input.values());
Index: mln/debug/iota.hh
--- mln/debug/iota.hh (revision 1248)
+++ mln/debug/iota.hh (working copy)
@@ -63,7 +63,7 @@
}
template <typename I>
- void iota(Fast_Image<I>& input_)
+ void iota(Fastest_Image<I>& input_)
{
unsigned i = 0;
I& input = exact(input_);
Index: mln/debug/println_with_border.hh
--- mln/debug/println_with_border.hh (revision 1248)
+++ mln/debug/println_with_border.hh (working copy)
@@ -48,7 +48,7 @@
/// Print the image \p input on the standard output.
template <typename I>
- void println_with_border(const Fast_Image<I>& input);
+ void println_with_border(const Fastest_Image<I>& input);
# ifndef MLN_INCLUDE_ONLY
@@ -58,7 +58,7 @@
// generic version
template <typename S, typename I>
- void println_with_border(const S&, const Fast_Image<I>& input_)
+ void println_with_border(const S&, const Fastest_Image<I>& input_)
{
const I& input = exact(input_);
for (size_t i = 0; i < input.ncells(); i++)
@@ -68,7 +68,7 @@
// 2D version
template <typename I>
- void println_with_border(const box2d& b, const Fast_Image<I>& input_)
+ void println_with_border(const box2d& b, const Fastest_Image<I>& input_)
{
const I& input = exact(input_);
const std::size_t ncols = b.ncols() + 2 * input.border();
@@ -83,7 +83,7 @@
// 3D version
template <typename I>
- void println_with_border(const box3d& b, const Fast_Image<I>& input_)
+ void println_with_border(const box3d& b, const Fastest_Image<I>& input_)
{
const I& ima = exact(input_);
typedef mln_point(I) P;
@@ -115,7 +115,7 @@
// facade
template <typename I>
- void println_with_border(const Fast_Image<I>& input)
+ void println_with_border(const Fastest_Image<I>& input)
{
impl::println_with_border(exact(input).bbox(), exact(input));
}
Index: mln/core/macros.hh
--- mln/core/macros.hh (revision 1248)
+++ mln/core/macros.hh (working copy)
@@ -34,6 +34,13 @@
*/
+// a
+
+/// Shortcut to access the argument type associated to T.
+# define mln_argument(T) typename T::argument
+# define mln_argument_(T) T::argument
+
+
// b
/// Shortcut to access the bkd_niter type associated to T.
@@ -161,10 +168,6 @@
# define mln_value(T) typename T::value
# define mln_value_(T) T::value
-/// Shortcut to access the argument type associated to T.
-# define mln_argument(T) typename T::argument
-# define mln_argument_(T) T::argument
-
/// Shortcut to test if the values of an image with type \c I are lowly quantifized.
# define mln_is_value_lowq(I) mln_is_lowq( mln_value(I) )
Index: mln/core/internal/image_base.hh
--- mln/core/internal/image_base.hh (revision 1248)
+++ mln/core/internal/image_base.hh (working copy)
@@ -36,6 +36,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/grids.hh>
# include <mln/util/tracked_ptr.hh>
+# include <mln/metal/equal.hh>
@@ -77,16 +78,16 @@
};
- /*! \brief Selector for image inheritance (fast or regular).
+ /*! \brief Selector for image inheritance (fastest or not fastest).
*
* \internal
*/
- template <typename Is_fast, typename E>
+ template <typename Is_fastest, typename E>
struct select_image_concept_;
template <typename E>
struct select_image_concept_< metal::true_, E >
- : public Fast_Image<E>
+ : public Fastest_Image<E>
{};
template <typename E>
@@ -105,7 +106,8 @@
template <typename S, typename E>
struct image_base_
- : public select_image_concept_< typename trait::is_fast<E>::ret,
+ : public select_image_concept_< typename mlc_equal(mln_trait_image_speed(E),
+ trait::speed::fastest)::eval,
E >
{
/// Point_Set associated type.
@@ -169,6 +171,10 @@
// Internal data, sharable by several images.
util::tracked_ptr< internal::data_<E> > data_;
+
+ typedef select_image_concept_< typename mlc_equal(mln_trait_image_speed(E),
+ trait::speed::fastest)::eval,
+ E > super_;
};
@@ -182,8 +188,7 @@
template <typename S, typename E>
image_base_<S,E>::image_base_(const image_base_& rhs)
- : select_image_concept_< typename trait::is_fast<E>::ret,
- E >()
+ : super_()
{
mln_precondition(exact(rhs).has_data()); // FIXME: Is-it too restrictive?
this->data_ = rhs.data_;
Index: mln/core/image2d_b.hh
--- mln/core/image2d_b.hh (revision 1248)
+++ mln/core/image2d_b.hh (working copy)
@@ -104,16 +104,16 @@
- namespace trait
- {
+// namespace trait
+// {
- template <typename T>
- struct is_fast< image2d_b<T> >
- {
- typedef metal::true_ ret;
- };
+// template <typename T>
+// struct is_fast< image2d_b<T> >
+// {
+// typedef metal::true_ ret;
+// };
- } // end of mln::trait
+// } // end of mln::trait
Index: mln/core/trait/all.hh
--- mln/core/trait/all.hh (revision 1248)
+++ mln/core/trait/all.hh (working copy)
@@ -44,7 +44,6 @@
}
-# include <mln/core/trait/is_fast.hh>
# include <mln/core/trait/pixter.hh>
Index: mln/core/concept/image.hh
--- mln/core/concept/image.hh (revision 1248)
+++ mln/core/concept/image.hh (working copy)
@@ -193,7 +193,7 @@
} // end of namespace mln
-# include <mln/core/concept/fast_image.hh>
+# include <mln/core/concept/fastest_image.hh>
#endif // ! MLN_CORE_CONCEPT_IMAGE_HH
Index: mln/core/concept/doc/fastest_image.hh
--- mln/core/concept/doc/fastest_image.hh (revision 1248)
+++ mln/core/concept/doc/fastest_image.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/fast_image.hh
- * \brief This file documents the concept of mln::Fast_Image.
+/*! \file mln/core/concept/doc/fastest_image.hh
+ * \brief This file documents the concept of mln::Fastest_Image.
*/
namespace mln
@@ -35,11 +35,11 @@
namespace doc
{
- /*! \brief Documentation class for mln::Fast_Image.
- * \see mln::Fast_Image
+ /*! \brief Documentation class for mln::Fastest_Image.
+ * \see mln::Fastest_Image
*/
template <typename E>
- struct Fast_Image : public Image<E>
+ struct Fastest_Image : public Image<E>
{
/*! \brief Give the border thickness.
Index: mln/core/concept/fastest_image.hh
--- mln/core/concept/fastest_image.hh (revision 1248)
+++ mln/core/concept/fastest_image.hh (working copy)
@@ -25,11 +25,11 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_CONCEPT_FAST_IMAGE_HH
-# define MLN_CORE_CONCEPT_FAST_IMAGE_HH
+#ifndef MLN_CORE_CONCEPT_FASTEST_IMAGE_HH
+# define MLN_CORE_CONCEPT_FASTEST_IMAGE_HH
-/*! \file mln/core/concept/fast_image.hh
- * \brief Definition of the concept of mln::Fast_Image.
+/*! \file mln/core/concept/fastest_image.hh
+ * \brief Definition of the concept of mln::Fastest_Image.
*/
# include <mln/core/concept/image.hh>
@@ -40,13 +40,13 @@
namespace mln
{
- /*! \brief Base class for implementation of fast image classes.
+ /*! \brief Base class for implementation of fastest image classes.
*
- * \see mln::doc::Fast_Image for a complete documentation of this
+ * \see mln::doc::Fastest_Image for a complete documentation of this
* class contents.
*/
template <typename E>
- struct Fast_Image : public Image<E>
+ struct Fastest_Image : public Image<E>
{
/*
unsigned border();
@@ -78,7 +78,7 @@
offset_at(const Generalized_Point<P>& p) const;
protected:
- Fast_Image();
+ Fastest_Image();
};
@@ -87,7 +87,7 @@
template <typename E>
template <typename P>
unsigned // FIXME: std::size_t?
- Fast_Image<E>::offset_at(const Generalized_Point<P>& p_) const
+ Fastest_Image<E>::offset_at(const Generalized_Point<P>& p_) const
{
// FIXME: check that P is mln_point(E)
const E* this_ = exact(this);
@@ -101,7 +101,7 @@
}
template <typename E>
- Fast_Image<E>::Fast_Image()
+ Fastest_Image<E>::Fastest_Image()
{
typedef mln_point(E) point;
typedef mln_dpoint(E) dpoint;
@@ -142,4 +142,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_CONCEPT_FAST_IMAGE_HH
+#endif // ! MLN_CORE_CONCEPT_FASTEST_IMAGE_HH
Index: mln/core/image1d_b.hh
--- mln/core/image1d_b.hh (revision 1248)
+++ mln/core/image1d_b.hh (working copy)
@@ -56,19 +56,6 @@
template <typename T> struct image1d_b;
- namespace trait
- {
-
- template <typename T>
- struct is_fast< image1d_b<T> >
- {
- typedef metal::true_ ret;
- };
-
- } // end of mln::trait
-
-
-
namespace internal
{
Index: mln/core/image3d_b.hh
--- mln/core/image3d_b.hh (revision 1248)
+++ mln/core/image3d_b.hh (working copy)
@@ -56,17 +56,6 @@
template <typename T> struct image3d_b;
- namespace trait
- {
-
- template <typename T>
- struct is_fast< image3d_b<T> >
- {
- typedef metal::true_ ret;
- };
-
- } // end of mln::trait
-
namespace internal
{
Index: mln/arith/plus.hh
--- mln/arith/plus.hh (revision 1248)
+++ mln/arith/plus.hh (working copy)
@@ -118,7 +118,7 @@
}
template <typename L, typename R, typename O>
- void plus_(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs, Fast_Image<O>& output)
+ void plus_(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
@@ -138,7 +138,7 @@
}
template <typename L, typename R>
- void plus_inplace_(Fast_Image<L>& lhs, const Fast_Image<R>& rhs)
+ void plus_inplace_(Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs)
{
mln_pixter(L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/arith/min.hh
--- mln/arith/min.hh (revision 1248)
+++ mln/arith/min.hh (working copy)
@@ -87,7 +87,7 @@
}
template <typename L, typename R, typename O>
- void min_(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs, Fast_Image<O>& output)
+ void min_(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
@@ -108,7 +108,7 @@
}
template <typename L, typename R>
- void min_inplace_(Fast_Image<L>& lhs, const Fast_Image<R>& rhs)
+ void min_inplace_(Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs)
{
mln_pixter(L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/arith/revert.hh
--- mln/arith/revert.hh (revision 1248)
+++ mln/arith/revert.hh (working copy)
@@ -89,7 +89,7 @@
}
template <typename I, typename O>
- void revert_(const Fast_Image<I>& input, Fast_Image<O>& output)
+ void revert_(const Fastest_Image<I>& input, Fastest_Image<O>& output)
{
typedef mln_value(I) V;
mln_pixter(const I) ip(exact(input));
Index: mln/arith/minus.hh
--- mln/arith/minus.hh (revision 1248)
+++ mln/arith/minus.hh (working copy)
@@ -86,7 +86,7 @@
}
template <typename L, typename R, typename O>
- void minus_(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs, Fast_Image<O>& output)
+ void minus_(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
@@ -106,7 +106,7 @@
}
template <typename L, typename R>
- void minus_inplace_(Fast_Image<L>& lhs, const Fast_Image<R>& rhs)
+ void minus_inplace_(Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs)
{
mln_pixter(L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/level/take.hh
--- mln/level/take.hh (revision 1248)
+++ mln/level/take.hh (working copy)
@@ -72,7 +72,7 @@
}
template <typename A, typename I>
- void take(const Fast_Image<I>& input_, A& a)
+ void take(const Fastest_Image<I>& input_, A& a)
{
const I& input = exact(input_);
mln_pixter(const I) pxl(input);
Index: mln/level/assign.hh
--- mln/level/assign.hh (revision 1248)
+++ mln/level/assign.hh (working copy)
@@ -75,7 +75,7 @@
}
template <typename L, typename R>
- void assign(Fast_Image<L>& target_, const Fast_Image<R>& data_)
+ void assign(Fastest_Image<L>& target_, const Fastest_Image<R>& data_)
{
L& target = exact(target_);
const R& data = exact(data_);
Index: mln/level/apply.hh
--- mln/level/apply.hh (revision 1248)
+++ mln/level/apply.hh (working copy)
@@ -76,7 +76,7 @@
}
template <typename I, typename F>
- void apply_(Fast_Image<I>& input_, const F& f)
+ void apply_(Fastest_Image<I>& input_, const F& f)
{
I& input = exact(input_);
mln_pixter(I) pxl(input);
Index: mln/level/fill.hh
--- mln/level/fill.hh (revision 1248)
+++ mln/level/fill.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Fill an image, that is, set pixel values.
*
- * \todo Re-organize this file contents + Overload for fast images.
+ * \todo Re-organize this file contents + Overload for fastest images.
*/
# include <cstring>
@@ -141,7 +141,7 @@
}
template <typename I>
- void fill_with_value(Fast_Image<I>& ima_, const mln_value(I)& value)
+ void fill_with_value(Fastest_Image<I>& ima_, const mln_value(I)& value)
{
I& ima = exact(ima_);
level::memset_(ima, ima.point_at_offset(0), value, ima.ncells());
Index: mln/level/memcpy_.hh
--- mln/level/memcpy_.hh (revision 1248)
+++ mln/level/memcpy_.hh (working copy)
@@ -30,12 +30,12 @@
/*! \file mln/level/memcpy_.hh
*
- * \brief Same as std::memcpy but for fast images.
+ * \brief Same as std::memcpy but for fastest images.
*
* \todo Overload with images and points; Cf. memset_.
*/
-# include <mln/core/concept/fast_image.hh>
+# include <mln/core/concept/image.hh>
# include <mln/core/pixel.hh>
Index: mln/level/memset_.hh
--- mln/level/memset_.hh (revision 1248)
+++ mln/level/memset_.hh (working copy)
@@ -30,10 +30,10 @@
/*! \file mln/level/memset_.hh
*
- * \brief Same as std::memset but for fast images.
+ * \brief Same as std::memset but for fastest images.
*/
-# include <mln/core/concept/fast_image.hh>
+# include <mln/core/concept/image.hh>
# include <mln/core/pixel.hh>
@@ -66,7 +66,7 @@
* \pre \p input has to be initialized. FIXME: More.
*/
template <typename I>
- void memset_(Fast_Image<I>& input, const mln_point(I)& p,
+ void memset_(Fastest_Image<I>& input, const mln_point(I)& p,
const mln_value(I)& v, std::size_t n);
@@ -111,7 +111,7 @@
}
template <typename I>
- void memset_(Fast_Image<I>& input_, const mln_point(I)& p,
+ void memset_(Fastest_Image<I>& input_, const mln_point(I)& p,
const mln_value(I)& v, std::size_t n)
{
I& input = exact(input_);
Index: mln/level/median.hh
--- mln/level/median.hh (revision 1248)
+++ mln/level/median.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Median filtering of an image.
*
- * \todo Add Fast_Image versions.
+ * \todo Add Fastest_Image versions.
*/
# include <mln/core/concept/image.hh>
Index: mln/level/paste.spe.hh
--- mln/level/paste.spe.hh (revision 1247)
+++ mln/level/paste.spe.hh (working copy)
@@ -25,60 +25,37 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_LEVEL_PASTE_HH
-# define MLN_LEVEL_PASTE_HH
+#ifndef MLN_LEVEL_PASTE_SPE_HH
+# define MLN_LEVEL_PASTE_SPE_HH
-/*! \file mln/level/paste.hh
+/*! \file mln/level/paste.spe.hh
*
- * \brief Paste the contents of an image into another one.
+ * \brief Specializations for mln::level::paste.
*/
-# include <mln/core/concept/image.hh>
-# include <mln/core/inplace.hh>
# include <mln/level/memcpy_.hh>
+
+# ifndef MLN_INCLUDE_ONLY
+
namespace mln
{
namespace level
{
- /*! Paste the contents of image \p data into the image \p
- * destination.
- *
- * \param[in] data The input image providing pixels values.
- * \param[in,out] destination The image in which values are
- * assigned.
- *
- * This routine runs: \n
- * for all p of \p data, \p destination(p) = \p data(p).
- *
- * \warning The definition domain of \p data has to be included in
- * the one of \p destination; so using mln::safe_image does not
- * make pasting outside the destination domain work.
- *
- * \pre \p data.domain <= \p destination.domain
- */
- template <typename I, typename J>
- void paste(const Image<I>& data, Image<J>& destination);
-
-
-# ifndef MLN_INCLUDE_ONLY
-
namespace impl
{
- template <typename I, typename J>
- void paste_generic_(const I& data, J& destination)
+
+ namespace generic
{
- trace::entering("level::impl::paste_generic_");
- mln_piter(I) p(data.domain());
- for_all(p)
- destination(p) = data(p);
- trace::exiting("level::impl::paste_generic_");
+ template <typename I, typename J>
+ void paste_(const I& data, J& destination);
}
+
template <typename I, typename J>
void paste_lines_(const I& data, J& destination)
{
@@ -96,13 +73,16 @@
trace::exiting("level::impl::paste_lines_");
}
+
// Disjunction.
+ // Remember: raw < linear < stored, computed.
+
template <typename I, typename J>
void paste_(mln::trait::data::any, const I& data,
mln::trait::data::any, J& destination)
{
- paste_generic_(data, destination);
+ generic::paste_(data, destination);
}
template <typename I, typename J>
@@ -112,36 +92,17 @@
if (sizeof(mln_value(I)) = sizeof(mln_value(J)))
paste_lines_(data, destination);
else
- paste_generic_(data, destination);
+ generic::paste_(data, destination);
}
- } // end of namespace mln::level::impl
-
- // Facade.
-
- template <typename I, typename J>
- void paste(const Image<I>& data_, Image<J>& destination_)
- {
- trace::entering("level::paste");
- mlc_is(mln_trait_image_io(J), trait::io::write)::check();
- mlc_converts_to(mln_value(I), mln_value(J))::check();
-
- const I& data = exact(data_);
- J& destination = exact(destination_);
- mln_precondition(data.domain() <= destination.domain());
-
- // Remember: raw < linear < stored, computed.
- impl::paste_(mln_trait_image_data(I)(), data,
- mln_trait_image_data(J)(), destination);
- trace::exiting("level::paste");
- }
-
-# endif // ! MLN_INCLUDE_ONLY
+ } // end of namespace mln::level::impl
} // end of namespace mln::level
} // end of namespace mln
+# endif // ! MLN_INCLUDE_ONLY
+
#endif // ! MLN_LEVEL_PASTE_HH
Index: mln/level/transform.hh
--- mln/level/transform.hh (revision 1248)
+++ mln/level/transform.hh (working copy)
@@ -100,7 +100,7 @@
// 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 Fastest_Image<I>& input_, const Function_v2v<F>& f_, Image<O>& output_)
// {
// const I& input = exact(input_);
// const F& f = exact(f_);
Index: mln/level/paste.hh
--- mln/level/paste.hh (revision 1248)
+++ mln/level/paste.hh (working copy)
@@ -35,7 +35,11 @@
# include <mln/core/concept/image.hh>
# include <mln/core/inplace.hh>
-# include <mln/level/memcpy_.hh>
+
+
+// Specializations are in:
+# include <mln/level/paste.spe.hh>
+
namespace mln
@@ -64,56 +68,28 @@
void paste(const Image<I>& data, Image<J>& destination);
+
# ifndef MLN_INCLUDE_ONLY
namespace impl
{
- template <typename I, typename J>
- void paste_generic_(const I& data, J& destination)
+ namespace generic
{
- trace::entering("level::impl::paste_generic_");
- mln_piter(I) p(data.domain());
- for_all(p)
- destination(p) = data(p);
- trace::exiting("level::impl::paste_generic_");
- }
template <typename I, typename J>
- void paste_lines_(const I& data, J& destination)
+ void paste_(const I& data, J& destination)
{
- trace::entering("level::impl::paste_lines_");
- typedef mln_point(I) P;
- std::size_t n = data.bbox().len(P::dim - 1);
- // FIXME: Works only for raw data images
- // FIXME: For linear data images, we should get the len for each line...
+ trace::entering("level::impl::generic::paste_");
- typename I::line_piter p(data.domain()); // FIXME: Alias mln_line_piter!
+ mln_piter(I) p(data.domain());
for_all(p)
- memcpy_(inplace(make::pixel(destination, p)),
- make::pixel(data, p),
- n);
- trace::exiting("level::impl::paste_lines_");
- }
-
- // Disjunction.
+ destination(p) = data(p);
- template <typename I, typename J>
- void paste_(mln::trait::data::any, const I& data,
- mln::trait::data::any, J& destination)
- {
- paste_generic_(data, destination);
+ trace::exiting("level::impl::generic::paste_");
}
- template <typename I, typename J>
- void paste_(mln::trait::data::raw, const I& data,
- mln::trait::data::raw, J& destination)
- {
- if (sizeof(mln_value(I)) = sizeof(mln_value(J)))
- paste_lines_(data, destination);
- else
- paste_generic_(data, destination);
- }
+ } // end of namespace mln::level::impl::generic
} // end of namespace mln::level::impl
@@ -123,17 +99,17 @@
template <typename I, typename J>
void paste(const Image<I>& data_, Image<J>& destination_)
{
+ const I& data = exact(data_);
+ J& destination = exact(destination_);
trace::entering("level::paste");
+
mlc_is(mln_trait_image_io(J), trait::io::write)::check();
mlc_converts_to(mln_value(I), mln_value(J))::check();
-
- const I& data = exact(data_);
- J& destination = exact(destination_);
mln_precondition(data.domain() <= destination.domain());
- // Remember: raw < linear < stored, computed.
impl::paste_(mln_trait_image_data(I)(), data,
mln_trait_image_data(J)(), destination);
+
trace::exiting("level::paste");
}
@@ -144,4 +120,5 @@
} // end of namespace mln
+
#endif // ! MLN_LEVEL_PASTE_HH
Index: mln/linear/convolve.hh
--- mln/linear/convolve.hh (revision 1248)
+++ mln/linear/convolve.hh (working copy)
@@ -87,8 +87,8 @@
}
template <typename I, typename W, typename O>
- void convolve_(const Fast_Image<I>& input_, const Weighted_Window<W>& w_win_,
- Fast_Image<O>& output_)
+ void convolve_(const Fastest_Image<I>& input_, const Weighted_Window<W>& w_win_,
+ Fastest_Image<O>& output_)
{
const I& input = exact(input_);
const W& w_win = exact(w_win_);
Index: mln/linear/local/convolve.hh
--- mln/linear/local/convolve.hh (revision 1248)
+++ mln/linear/local/convolve.hh (working copy)
@@ -103,7 +103,7 @@
}
template <typename I, typename P, typename W, typename R>
- void convolve(const Fast_Image<I>& input_,
+ void convolve(const Fastest_Image<I>& input_,
const Generalized_Point<P>& p_,
const W& w_win,
R& result)
Index: mln/accu/take.hh
--- mln/accu/take.hh (revision 1248)
+++ mln/accu/take.hh (working copy)
@@ -75,7 +75,7 @@
a.take(make::pix(input, p));
}
- // FIXME: We need an impl for pixels of fast images.
+ // FIXME: We need an impl for pixels of fastest images.
} // end of namespace mln::accu::impl
Index: mln/border/resize.hh
--- mln/border/resize.hh (revision 1248)
+++ mln/border/resize.hh (working copy)
@@ -57,13 +57,13 @@
* \todo Implement it.
*/
template <typename I>
- void resize(const Fast_Image<I>& ima, unsigned thickness);
+ void resize(const Fastest_Image<I>& ima, unsigned thickness);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- void resize(const Fast_Image<I>& ima_, unsigned thickness)
+ void resize(const Fastest_Image<I>& ima_, unsigned thickness)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
Index: mln/border/fill.hh
--- mln/border/fill.hh (revision 1248)
+++ mln/border/fill.hh (working copy)
@@ -53,7 +53,7 @@
* \todo Implement it + optimize with memset if possible.
*/
template <typename I>
- void fill(const Fast_Image<I>& ima, const mln_value(I)& v);
+ void fill(const Fastest_Image<I>& ima, const mln_value(I)& v);
# ifndef MLN_INCLUDE_ONLY
@@ -61,7 +61,7 @@
{
template <typename I>
- void fill_size_1_(const Fast_Image<I>& ima_, const mln_value(I)& v)
+ void fill_size_1_(const Fastest_Image<I>& ima_, const mln_value(I)& v)
{
typedef mln_point(I) P;
const I& ima = exact(ima_);
@@ -84,7 +84,7 @@
}
template <typename I>
- void fill_size_n_(const Fast_Image<I>& ima_, const mln_value(I)& v)
+ void fill_size_n_(const Fastest_Image<I>& ima_, const mln_value(I)& v)
{
typedef mln_point(I) P;
const I& ima = exact(ima_);
@@ -108,7 +108,7 @@
// Facade.
template <typename I>
- void fill(const Fast_Image<I>& ima_, const mln_value(I)& v)
+ void fill(const Fastest_Image<I>& ima_, const mln_value(I)& v)
{
trace::entering("border::fill");
typedef mln_point(I) P;
Index: mln/border/duplicate.hh
--- mln/border/duplicate.hh (revision 1248)
+++ mln/border/duplicate.hh (working copy)
@@ -55,7 +55,7 @@
* \todo Implement it + optimize with memcpy if possible.
*/
template <typename I>
- void duplicate(const Fast_Image<I>& ima);
+ void duplicate(const Fastest_Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
@@ -64,7 +64,7 @@
{
template <typename I>
- void duplicate_1d_(const Fast_Image<I>& ima_)
+ void duplicate_1d_(const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -83,7 +83,7 @@
}
template <typename I>
- void duplicate_2d_(const Fast_Image<I>& ima_)
+ void duplicate_2d_(const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -122,7 +122,7 @@
}
template <typename I>
- void duplicate_3d_(const Fast_Image<I>& ima_)
+ void duplicate_3d_(const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
@@ -190,7 +190,7 @@
// Facade.
template <typename I>
- void duplicate(const Fast_Image<I>& ima_)
+ void duplicate(const Fastest_Image<I>& ima_)
{
trace::entering("border::duplicate");
typedef mln_point(I) P;
Index: mln/border/mirror.hh
--- mln/border/mirror.hh (revision 1248)
+++ mln/border/mirror.hh (working copy)
@@ -53,13 +53,13 @@
* \todo Implement it + optimize with memset if possible.
*/
template <typename I>
- void mirror(const Fast_Image<I>& ima);
+ void mirror(const Fastest_Image<I>& ima);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- void mirror(const Fast_Image<I>& ima_)
+ void mirror(const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
Index: mln/border/get.hh
--- mln/border/get.hh (revision 1248)
+++ mln/border/get.hh (working copy)
@@ -75,7 +75,7 @@
}
template <typename I>
- unsigned get_(const Fast_Image<I>& ima)
+ unsigned get_(const Fastest_Image<I>& ima)
{
return exact(ima).border();
}
Index: mln/test/predicate.hh
--- mln/test/predicate.hh (revision 1248)
+++ mln/test/predicate.hh (working copy)
@@ -80,7 +80,7 @@
}
template <typename I, typename F>
- bool predicate_(const Fast_Image<I>& ima_, const F& f)
+ bool predicate_(const Fastest_Image<I>& ima_, const F& f)
{
const I& ima = exact(ima_);
mln_pixter(const I) pxl(ima);
Index: mln/morpho/erosion_fast.hh
--- mln/morpho/erosion_fast.hh (revision 1248)
+++ mln/morpho/erosion_fast.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Ero filtering of an image.
*
- * \todo Add Fast_Image versions.
+ * \todo Add Fastest_Image versions.
*/
# include <mln/core/concept/image.hh>
Index: mln/morpho/dilation_fast.hh
--- mln/morpho/dilation_fast.hh (revision 1248)
+++ mln/morpho/dilation_fast.hh (working copy)
@@ -32,7 +32,7 @@
*
* \brief Ero filtering of an image.
*
- * \todo Add Fast_Image versions.
+ * \todo Add Fastest_Image versions.
*/
# include <mln/core/concept/image.hh>
Index: mln/io/internal/pnm/save.hh
--- mln/io/internal/pnm/save.hh (revision 1248)
+++ mln/io/internal/pnm/save.hh (working copy)
@@ -93,7 +93,7 @@
file.write((char*)(&c), sizeof(E));
}
- // save data for (sizeof(int_u8) != 1) and non fast images
+ // save data for (sizeof(int_u8) != 1) and non fastest images
template <typename I>
void save_data_uncontiguous(std::ofstream& file,
const Image< I >& ima_)
@@ -112,11 +112,11 @@
write_value(file, ima(p));
}
- // save data when (sizeof(int_u8) = 1) with fast images
+ // save data when (sizeof(int_u8) = 1) with fastest images
// (faster)
template <typename I>
void save_data_contiguous(std::ofstream& file,
- const Fast_Image<I>& ima_)
+ const Fastest_Image<I>& ima_)
{
const I& ima = exact(ima_);
const int
@@ -130,10 +130,10 @@
}
- // caller for fast images
+ // caller for fastest images
template <typename I>
void save_data(std::ofstream& file,
- const Fast_Image<I>& ima)
+ const Fastest_Image<I>& ima)
{
if (sizeof(value::int_u8) = 1)
save_data_contiguous(file, ima);
@@ -141,7 +141,7 @@
save_data_uncontiguous(file, ima);
}
- // caller for non fast images
+ // caller for non fastest images
template <typename I>
void save_data(std::ofstream& file,
const Image<I>& ima)
Index: mln/logical/and.hh
--- mln/logical/and.hh (revision 1248)
+++ mln/logical/and.hh (working copy)
@@ -88,7 +88,7 @@
}
template <typename L, typename R, typename O>
- void and__(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs, Fast_Image<O>& output)
+ void and__(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/logical/and_not.hh
--- mln/logical/and_not.hh (revision 1248)
+++ mln/logical/and_not.hh (working copy)
@@ -88,7 +88,7 @@
}
template <typename L, typename R, typename O>
- void and_not_(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs, Fast_Image<O>& output)
+ void and_not_(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/logical/or.hh
--- mln/logical/or.hh (revision 1248)
+++ mln/logical/or.hh (working copy)
@@ -88,7 +88,7 @@
}
template <typename L, typename R, typename O>
- void or__(const Fast_Image<L>& lhs, const Fast_Image<R>& rhs, Fast_Image<O>& output)
+ void or__(const Fastest_Image<L>& lhs, const Fastest_Image<R>& rhs, Fastest_Image<O>& output)
{
mln_pixter(const L) lp(exact(lhs));
mln_pixter(const R) rp(exact(rhs));
Index: mln/logical/not.hh
--- mln/logical/not.hh (revision 1248)
+++ mln/logical/not.hh (working copy)
@@ -83,7 +83,7 @@
}
template <typename I, typename O>
- void not__(const Fast_Image<I>& input, Fast_Image<O>& output)
+ void not__(const Fastest_Image<I>& input, Fastest_Image<O>& output)
{
mln_pixter(const I) ip(exact(input));
mln_pixter(O) op(exact(output));
Index: mln/labeling/level.hh
--- mln/labeling/level.hh (revision 1248)
+++ mln/labeling/level.hh (working copy)
@@ -34,7 +34,7 @@
* level.
*/
-# include <mln/core/concept/fast_image.hh>
+# include <mln/core/concept/image.hh>
# include <mln/labeling/base.hh>
# include <mln/level/fill.hh>
@@ -62,8 +62,8 @@
Image<O>& output, unsigned& nlabels);
template <typename I, typename N, typename O>
- bool level_fast(const Fast_Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
- Fast_Image<O>& output, unsigned& nlabels);
+ bool level_fast(const Fastest_Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
+ Fastest_Image<O>& output, unsigned& nlabels);
# ifndef MLN_INCLUDE_ONLY
@@ -83,7 +83,7 @@
typedef mln_pset(I_) S;
const S& s;
- void init() { mln::level::fill(this->output, 0); }
+ void init() { mln::level::fill(this->output, 0); } // FIXME: use literal::zero
bool handles(const P& p) const { return input(p) = val; }
bool equiv(const P& n, const P&) const { return input(n) = val; }
@@ -121,7 +121,7 @@
// typedef mln_pset(I_) S;
// const S& s;
- void init() { level::fill(this->output, 0); }
+ void init() { mln::level::fill(this->output, 0); }
bool handles(unsigned p) const { return this->input[p] = val; }
bool equiv(unsigned n, unsigned) const { return this->input[n] = val; }
@@ -136,8 +136,8 @@
template <typename I, typename N, typename O>
- bool level_fast_(const Fast_Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
- Fast_Image<O>& output, unsigned& nlabels)
+ bool level_fast_(const Fastest_Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
+ Fastest_Image<O>& output, unsigned& nlabels)
{
typedef level_fast_t<I,N,O> F;
F f(exact(input), val, exact(nbh), exact(output));
@@ -161,8 +161,8 @@
}
template <typename I, typename N, typename O>
- bool level_fast(const Fast_Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
- Fast_Image<O>& output, unsigned& nlabels)
+ bool level_fast(const Fastest_Image<I>& input, const mln_value(I)& val, const Neighborhood<N>& nbh,
+ Fastest_Image<O>& output, unsigned& nlabels)
{
mln_precondition(exact(output).domain() = exact(input).domain());
return impl::level_fast_(exact(input), val, nbh, output, nlabels);
Index: mln/labeling/base.hh
--- mln/labeling/base.hh (revision 1248)
+++ mln/labeling/base.hh (working copy)
@@ -84,7 +84,7 @@
};
- /// Base class for labeling functors on fast images.
+ /// Base class for labeling functors on fastest images.
template <typename I_, typename N_, typename O_>
struct base_fast_
1
0