URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-09-26 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Add plain image. FIXME : doesn't compile because of a error in init (called by
clone).
* mln/core/plain.hh: New.
* tests/plain.cc: New.
---
mln/core/plain.hh | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/plain.cc | 52 ++++++++++++++++++++
2 files changed, 191 insertions(+)
Index: trunk/milena/tests/plain.cc
===================================================================
--- trunk/milena/tests/plain.cc (revision 0)
+++ trunk/milena/tests/plain.cc (revision 1182)
@@ -0,0 +1,52 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/plain.cc
+ *
+ * \brief Test on mln::plain.
+ */
+
+#include <mln/core/image2d_b.hh>
+#include <mln/core/plain.hh>
+
+#include <mln/value/int_u8.hh>
+
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pgm/save.hh>
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+
+ {
+ plain< image2d_b<int_u8> >
+ lena = io::pgm::load<int_u8>("../img/lena.pgm");
+
+
+ }
+}
Index: trunk/milena/mln/core/plain.hh
===================================================================
--- trunk/milena/mln/core/plain.hh (revision 0)
+++ trunk/milena/mln/core/plain.hh (revision 1182)
@@ -0,0 +1,139 @@
+// 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_PLAIN_HH
+# define MLN_CORE_PLAIN_HH
+
+/*! \file mln/core/plain.hh
+ *
+ * \brief Definition of an image class FIXME
+ */
+
+# include <cmath>
+
+# include <mln/core/internal/image_identity.hh>
+# include <mln/core/clone.hh>
+
+# include <mln/metal/vec.hh>
+
+
+namespace mln
+{
+
+ // Fwd decl.
+ template <typename I> struct plain;
+
+ namespace internal
+ {
+
+ template <typename I>
+ struct data_< plain<I> >
+ {
+ data_(I& ima);
+
+ I ima_;
+ };
+
+ } // end of namespace mln::internal
+
+ /*! \brief FIXME
+ *
+ */
+ template <typename I>
+ struct plain : public mln::internal::image_identity_< I, mln_pset(I), plain<I>
>
+ {
+
+ typedef mln::internal::image_identity_< I, mln_pset(I), plain<I> >
super_;
+
+ /// Point_Site associated type.
+ typedef mln_psite(I) psite;
+
+ /// Value associated type.
+ typedef mln_value(I) value;
+
+ /// Return type of read-write access.
+ typedef mln_lvalue(I) lvalue; // FIXME: Depends on lvalue presence in I.
+
+ /// Return type of read-only access.
+ typedef mln_rvalue(I) rvalue;
+
+ /// Skeleton.
+ typedef plain< tag::image_<I> > skeleton;
+
+
+ /// Constructors.
+ plain(const I& ima);
+
+ /// Read-only access of pixel value at point site \p p.
+ /// Mutable access is only OK for reading (not writing).
+ //using super_::operator();
+
+ /// Assignment operator.
+ plain& operator=(const I& rhs);
+
+ };
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace internal
+ {
+
+ // internal::data_< plain<I,S> >
+
+ template <typename I>
+ data_< plain<I> >::data_(I& ima)
+ : ima_(ima)
+ {
+ }
+
+ } // end of namespace mln::internal
+
+ template <typename I>
+ plain<I>::plain(const I& ima_)
+ {
+ mln_precondition(ima_.has_data());
+ I ima = clone(ima_);
+ this->data_ = new internal::data_< plain<I> >(ima);
+ }
+
+ template <typename I>
+ plain<I>&
+ plain<I>::operator=(const I& rhs)
+ {
+ this->destroy();
+ this->data_ = new internal::data_< plain<I> >(clone(rhs));
+ return *this;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_PLAIN_HH