URL:
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
ChangeLog:
2008-09-12 Guillaume Lazzara <z(a)lrde.epita.fr>
Add missing init_().
* milena/mln/core/image/cast_image.hh,
* milena/mln/core/image/decorated_image.hh: add missing init_().
---
cast_image.hh | 15 +++++++++++----
decorated_image.hh | 14 ++++++++++++++
2 files changed, 25 insertions(+), 4 deletions(-)
Index: branches/cleanup-2008/milena/mln/core/image/cast_image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/image/cast_image.hh (revision 2240)
+++ branches/cleanup-2008/milena/mln/core/image/cast_image.hh (revision 2241)
@@ -95,10 +95,11 @@
/// Skeleton.
typedef cast_image_< tag::value_<T>, tag::image_<I> > skeleton;
-
/// Constructor.
cast_image_(const Image<I>& ima);
+ /// Initialize an empty image.
+ void init_(const Image<I>& ima);
/// Read-only access of pixel value at point site \p p.
T operator()(const mln_psite(I)& p) const;
@@ -108,7 +109,6 @@
};
-
template <typename T, typename I>
cast_image_<T,I>
cast_image(const Image<I>& ima)
@@ -119,7 +119,6 @@
}
-
# ifndef MLN_INCLUDE_ONLY
@@ -137,7 +136,6 @@
} // end of namespace mln::internal
-
// cast_image_<T,I>
template <typename T, typename I>
@@ -150,6 +148,15 @@
template <typename T, typename I>
inline
+ void
+ cast_image_<T,I>::init_(const Image<I>& ima)
+ {
+ mln_precondition(exact(ima).has_data());
+ this->data_ = new internal::data<cast_image_<T,I> >(exact(ima));
+ }
+
+ template <typename T, typename I>
+ inline
T
cast_image_<T,I>::operator()(const mln_psite(I)& p) const
{
Index: branches/cleanup-2008/milena/mln/core/image/decorated_image.hh
===================================================================
--- branches/cleanup-2008/milena/mln/core/image/decorated_image.hh (revision 2240)
+++ branches/cleanup-2008/milena/mln/core/image/decorated_image.hh (revision 2241)
@@ -101,6 +101,10 @@
/// Ctors
decorated_image();
decorated_image(I& ima, const D& deco);
+
+ /// Initialize an empty image.
+ void init_(I& ima, const D& deco);
+
/// Dtor
~decorated_image();
@@ -166,6 +170,16 @@
inline
decorated_image<I,D>::decorated_image(I& ima, const D& deco)
{
+ mln_precondition(exact(ima).has_data());
+ this->data_ = new internal::data< decorated_image<I,D> >(ima, deco);
+ }
+
+ template <typename I, typename D>
+ inline
+ void
+ decorated_image<I,D>::init_(I& ima, const D& deco)
+ {
+ mln_precondition(exact(ima).has_data());
this->data_ = new internal::data< decorated_image<I,D> >(ima, deco);
}