Index: ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* tests/core/tests/image_vectorialness: New.
* tests/core/tests/readwrite_image: Add vectorialness property.
* oln/makefile.src: Add new files.
* oln/core/abstract/image.hh: Register `vectorialness' property.
* oln/core/abstract/image_vectorialness.hh: New. Add vectorialness
abstraction.
* oln/core/abstract/entry.hh: Add inheritance to new branch
`vectorialness'.
* oln/core/1d/image1d.hh: Add `vectorialness' property.
* oln/core/2d/image2d.hh: Likewise.
* oln/core/3d/image3d.hh: Likewise.
* oln/core/properties.hh: Declare `vectorialness' property..
oln/core/1d/image1d.hh | 3
oln/core/2d/image2d.hh | 3
oln/core/3d/image3d.hh | 3
oln/core/abstract/entry.hh | 4
oln/core/abstract/image.hh | 3
oln/core/abstract/image_vectorialness.hh | 126 +++++++++++++++++++++++++++++++
oln/core/properties.hh | 1
oln/makefile.src | 1
tests/core/tests/image_vectorialness | 26 ++++++
tests/core/tests/readwrite_image | 1
10 files changed, 170 insertions(+), 1 deletion(-)
Index: tests/core/tests/image_vectorialness
--- tests/core/tests/image_vectorialness (revision 0)
+++ tests/core/tests/image_vectorialness (revision 0)
@@ -0,0 +1,26 @@
+
+#include <iostream>
+
+#include <ntg/all.hh>
+#include <oln/basics2d.hh>
+
+#include <oln/fancy/iota.hh>
+#include <oln/fancy/print.hh>
+
+#include "check.hh"
+#include "data.hh"
+
+
+
+template <typename I>
+void foo_i(const oln::abstract::integer_image<I>& input)
+{}
+
+
+bool check()
+{
+ // it lacks test for decimal, vectorial, ... images.
+ oln::image2d<ntg::int_u8> ima_i;
+ foo_i(ima_i);
+ return false;
+}
Index: tests/core/tests/readwrite_image
--- tests/core/tests/readwrite_image (revision 79)
+++ tests/core/tests/readwrite_image (working copy)
@@ -24,6 +24,7 @@
{
typedef is_a<abstract::readwrite_image> image_constness;
typedef is_a<abstract::image2d> image_dimension_type;
+ typedef vectorialness_from_valuetype_(ntg::int_u8) image_vectorialness_type;
typedef size2d size_type;
typedef point2d point_type;
Index: oln/makefile.src
--- oln/makefile.src (revision 79)
+++ oln/makefile.src (working copy)
@@ -37,6 +37,7 @@
core/abstract/image.hh \
core/abstract/image_constness.hh \
core/abstract/image_dimension.hh \
+ core/abstract/image_vectorialness.hh \
core/abstract/image_identity.hh \
core/abstract/image_with_data.hh \
core/abstract/images.hh \
Index: oln/core/abstract/image.hh
--- oln/core/abstract/image.hh (revision 79)
+++ oln/core/abstract/image.hh (working copy)
@@ -70,6 +70,7 @@
mlc_decl_prop_with_default(category::image, image_constness_type,
is_a<abstract::readonly_image>);
mlc_decl_prop(category::image, image_dimension_type);
+ mlc_decl_prop(category::image, image_vectorialness_type);
//...
@@ -87,6 +88,7 @@
<< " image_constness_type = " <<
typeid(image_constness_type).name()
<< " image_dimension_type = " <<
typeid(image_dimension_type).name()
+ << " image_vectorialness_type = " <<
typeid(image_vectorialness_type).name()
<< " }" << std::endl;
}
@@ -103,6 +105,7 @@
mlc_register_prop(category::image, image_constness_type);
mlc_register_prop(category::image, image_dimension_type);
+ mlc_register_prop(category::image, image_vectorialness_type);
Index: oln/core/abstract/image_vectorialness.hh
--- oln/core/abstract/image_vectorialness.hh (revision 0)
+++ oln/core/abstract/image_vectorialness.hh (revision 0)
@@ -0,0 +1,126 @@
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330, 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 OLENA_CORE_ABSTRACT_IMAGE_VECTORIALNESS_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_VECTORIALNESS_HH
+
+# include <mlc/bool.hh>
+
+# include <ntg/basics.hh>
+
+# include <oln/core/abstract/image.hh>
+
+/*! \namespace oln
+** \brief oln namespace.
+*/
+namespace oln {
+
+ /*! \namespace oln::abstract
+ ** \brief oln::abstract namespace.
+ */
+ namespace abstract {
+
+ template <typename E>
+ struct data_type_image : public virtual image<E>
+ {
+ protected:
+ data_type_image() {}
+ };
+
+ template <typename E>
+ struct vectorial_image : public data_type_image<E>
+ {
+ protected:
+ vectorial_image() {}
+ };
+
+ template <typename E>
+ struct non_vectorial_image : public data_type_image<E>
+ {
+ protected:
+ non_vectorial_image() {}
+ };
+
+ template <typename E>
+ struct decimal_image : public non_vectorial_image<E>
+ {
+ protected:
+ decimal_image() {}
+ };
+
+ template <typename E>
+ struct integer_image : public non_vectorial_image<E>
+ {
+ protected:
+ integer_image() {}
+ };
+
+ template <typename E>
+ struct binary_image : public non_vectorial_image<E>
+ {
+ protected:
+ binary_image() {}
+ };
+
+
+ } // end of namespace oln::abstract
+
+ template <typename T>
+ struct vectorialness_from_valuetype
+ {
+ typedef typename mlc::bool_switch_<
+
+ mlc::bool_case_<ntg_is_a(T, ntg::binary)::ret,
+ is_a<abstract::binary_image>,
+
+ mlc::bool_case_<ntg_is_a(T, ntg::integer)::ret,
+ is_a<abstract::integer_image>,
+
+ mlc::bool_case_<ntg_is_a(T, ntg::decimal)::ret,
+ is_a<abstract::decimal_image>,
+
+ mlc::bool_case_<ntg_is_a(T, ntg::vectorial)::ret,
+ is_a<abstract::vectorial_image>,
+
+ mlc::bool_case_<ntg_is_a(T, ntg::non_vectorial)::ret,
+ is_a<abstract::non_vectorial_image>,
+
+ mlc::bool_case_<true,
+ is_a<abstract::data_type_image> >
+
+ > > > > > >::ret ret;
+ };
+
+ #define vectorialness_from_valuetype(T) \
+ typename vectorialness_from_valuetype< T >::ret
+ #define vectorialness_from_valuetype_(T) \
+ vectorialness_from_valuetype< T >::ret
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_VECTORIALNESS_HH
Index: oln/core/abstract/entry.hh
--- oln/core/abstract/entry.hh (revision 79)
+++ oln/core/abstract/entry.hh (working copy)
@@ -30,6 +30,7 @@
# include <oln/core/abstract/image_constness.hh>
# include <oln/core/abstract/image_dimension.hh>
+# include <oln/core/abstract/image_vectorialness.hh>
// FIXME: this file should move to oln/core/abstract/
@@ -68,7 +69,8 @@
struct image_entry :
// intrusive:
public oln_type_of_(E, image_constness) ::template
instantiated_with<E>::ret,
- public oln_type_of_(E, image_dimension) ::template instantiated_with<E>::ret
+ public oln_type_of_(E, image_dimension) ::template
instantiated_with<E>::ret,
+ public oln_type_of_(E, image_vectorialness) ::template
instantiated_with<E>::ret
// ...
{
protected:
Index: oln/core/1d/image1d.hh
--- oln/core/1d/image1d.hh (revision 79)
+++ oln/core/1d/image1d.hh (working copy)
@@ -31,6 +31,7 @@
# include <mlc/traits.hh>
# include <oln/core/abstract/image_with_data.hh>
+# include <oln/core/abstract/image_vectorialness.hh>
# include <oln/core/1d/array1d.hh>
# include <oln/core/1d/fwd_piter1d.hh>
@@ -63,6 +64,8 @@
{
// intrusive property:
typedef is_a<abstract::image1d> image_dimension_type;
+ // FIXME: should be generalized
+ typedef vectorialness_from_valuetype(T) image_vectorialness_type;
typedef mlc::no_type delegated_type;
Index: oln/core/2d/image2d.hh
--- oln/core/2d/image2d.hh (revision 79)
+++ oln/core/2d/image2d.hh (working copy)
@@ -32,6 +32,7 @@
# include <oln/core/abstract/image_identity.hh>
# include <oln/core/abstract/image_with_data.hh>
+# include <oln/core/abstract/image_vectorialness.hh>
# include <oln/core/2d/array2d.hh>
# include <oln/core/2d/fwd_piter2d.hh>
# include <oln/core/2d/bkd_piter2d.hh>
@@ -72,6 +73,8 @@
{
// intrusive property:
typedef is_a<abstract::image2d> image_dimension_type;
+ // FIXME: should be generalized
+ typedef vectorialness_from_valuetype(T) image_vectorialness_type;
typedef mlc::no_type delegated_type;
Index: oln/core/3d/image3d.hh
--- oln/core/3d/image3d.hh (revision 79)
+++ oln/core/3d/image3d.hh (working copy)
@@ -31,6 +31,7 @@
# include <mlc/traits.hh>
# include <oln/core/abstract/image_with_data.hh>
+# include <oln/core/abstract/image_vectorialness.hh>
# include <oln/core/3d/array3d.hh>
# include <oln/core/3d/fwd_piter3d.hh>
@@ -61,6 +62,8 @@
{
// intrusive property:
typedef is_a<abstract::image3d> image_dimension_type;
+ // FIXME: should be generalized
+ typedef vectorialness_from_valuetype(T) image_vectorialness_type;
typedef mlc::no_type delegated_type;
Index: oln/core/properties.hh
--- oln/core/properties.hh (revision 79)
+++ oln/core/properties.hh (working copy)
@@ -66,6 +66,7 @@
struct image_constness_type;
struct image_dimension_type;
+ struct image_vectorialness_type;
// FIXME: ...
}