https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add the first two morphers: identity and neighborhood addition.
* oln/core/typedefs.hh (morpher_type, neighborhood_type): New
typedef declarations.
(neighb_type, image_neighbness_type, image_constness_type)
(image_dimension_type, image_typeness_type)
(image_valuedness_type, image_rawness_type): Remove typedef
declarations.
* oln/core/image_entry.hh
(single_vtype<image_entry<E>, typedef_::morpher_type>): New
virtual type.
* oln/core/abstract/image.hh: Check it.
* oln/core/abstract/image_hierarchies.hh
(image_dimension_hierarchy, image_type_hierarchy): Rename as...
(image_hierarchy_wrt_dimension, image_hierarchy_wrt_type):
...this.
(image_neighborhood_hierarchy): Make it the third image hierarchy.
Rename as...
(image_hierarchy_wrt_neighborhood).
(image_value_hierarchy, image_rawness_hierarchy): Adjust and
rename as...
(image_hierarchy_wrt_value, image_hierarchy_wrt_data_retrieval):
...this.
(oln/core/abstract/image_having_neighborhood.hh): Include it.
* oln/core/abstract/image_dimension.hh:
s/image_dimension_hierarchy/image_hierarchy_wrt_dimension/.
(oln::abstract::image1d, oln::abstract::image2d)
(oln::abstract::image3d): Inherit from automatic::impl.
* oln/core/abstract/image_type.hh,
* oln/core/abstract/image_type_integre.hh:
s/image_type_hierarchy/image_hierarchy_wrt_type/.
* oln/core/abstract/image_having_neighborhood.hh: New
abstraction.
* oln/automatic/image_having_neighborhood.hh: New automatic
implementation.
* oln/morpher/internal/image_extension.hh: New abstract
class.
* oln/morpher/identity.hh,
* oln/morpher/add_neighborhood.hh: New morphers.
* tests/morphers.cc, tests/identity_morpher.cc: New tests.
* oln/Makefile.am (nobase_oln_HEADERS): Catch up with renamings
from the previous patches.
Add automatic/image_having_neighborhood.hh,
core/abstract/image_having_neighborhood.hh,
morpher/internal/image_extension.hh,
morpher/add_neighborhood.hh and
morpher/identity.hh.
* tests/Makefile.am (check_PROGRAMS): Add identity_morpher and
morphers.
(identity_morpher_SOURCES, morphers_SOURCES): New.
* oln/core/abstract/topology_hierarchies.hh: Aesthetic changes.
oln/Makefile.am | 39 ++++---
oln/automatic/image_having_neighborhood.hh | 62 +++++++++++
oln/core/abstract/image.hh | 2
oln/core/abstract/image_dimension.hh | 20 ++-
oln/core/abstract/image_having_neighborhood.hh | 101 +++++++++++++++++++
oln/core/abstract/image_hierarchies.hh | 17 ++-
oln/core/abstract/image_type.hh | 6 -
oln/core/abstract/image_type_integre.hh | 8 -
oln/core/abstract/topology_hierarchies.hh | 4
oln/core/image_entry.hh | 17 ++-
oln/core/typedefs.hh | 17 ---
oln/morpher/add_neighborhood.hh | 130 +++++++++++++++++++++++++
oln/morpher/identity.hh | 97 ++++++++++++++++++
oln/morpher/internal/image_extension.hh | 122 +++++++++++++++++++++++
tests/Makefile.am | 4
tests/identity_morpher.cc | 42 ++++++++
tests/morphers.cc | 62 +++++++++++
17 files changed, 698 insertions(+), 52 deletions(-)
Index: tests/morphers.cc
--- tests/morphers.cc (revision 0)
+++ tests/morphers.cc (revision 0)
@@ -0,0 +1,62 @@
+// Copyright (C) 2006 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.
+
+/// Test the identity morpher.
+
+// FIXME: We should not include oln/basics2d.hh, but oln/core/2d/image2d.hh.
+#include <oln/basics2d.hh>
+#include <oln/morpher/identity.hh>
+#include <oln/morpher/add_neighborhood.hh>
+
+// FIXME: Fake!
+// To be removed as soon as neighborhood2d is written.
+namespace oln
+{
+ struct neighborhood2d {};
+}
+
+int
+main()
+{
+ typedef oln::image2d<int> image_t;
+ image_t ima (42, 51);
+
+ typedef oln::morpher::add_neighborhood<image_t> image_with_nbh_t;
+ // FIXME: Using `oln_type_of_(image_t, neighborhood)' seems
+ // mandatory here. In fact, we cannot use oln::neighborhood2d
+ // directly like this
+ //
+ // oln::neighborhood2d nbh;
+ //
+ // since it confuses the compiler (g++ 4.0)!
+ typedef oln_type_of_(image_t, neighborhood) neighborhood_t;
+ neighborhood_t nbh;
+ image_with_nbh_t ima_with_nbh(ima, nbh);
+
+ typedef oln::morpher::identity<image_with_nbh_t> image_with_nbh_id_t;
+ image_with_nbh_id_t ima_with_nbh_id(ima_with_nbh);
+}
Index: tests/Makefile.am
--- tests/Makefile.am (revision 551)
+++ tests/Makefile.am (working copy)
@@ -11,11 +11,15 @@
check_PROGRAMS = \
grid \
+ identity_morpher \
image_entry \
+ morphers \
npoints
grid_SOURCES = grid.cc
+identity_morpher_SOURCES = identity_morpher.cc
image_entry_SOURCES = image_entry.cc
npoints_SOURCES = npoints.cc
+morphers_SOURCES = morphers.cc
TESTS = $(check_PROGRAMS)
Index: tests/identity_morpher.cc
--- tests/identity_morpher.cc (revision 0)
+++ tests/identity_morpher.cc (revision 0)
@@ -0,0 +1,42 @@
+// Copyright (C) 2006 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.
+
+/// Test the identity morpher.
+
+// FIXME: We should not include oln/basics2d.hh, but oln/core/2d/image2d.hh.
+#include <oln/basics2d.hh>
+#include <oln/morpher/identity.hh>
+
+int
+main()
+{
+ typedef oln::image2d<int> image_t;
+ image_t ima (42, 51);
+
+ typedef oln::morpher::identity<image_t> image_id_t;
+ image_id_t ima_id(ima);
+}
Index: oln/automatic/image_having_neighborhood.hh
--- oln/automatic/image_having_neighborhood.hh (revision 0)
+++ oln/automatic/image_having_neighborhood.hh (revision 0)
@@ -0,0 +1,62 @@
+// Copyright (C) 2006 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 OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
+# define OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
+
+# include <oln/core/typedefs.hh>
+# include <oln/morphers/identity.hh>
+# include <oln/core/abstract/image_dimension.hh>
+
+namespace oln
+{
+ namespace automatic
+ {
+
+ /// Implementation corresponding to the interface
+ /// oln::abstract::image1d for an identity morpher.
+ template <abstract::image_having_neighborhood, morpher::tag::identity,
+ typename E>
+ class impl
+ {
+ private:
+ typedef oln_type_of(E, neighborhood) neighborhood_t;
+
+ public:
+ /// Accessor delegation.
+ neighborhood_t impl_neighborhood()
+ {
+ return delegate().impl_neighborhood()
+
+ }
+ };
+
+ } // end of namespace automatic
+
+} // end of namespace oln
+
+#endif // ! OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
Index: oln/core/typedefs.hh
--- oln/core/typedefs.hh (revision 551)
+++ oln/core/typedefs.hh (working copy)
@@ -65,6 +65,7 @@
`-------*/
mlc_decl_typedef(exact_type);
+ mlc_decl_typedef(morpher_type);
/*----------.
@@ -119,16 +120,19 @@
// --------------------------------------------------------------------
mlc_decl_typedef(value_type);
mlc_decl_typedef(rvalue_type);
+
// --------------------------------------------------------------------
// FIXME: To be enabled later.
// --------------------------------------------------------------------
-// mlc_decl_typedef(neighb_type);
// mlc_decl_typedef(value_storage_type);
// mlc_decl_typedef(storage_type);
// --------------------------------------------------------------------
mlc_decl_typedef(psite_type);
mlc_decl_typedef(point_type);
mlc_decl_typedef(dpoint_type);
+
+ mlc_decl_typedef(neighborhood_type);
+
// --------------------------------------------------------------------
// FIXME: To be enabled later.
// --------------------------------------------------------------------
@@ -144,17 +148,6 @@
// FIXME: To be enabled later.
// --------------------------------------------------------------------
// mlc_decl_typedef(window_type);
-
-// mlc_decl_typedef(image_neighbness_type);
-// mlc_decl_typedef(image_constness_type);
-// --------------------------------------------------------------------
- mlc_decl_typedef(image_dimension_type);
- mlc_decl_typedef(image_typeness_type);
-// --------------------------------------------------------------------
-// FIXME: To be enabled later.
-// --------------------------------------------------------------------
-// mlc_decl_typedef(image_valuedness_type);
-// mlc_decl_typedef(image_rawness_type);
// --------------------------------------------------------------------
// ------------------------------ //
Index: oln/core/image_entry.hh
--- oln/core/image_entry.hh (revision 551)
+++ oln/core/image_entry.hh (working copy)
@@ -56,17 +56,19 @@
typedef mlc::undefined topo_type;
typedef mlc::undefined grid_type;
- // psite_type: see below
+ // psite_type: see below.
typedef mlc::undefined point_type;
- // piter_type: see below
+ // piter_type: see below.
typedef mlc::undefined fwd_piter_type;
typedef mlc::undefined bkd_piter_type;
typedef mlc::undefined value_type;
- // rvalue_type: see below
+ // rvalue_type: see below.
typedef mlc::undefined concrete_type;
+
+ // morpher_type: see below.
};
@@ -90,6 +92,15 @@
typedef oln_type_of(E, value) ret;
};
+ /// \brief Morpher type.
+ ///
+ /// Optionally contains a tag indicating a kind of morpher.
+ template <typename E>
+ struct single_vtype< image_entry<E>, typedef_::morpher_type >
+ {
+ typedef mlc::none ret;
+ };
+
} // end of namespace oln
Index: oln/core/abstract/image.hh
--- oln/core/abstract/image.hh (revision 551)
+++ oln/core/abstract/image.hh (working copy)
@@ -77,6 +77,8 @@
stc_virtual_typedef(concrete);
+ stc_virtual_typedef(morpher);
+
decl() {
// FIXME: ...
}
Index: oln/core/abstract/topology_hierarchies.hh
--- oln/core/abstract/topology_hierarchies.hh (revision 551)
+++ oln/core/abstract/topology_hierarchies.hh (working copy)
@@ -40,10 +40,10 @@
} // end of namespace oln
-// hierarchy 1: topology wrt accessibility
+// Hierarchy 1: topology w.r.t. accessibility.
# include <oln/core/abstract/topology_being_random_accessible.hh>
-// hierarchy 2: topology wrt bbox
+// Hierarchy 2: topology w.r.t. bbox.
# include <oln/core/abstract/topology_having_bbox.hh>
Index: oln/core/abstract/image_type.hh
--- oln/core/abstract/image_type.hh (revision 551)
+++ oln/core/abstract/image_type.hh (working copy)
@@ -232,7 +232,7 @@
/// Binary case.
template <typename E>
- struct case_< image_type_hierarchy, E, 1 > :
+ struct case_< image_hierarchy_wrt_type, E, 1 > :
where_< mlc::eq_< oln_type_of(E, value), bool > >
{
// Definition of the super class corresponding to this case.
@@ -241,7 +241,7 @@
/// Grey-level case.
template <typename E>
- struct case_< image_type_hierarchy, E, 2 > :
+ struct case_< image_hierarchy_wrt_type, E, 2 > :
where_< mlc::or_list_< mlc::eq_<oln_type_of(E, value), char>,
mlc::eq_<oln_type_of(E, value), signed char>,
mlc::eq_<oln_type_of(E, value), unsigned char> > >
@@ -259,7 +259,7 @@
/// Default case: image of ``data''.
template <typename E>
- struct default_case_< image_type_hierarchy, E >
+ struct default_case_< image_hierarchy_wrt_type, E >
{
// Definition of the super class corresponding to this case
// (abstract::data_image_ is the conjunction of
Index: oln/core/abstract/image_dimension.hh
--- oln/core/abstract/image_dimension.hh (revision 551)
+++ oln/core/abstract/image_dimension.hh (working copy)
@@ -51,7 +51,7 @@
o
|
- /switch_<image_dimension_hierarchy, I>::ret/
+ /switch_<image_hierarchy_wrt_dimension, I>::ret/
(image dimension selector)
^
|
@@ -81,7 +81,9 @@
/// Class of 1-D images.
template <typename E>
- struct image1d : public virtual image<E>
+ struct image1d :
+ public virtual image<E>,
+ public automatic::impl< image1d, oln_type_of(E, morpher), E>
{
protected:
/// Constructor (protected, empty).
@@ -90,7 +92,9 @@
/// Class of 2-D images.
template <typename E>
- struct image2d : public virtual image<E>
+ struct image2d :
+ public virtual image<E>,
+ public automatic::impl< image2d, oln_type_of(E, morpher), E>
{
protected:
/// Constructor (protected, empty).
@@ -99,7 +103,9 @@
/// Class of 3-D images.
template <typename E>
- struct image3d : public virtual image<E>
+ struct image3d :
+ public virtual image<E>,
+ public automatic::impl< image3d, oln_type_of(E, morpher), E>
{
protected:
/// Constructor (protected, empty).
@@ -125,7 +131,7 @@
/// 1-D case.
template <typename E>
- struct case_< image_dimension_hierarchy, E, 1 > :
+ struct case_< image_hierarchy_wrt_dimension, E, 1 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid1d > >
{
typedef abstract::image1d<E> ret;
@@ -133,7 +139,7 @@
/// 2-D case.
template <typename E>
- struct case_< image_dimension_hierarchy, E, 2 > :
+ struct case_< image_hierarchy_wrt_dimension, E, 2 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid2d > >
{
typedef abstract::image2d<E> ret;
@@ -141,7 +147,7 @@
/// 3-D case.
template <typename E>
- struct case_< image_dimension_hierarchy, E, 3 > :
+ struct case_< image_hierarchy_wrt_dimension, E, 3 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid3d > >
{
typedef abstract::image3d<E> ret;
Index: oln/core/abstract/image_hierarchies.hh
--- oln/core/abstract/image_hierarchies.hh (revision 551)
+++ oln/core/abstract/image_hierarchies.hh (working copy)
@@ -34,24 +34,29 @@
namespace oln
{
- typedef hierarchy<abstract::image, 1> image_dimension_hierarchy;
- typedef hierarchy<abstract::image, 2> image_type_hierarchy;
+ typedef hierarchy<abstract::image, 1> image_hierarchy_wrt_dimension;
+ typedef hierarchy<abstract::image, 2> image_hierarchy_wrt_type;
+ typedef hierarchy<abstract::image, 3> image_hierarchy_wrt_neighborhood;
// FIXME: To be continued.
#if 0
- typedef hierarchy<abstract::image, 3> image_value_hierarchy;
- // FIXME: Rename (``rawness'' means ``crudit�'' in French...).
- typedef hierarchy<abstract::image, 4> image_rawness_hierarchy;
- typedef hierarchy<abstract::image, 5> image_neighborhood_hierarchy;
+ typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_value;
+ typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_data_retrieval;
// ...
#endif
} // end of namespace oln
+// Hierarchy 1: topology w.r.t. dimension.
# include <oln/core/abstract/image_dimension.hh>
+
+// Hierarchy 2: topology w.r.t. type of data.
# include <oln/core/abstract/image_type.hh>
+// Hierarchy 3: topology w.r.t. neighborhood.
+# include <oln/core/abstract/image_having_neighborhood.hh>
+
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HIERARCHIES_HH
Index: oln/core/abstract/image_type_integre.hh
--- oln/core/abstract/image_type_integre.hh (revision 551)
+++ oln/core/abstract/image_type_integre.hh (working copy)
@@ -96,7 +96,7 @@
/// Binary case.
template <typename E>
- struct case_< image_type_hierarchy, E, 3 > :
+ struct case_< image_hierarchy_wrt_type, E, 3 > :
where_< mlc::or_list_< mlc::eq_<oln_type_of(E, value), ntg::bin>,
ntg::eq_<ntg::int_u, 1, oln_type_of(E, value)>,
ntg::eq_<ntg::int_s, 1, oln_type_of(E, value)> > >
@@ -107,7 +107,7 @@
/// Grey-level case.
template <typename E>
- struct case_< image_type_hierarchy, E, 4 > :
+ struct case_< image_hierarchy_wrt_type, E, 4 > :
where_< mlc_is_a( mlc_comma_1(oln_type_of(E, value)), ntg::real_value ) >
{
// Definition of the super class corresponding to this case
@@ -118,7 +118,7 @@
/// Label case.
template <typename E>
- struct case_< image_type_hierarchy, E, 5 > :
+ struct case_< image_hierarchy_wrt_type, E, 5 > :
where_< mlc_is_a( mlc_comma_1(oln_type_of(E, value)), ntg::enum_value ) >
{
// Definition of the super class corresponding to this case
@@ -129,7 +129,7 @@
/// Color case.
template <typename E>
- struct case_< image_type_hierarchy, E, 6 > :
+ struct case_< image_hierarchy_wrt_type, E, 6 > :
where_< mlc_is_a( mlc_comma_1(oln_type_of(E, value)), ntg::color_value ) >
{
// Definition of the super class corresponding to this case
Index: oln/core/abstract/image_having_neighborhood.hh
--- oln/core/abstract/image_having_neighborhood.hh (revision 0)
+++ oln/core/abstract/image_having_neighborhood.hh (revision 0)
@@ -0,0 +1,101 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
+
+# include <oln/core/abstract/image.hh>
+
+
+/* Image having neighborhood hierarchy (summary).
+
+
+FIXME: TODO!
+
+
+ Default case: If the neighborhood type returned by
+ `oln_type_of(I, neighborhood)', the entry is directly plugged to
+ abstract::image<I>. */
+
+
+namespace oln
+{
+
+ /*-------------------------.
+ | Dimension abstractions. |
+ `-------------------------*/
+
+ namespace abstract
+ {
+
+ /// Class of 1-D images.
+ template <typename E>
+ struct image_having_neighborhood :
+ public virtual image<E>,
+ public automatic::impl< image_having_neighborhood,
+ oln_type_of(E, morpher),
+ E >
+ {
+ protected:
+ /// Constructor (protected, empty).
+ image_having_neighborhood() {}
+ };
+
+ } // end of namespace oln::abstract
+
+
+ /*-------------------.
+ | Dimension switch. |
+ `-------------------*/
+
+ /// With neig
+ template <typename E>
+ struct case_< image_hierarchy_wrt_neighborhood, E, 1 > :
+ where_< mlc::neq_< oln_type_of(E, neighborhood), mlc::none > >
+ {
+ typedef abstract::image_having_neighborhood<E> ret;
+ };
+
+
+ /*-----------------.
+ | External vtype. |
+ `-----------------*/
+
+ // Forward declaration.
+ template <typename E> struct image_entry;
+
+ /// Neighborhood type, as extended virtual type.
+ template <typename E>
+ struct ext_vtype < image_entry<E>, typedef_::neighborhood_type >
+ {
+ typedef mlc::none ret;
+ };
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
Index: oln/Makefile.am
--- oln/Makefile.am (revision 551)
+++ oln/Makefile.am (working copy)
@@ -3,6 +3,8 @@
olndir = $(includedir)/oln
nobase_oln_HEADERS = \
+ automatic/image_having_neighborhood.hh \
+ \
core/1d/grid1d.hh \
\
core/2d/grid2d.hh \
@@ -19,42 +21,49 @@
core/abstract/any.hh \
core/abstract/bbox.hh \
core/abstract/dpoint.hh \
- core/abstract/dpoint_nd.hh \
core/abstract/entry.hh \
core/abstract/grid.hh \
- core/abstract/image_dimension.hh \
core/abstract/image.hh \
+ core/abstract/image_dimension.hh \
+ core/abstract/image_having_neighborhood.hh \
core/abstract/image_hierarchies.hh \
core/abstract/image_type.hh \
core/abstract/image_type_integre.hh \
- core/abstract/iter.hh \
- core/abstract/piter.hh \
+ core/abstract/iterator.hh \
+ core/abstract/iterator_on_points.hh \
core/abstract/point.hh \
- core/abstract/point_nd.hh \
- core/abstract/pset_bboxed.hh \
- core/abstract/pset_cnx.hh \
- core/abstract/pset_fixed.hh \
- core/abstract/pset.hh \
- core/abstract/pset_hierarchies.hh \
- core/abstract/pset_ra.hh \
+ core/abstract/point_set.hh \
+ core/abstract/point_set_being_connected.hh \
+ core/abstract/point_set_being_random_accessible.hh \
+ core/abstract/point_set_having_bbox.hh \
+ core/abstract/point_set_having_known_size.hh \
+ core/abstract/point_set_hierarchies.hh \
core/abstract/topology.hh \
- core/abstract/topology_hierarchies.hh \
core/abstract/topology_being_random_accessible.hh \
core/abstract/topology_having_bbox.hh \
+ core/abstract/topology_hierarchies.hh \
\
core/gen/bbox.hh \
+ core/gen/bbox_bkd_piter.hh \
+ core/gen/bbox_fwd_piter.hh \
core/gen/topo_bbox.hh \
- core/gen/bkd_piter.hh \
- core/gen/fwd_piter.hh \
+ \
+ core/internal/dpoint_nd.hh \
+ core/internal/point_nd.hh \
\
core/case.hh \
core/image_entry.hh \
core/macros.hh \
- core/pset_entry.hh \
+ core/point_set_entry.hh \
core/traits.hh \
core/traits_id.hh \
core/topology_entry.hh \
core/typedefs.hh \
core/type.hh \
\
+ morpher/internal/image_extension.hh \
+ \
+ morpher/add_neighborhood.hh \
+ morpher/identity.hh \
+ \
basics2d.hh
Index: oln/morpher/identity.hh
--- oln/morpher/identity.hh (revision 0)
+++ oln/morpher/identity.hh (revision 0)
@@ -0,0 +1,97 @@
+// Copyright (C) 2006 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 OLENA_MORPHER_IDENTITY
+# define OLENA_MORPHER_IDENTITY
+
+# include <oln/morpher/internal/image_extension.hh>
+
+
+namespace oln
+{
+
+ namespace morpher
+ {
+ // Forward declaration.
+ template <typename Image>
+ struct identity;
+
+
+ namespace tag
+ {
+ /// Tag associated to oln::morpher::identity.
+ struct identity;
+
+ } // end of namespace oln::morpher::tag
+
+ } // end of namespace oln::morpher
+
+
+ /// Super type.
+ template <typename Image>
+ struct set_super_type< morpher::identity<Image> >
+ {
+ typedef morpher::identity<Image> self_t;
+ typedef morpher::internal::image_extension<Image, self_t> ret;
+ };
+
+
+ /// New virtual types associated with oln::morpher::identity.
+ /// \{
+ template <typename Image>
+ struct single_vtype < morpher::identity<Image>, typedef_::morpher_type >
+ {
+ typedef oln::morpher::tag::identity ret;
+ };
+ /// \}
+
+
+ namespace morpher
+ {
+ /// Identity morpher.
+ template <typename Image>
+ // FIXME:
+ class identity : public stc_get_supers(identity<Image>)
+ {
+ private:
+ typedef identity<Image> self_t;
+ typedef stc_get_nth_super(self_t, 1) super_t;
+
+ public:
+ // FIXME: Handle the constness.
+ identity(const Image& image) :
+ super_t(image)
+ {
+ }
+
+ };
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+#endif // ! OLENA_MORPHER_IDENTITY
Index: oln/morpher/internal/image_extension.hh
--- oln/morpher/internal/image_extension.hh (revision 0)
+++ oln/morpher/internal/image_extension.hh (revision 0)
@@ -0,0 +1,122 @@
+// Copyright (C) 2006 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 OLENA_MORPHER_INTERNAL_IMAGE_EXTENSION
+# define OLENA_MORPHER_INTERNAL_IMAGE_EXTENSION
+
+# include <oln/core/image_entry.hh>
+
+
+namespace oln
+{
+ namespace morpher
+ {
+ namespace internal
+ {
+
+ // Forward declaration.
+ template <typename Image, typename Exact>
+ struct image_extension;
+
+ } // end of namespace oln::morpher::internal
+
+ } // end of namespace oln::morpher
+
+
+ // FIXME: Use set_super_type instead?
+ /// Create an ``uplink'' from
+ /// oln::morpher::internal::image_extension to the morphed \a Image,
+ /// so as to get all its virtual types.
+ template <typename Image, typename Exact>
+ struct set_pseudosuper_type< morpher::internal::image_extension<Image,
+ Exact> >
+ {
+ typedef Image ret;
+ };
+
+
+ namespace morpher
+ {
+ namespace internal
+ {
+
+ /// Image_Extension morpher.
+ template <typename Image, typename Exact>
+ class image_extension :
+ public oln::image_entry< image_extension<Image, Exact> >
+ {
+ private:
+ typedef image_extension<Image, Exact> self_t;
+
+ /// Type of morphed image.
+ typedef Image image_t;
+
+ typedef oln_type_of(self_t, topo) topo_t;
+ typedef oln_type_of(self_t, value) value_t;
+ typedef oln_type_of(self_t, point) point_t;
+
+ public:
+ // FIXME: Handle the constness.
+ image_extension(const Image& image) :
+ image_(image)
+ {
+ }
+
+ const Image& delegate() const
+ {
+ return image_;
+ }
+
+ /// Delegations.
+ /// \{
+ const topo_t& impl_topo() const
+ {
+ return delegate()->impl_topo();
+ }
+
+ value_t impl_op_read(const point_t& p) const
+ {
+ return delegate()->impl_op_read(p);
+ }
+
+ bool impl_has(const point_t& p) const
+ {
+ return delegate()->impl_has(p);
+ }
+ /// \}
+
+ protected:
+ const Image& image_;
+ };
+
+ } // end of namespace oln::morpher::internal
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+#endif // ! OLENA_MORPHER_INTERNAL_IMAGE_EXTENSION
Index: oln/morpher/add_neighborhood.hh
--- oln/morpher/add_neighborhood.hh (revision 0)
+++ oln/morpher/add_neighborhood.hh (revision 0)
@@ -0,0 +1,130 @@
+// Copyright (C) 2006 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 OLENA_MORPHER_ADD_NEIGHBORHOOD
+# define OLENA_MORPHER_ADD_NEIGHBORHOOD
+
+# include <oln/morpher/internal/image_extension.hh>
+
+
+namespace oln
+{
+
+ namespace morpher
+ {
+ // Forward declaration.
+ template <typename Image>
+ struct add_neighborhood;
+
+ namespace tag
+ {
+ /// Tag associated to oln::morpher::add_neighborhood.
+ struct add_neighborhood;
+
+ } // end of namespace oln::morpher::tag
+
+ } // end of namespace oln::morpher
+
+
+ /// Super type.
+ template <typename Image>
+ struct set_super_type< morpher::add_neighborhood<Image> >
+ {
+ typedef morpher::add_neighborhood<Image> self_t;
+ typedef morpher::internal::image_extension<Image, self_t> ret;
+ };
+
+
+ /// New virtual types associated with oln::morpher::add_neighborhood.
+ /// \{
+ template <typename Image>
+ struct single_vtype < morpher::add_neighborhood<Image>,
+ typedef_::morpher_type >
+ {
+ typedef oln::morpher::tag::add_neighborhood ret;
+ };
+ /// \}
+
+
+ namespace morpher
+ {
+ /// Neighborhood addition morpher.
+ template <typename Image>
+ class add_neighborhood : public stc_get_supers(add_neighborhood<Image>)
+ {
+ private:
+ typedef add_neighborhood<Image> self_t;
+ typedef stc_get_nth_super(self_t, 1) super_t;
+ typedef oln_type_of(Image, neighborhood) neighborhood_t;
+
+ public:
+ // FIXME: Handle the constness.
+ add_neighborhood(const Image& image, const neighborhood_t& nbh) :
+ super_t(image), nbh_(nbh)
+ {
+ }
+
+ neighborhood_t impl_neighborhood() const
+ {
+ return nbh_;
+ }
+
+ protected:
+ neighborhood_t nbh_;
+ };
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+
+// FIXME: This is probably not the right place for this.
+// Where should we move this?
+#include <oln/core/abstract/image.hh>
+namespace oln
+{
+ /// Neighborhood-related definitions.
+ /// \{
+ // Forward declarations.
+ template <typename T> struct image2d;
+ struct neighborhood2d;
+ namespace morpher {
+ template <typename Image> struct add_neighborhood;
+ }
+
+ // External vtype.
+ template <typename T>
+ struct ext_vtype < morpher::add_neighborhood< oln::image2d<T> >,
+ typedef_::neighborhood_type >
+ {
+ typedef neighborhood2d ret;
+ };
+ /// \}
+}
+
+
+#endif // ! OLENA_MORPHER_ADD_NEIGHBORHOOD