URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2008-04-07 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Add mln::make::image1d.
* mln/make/image1d.hh: New, create an image1d with a array of values.
* mln/core/image1d.hh: Add include.
---
core/image1d.hh | 1
make/image1d.hh | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+)
Index: trunk/milena/mln/core/image1d.hh
===================================================================
--- trunk/milena/mln/core/image1d.hh (revision 1844)
+++ trunk/milena/mln/core/image1d.hh (revision 1845)
@@ -560,5 +560,6 @@
} // end of namespace mln
+# include <mln/make/image1d.hh>
#endif // ! MLN_CORE_IMAGE1D_HH
Index: trunk/milena/mln/make/image1d.hh
===================================================================
--- trunk/milena/mln/make/image1d.hh (revision 0)
+++ trunk/milena/mln/make/image1d.hh (revision 1845)
@@ -0,0 +1,75 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_MAKE_IMAGE1D_HH
+# define MLN_MAKE_IMAGE1D_HH
+
+/*! \file mln/make/image1d.hh
+ *
+ * \brief Routine to create an mln::image1d.
+ */
+
+# include <mln/core/image1d.hh>
+
+
+namespace mln
+{
+
+ namespace make
+ {
+
+ /*! \brief Create an image1d from an 1d array of values.
+ *
+ * \param[in] values 1d array.
+ *
+ * \return A 1D image.
+ */
+ template <typename V, unsigned L>
+ mln::image1d<V> image1d(V (&values)[L]);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename V, unsigned L>
+ inline
+ mln::image1d<V>
+ image1d(V (&values)[L])
+ {
+ mln::image1d<V> tmp(L);
+ for (unsigned ind = 0; ind < L; ++ind)
+ tmp(make::point1d(ind)) = values[ind];
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::make
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MAKE_IMAGE1D_HH