2006-10-05 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Decouple iterators from image topology; update neighborhood tools
and start to add window tools.
* oln/core/automatic/topology_having_subset.hh: New.
* oln/core/abstract/topology_having_subset.hh: New.
* oln/core/gen/fwd_niter_neighb.hh: New.
* oln/core/gen/fwd_qiter_win.hh: New.
* oln/core/gen/window.hh: New.
* oln/core/typedefs.hh
(qiter_type, fwd_qiter_type, bkd_qiter_type): Uncomment.
(niter_type, fwd_niter_type, bkd_niter_type): Uncomment.
(isubset): Rename into...
(subset_type): ...this.
* oln/core/macros.hh
(oln_type_of, oln_deduce_type_of, oln_type_of_): Rely on direct access.
(oln_check_type_of, oln_check_type_of_): Rely on direct access.
(oln_deduce_direct_type_of): New.
* oln/core/topology_entry.hh (subset_type): New.
* oln/core/image_entry.hh (fwd_piter_type, bkd_piter_type): Move
from vtypes to single_vtype.
(fwd_qiter_type): New.
* oln/core/abstract/topology_hierarchies.hh
(topology_hierarchy_wrt_subset): New.
(include): Add topology_having_subset.hh.
* oln/core/abstract/image/neighborhood/hierarchy.hh
(niter, fwd_niter, bkd_niter): New in decl.
* oln/core/2d/aliases.hh
(fwd_piter_bbox_, bkd_piter_bbox_): Change param letter.
(fwd_piter2d, bkd_piter2d): Update.
* oln/core/2d/neighb2d.hh (c4, c8, c2_row, c2_col): Rename into...
(mk_c4, mk_c8, mk_c2_row, mk_c2_col): ...these in namespace internal.
(c4, c8, c2r, c2c): New objects.
* oln/core/gen/piter_isubset.hh (piter_isubset_): New ctor for
iterators around a point.
(topo): Return a copy.
(change_topology_): Remove; obsolete.
* oln/core/gen/topo_add_isubset.hh (isubset_type): Rename into...
(subset_type): ...this.
(isubset): Rename into...
(impl_subset): ...this.
* oln/core/gen/topo_bbox.hh (impl_lbbox): New; experimental!
* oln/core/gen/fwd_piter_bbox.hh (fwd_piter_bbox_): Change parameter
from topo to point; update.
(topo): Remove this method; obsolete.
(change_topology_): Remove; obsolete.
(topo_): Remove this attribute; obsolete.
* oln/core/gen/bkd_piter_bbox.hh: Likewise.
* oln/basics2d.hh: Update.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
* oln/core/2d/image2d.hh
(fwd_piter_type, bkd_piter_type): Move these definitions into...
* oln/core/fwd_piter.hh: ... this new file.
* oln/morpher/add_isubset.hh: Likewise.
* oln/morpher/add_neighborhood.hh: Likewise.
* oln/morpher/internal/image_extension.hh (image_): Change from
const& to plain type.
Index: oln/core/fwd_piter.hh
===================================================================
--- oln/core/fwd_piter.hh (revision 0)
+++ oln/core/fwd_piter.hh (revision 0)
@@ -0,0 +1,131 @@
+// 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 OLN_CORE_FWD_PITER_HH
+# define OLN_CORE_FWD_PITER_HH
+
+# include <oln/core/abstract/entry.hh>
+# include <oln/core/abstract/image.hh>
+
+
+namespace oln
+{
+
+ // morpher::add_isubset<Image, Isubset>
+
+ namespace morpher {
+ template <typename Image, typename Isubset> struct add_isubset;
+ }
+ template <typename piter_t, typename isubset_t> class piter_isubset_;
+
+
+ template <typename Image, typename Isubset>
+ struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::fwd_piter_type >
+ {
+ typedef piter_isubset_<oln_type_of(Image, fwd_piter), Isubset> ret;
+ };
+
+ template <typename Image, typename Isubset>
+ struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::bkd_piter_type >
+ {
+ typedef piter_isubset_<oln_type_of(Image, bkd_piter), Isubset> ret;
+ };
+
+
+ template <typename Image, typename Isubset>
+ struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::fwd_qiter_type >
+ {
+ typedef piter_isubset_<oln_type_of(Image, fwd_qiter), Isubset> ret;
+ };
+
+ template <typename Image, typename Isubset>
+ struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::bkd_qiter_type >
+ {
+ typedef piter_isubset_<oln_type_of(Image, bkd_qiter), Isubset> ret;
+ };
+
+
+ template <typename Image, typename Isubset>
+ struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::fwd_niter_type >
+ {
+ typedef piter_isubset_<oln_type_of(Image, fwd_niter), Isubset> ret;
+ };
+
+ template <typename Image, typename Isubset>
+ struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::bkd_niter_type >
+ {
+ typedef piter_isubset_<oln_type_of(Image, bkd_niter), Isubset> ret;
+ };
+
+
+ // morpher::add_neighborhood<Image, Isubset>
+
+ namespace morpher {
+ template <typename Image, typename Neighb> struct add_neighborhood;
+ }
+ template <typename point_t> class fwd_niter_neighb_;
+
+ template <typename Image, typename Neighb>
+ struct single_vtype< morpher::add_neighborhood<Image, Neighb>,
typedef_::fwd_niter_type >
+ {
+ private:
+ typedef oln_type_of(Image, point) point_t;
+ public:
+ typedef fwd_niter_neighb_<point_t> ret;
+ };
+
+ template <typename Image, typename Neighb>
+ struct single_vtype< morpher::add_neighborhood<Image, Neighb>,
typedef_::bkd_niter_type >
+ {
+ private:
+ typedef oln_type_of(Image, point) point_t;
+ public:
+ typedef fwd_niter_neighb_<point_t> ret; // FIXME: should be bkd but not yet
impled!
+ };
+
+
+ // image2d<T>
+
+ template <typename T> class image2d;
+
+ template <typename T>
+ struct single_vtype< image2d<T>, typedef_::fwd_piter_type >
+ {
+ typedef fwd_piter2d ret;
+ };
+
+ template <typename T>
+ struct single_vtype< image2d<T>, typedef_::bkd_piter_type >
+ {
+ typedef bkd_piter2d ret;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_FWD_PITER_HH
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 606)
+++ oln/core/typedefs.hh (working copy)
@@ -90,13 +90,13 @@
mlc_decl_typedef(fwd_piter_type);
mlc_decl_typedef(bkd_piter_type);
-// mlc_decl_typedef(qiter_type);
-// mlc_decl_typedef(fwd_qiter_type);
-// mlc_decl_typedef(bkd_qiter_type);
+ mlc_decl_typedef(qiter_type);
+ mlc_decl_typedef(fwd_qiter_type);
+ mlc_decl_typedef(bkd_qiter_type);
-// mlc_decl_typedef(niter_type);
-// mlc_decl_typedef(fwd_niter_type);
-// mlc_decl_typedef(bkd_niter_type);
+ mlc_decl_typedef(niter_type);
+ mlc_decl_typedef(fwd_niter_type);
+ mlc_decl_typedef(bkd_niter_type);
// --------------------------------------------------------------------
@@ -134,7 +134,7 @@
mlc_decl_typedef(dpoint_type);
mlc_decl_typedef(neighborhood_type);
- mlc_decl_typedef(isubset);
+ mlc_decl_typedef(subset_type);
// --------------------------------------------------------------------
// FIXME: To be enabled later.
Index: oln/core/macros.hh
===================================================================
--- oln/core/macros.hh (revision 606)
+++ oln/core/macros.hh (working copy)
@@ -38,23 +38,32 @@
/// an oln type \a OlnType whose category is not specified (version to be
/// used inside a template).
# define oln_type_of(OlnType, Alias) \
- stc_type_of(oln, void, OlnType, Alias)
+ stc_direct_type_of(oln, void, OlnType, Alias)
+// FIXME: Remove direct_ above.
/// FIXME: Temporary macro to be able to perform "oln_type_of(oln_type_of(A, B),
C)".
# define oln_deduce_type_of(OlnType, Alias1, Alias2) \
-typename oln::type_of_<void, \
- typename oln::type_of_<void, OlnType,
oln::typedef_::Alias1##_type >::ret, \
+typename oln::direct_type_of_<void, \
+ typename oln::direct_type_of_<void, OlnType,
oln::typedef_::Alias1##_type >::ret, \
oln::typedef_::Alias2##_type >::ret
+// FIXME: Remove direct_ *twice* above.
+# define oln_deduce_direct_type_of(OlnType, Alias1, Alias2) \
+typename oln::direct_type_of_<void, \
+ typename oln::direct_type_of_<void, OlnType,
oln::typedef_::Alias1##_type >::ret, \
+ oln::typedef_::Alias2##_type >::ret
+
+
/// \def oln_type_of(OlnType, Alias)
///
/// Macro to retrieve an associated type \a Alias from the exact type of
/// an oln type \a OlnType whose category is not specified (version to be
/// used outside a template).
# define oln_type_of_(OlnType, Alias) \
- stc_type_of_(oln, void, OlnType, Alias)
+ stc_direct_type_of_(oln, void, OlnType, Alias)
+// FIXME: Remove direct_ above.
/// \def oln_direct_type_of(OlnType, Alias)
@@ -90,7 +99,8 @@
///
/// If the virtual type is not found, raise a static error.
# define oln_check_type_of(OlnType, Alias) \
- stc_check_type_of(oln, void, OlnType, Alias)
+ stc_check_direct_type_of(oln, void, OlnType, Alias)
+// FIXME: Remove direct_ above.
/// \def oln_check_type_of(OlnType, Alias)
///
@@ -100,7 +110,8 @@
///
/// If the virtual type is not found, raise a static error.
# define oln_check_type_of_(OlnType, Alias) \
- stc_check_type_of_(oln, void, OlnType, Alias)
+ stc_check_direct_type_of_(oln, void, OlnType, Alias)
+// FIXME: Remove direct_ above.
/// \def oln_check_direct_type_of(OlnType, Alias)
Index: oln/core/automatic/topology_having_subset.hh
===================================================================
--- oln/core/automatic/topology_having_subset.hh (revision 0)
+++ oln/core/automatic/topology_having_subset.hh (revision 0)
@@ -0,0 +1,74 @@
+// 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 OLN_CORE_AUTOMATIC_TOPOLOGY_HAVING_SUBSET_HH
+# define OLN_CORE_AUTOMATIC_TOPOLOGY_HAVING_SUBSET_HH
+
+# include <oln/core/automatic/impl.hh>
+# include <oln/morpher/tags.hh>
+
+
+namespace oln
+{
+
+ // Forward declaration.
+ namespace abstract
+ {
+ template <typename E> class topology_having_subset;
+
+ } // end of namespace oln::abstract
+
+
+ namespace automatic
+ {
+
+ /// Implementation corresponding to the interface
+ /// oln::abstract::topology_having_subset for an identity morpher.
+
+ template <typename E>
+ class set_impl< abstract::topology_having_subset,
+ morpher::tag::identity,
+ E > :
+ public virtual stc::any__simple<E>
+ {
+ private:
+ typedef oln_type_of(E, subset) subset_t;
+
+ public:
+
+ const subset_t& impl_subset() const
+ {
+ return this->exact().delegate().subset();
+ }
+
+ };
+
+ } // end of namespace oln::automatic
+
+} // end of namespace oln
+
+#endif // ! OLN_CORE_AUTOMATIC_TOPOLOGY_HAVING_SUBSET_HH
Index: oln/core/topology_entry.hh
===================================================================
--- oln/core/topology_entry.hh (revision 606)
+++ oln/core/topology_entry.hh (working copy)
@@ -57,6 +57,7 @@
typedef mlc::undefined bbox_type;
typedef mlc::none neighborhood_type;
typedef mlc::undefined is_random_accessible_type;
+ typedef mlc::none subset_type;
};
template <typename E>
Index: oln/core/image_entry.hh
===================================================================
--- oln/core/image_entry.hh (revision 606)
+++ oln/core/image_entry.hh (working copy)
@@ -59,10 +59,6 @@
// psite_type: see below.
typedef mlc::undefined point_type;
- // 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.
@@ -96,6 +92,28 @@
};
+ // Fwd piter.
+ template <typename E>
+ struct single_vtype< image_entry<E>, typedef_::fwd_piter_type >
+ {
+ typedef mlc::undefined ret;
+ };
+
+ // Bkd piter.
+ template <typename E>
+ struct single_vtype< image_entry<E>, typedef_::bkd_piter_type >
+ {
+ typedef mlc::undefined ret;
+ };
+
+ // Fwd qiter.
+ template <typename E>
+ struct single_vtype< image_entry<E>, typedef_::fwd_qiter_type >
+ {
+ typedef mlc::undefined ret;
+ };
+
+
} // end of namespace oln
Index: oln/core/abstract/topology_hierarchies.hh
===================================================================
--- oln/core/abstract/topology_hierarchies.hh (revision 606)
+++ oln/core/abstract/topology_hierarchies.hh (working copy)
@@ -37,6 +37,7 @@
typedef hierarchy< abstract::topology, 1 >
topology_hierarchy_wrt_accessibility;
typedef hierarchy< abstract::topology, 2 > topology_hierarchy_wrt_bbox;
typedef hierarchy< abstract::topology, 3 >
topology_hierarchy_wrt_neighborhood;
+ typedef hierarchy< abstract::topology, 4 > topology_hierarchy_wrt_subset;
} // end of namespace oln
@@ -47,10 +48,13 @@
// Hierarchy 2: topology w.r.t. bounding box.
# include <oln/core/abstract/topology_having_bbox.hh>
-// Hierarchy 2: topology w.r.t. neighborhood.
+// Hierarchy 3: topology w.r.t. neighborhood.
# include <oln/core/abstract/topology_having_neighborhood.hh>
+// Hierarchy 4: topology w.r.t. neighborhood.
+# include <oln/core/abstract/topology_having_subset.hh>
+
#endif // ! OLN_CORE_ABSTRACT_TOPOLOGY_HIERARCHIES_HH
Index: oln/core/abstract/image/neighborhood/hierarchy.hh
===================================================================
--- oln/core/abstract/image/neighborhood/hierarchy.hh (revision 606)
+++ oln/core/abstract/image/neighborhood/hierarchy.hh (working copy)
@@ -65,9 +65,9 @@
public:
struct decl {
- // FIXME: Uncomment.
- // stc_virtual_typedef(fwd_niter);
- // stc_virtual_typedef(bkd_niter);
+ // stc_virtual_typedef(niter);
+ stc_virtual_typedef(fwd_niter);
+ stc_virtual_typedef(bkd_niter);
};
const neighborhood_t& neighborhood() const
Index: oln/core/abstract/topology_having_subset.hh
===================================================================
--- oln/core/abstract/topology_having_subset.hh (revision 0)
+++ oln/core/abstract/topology_having_subset.hh (revision 0)
@@ -0,0 +1,77 @@
+// 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 OLN_CORE_ABSTRACT_TOPOLOGY_HAVING_SUBSET_HH
+# define OLN_CORE_ABSTRACT_TOPOLOGY_HAVING_SUBSET_HH
+
+# include <oln/core/abstract/topology.hh>
+# include <oln/core/automatic/topology_having_subset.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+ template <typename E>
+ class topology_having_subset
+ : public virtual topology<E>,
+ public automatic::get_impl<topology_having_subset, E>
+ {
+ typedef oln_type_of(E, subset) subset_t;
+
+ public:
+
+ // abstract
+ const subset_t& subset() const
+ {
+ return this->exact().impl_subset();
+ }
+
+ protected:
+
+ topology_having_subset()
+ {}
+ };
+
+
+ } // end of namespace oln::abstract
+
+
+ template <typename E>
+ struct case_ < topology_hierarchy_wrt_subset, E, 1 >
+ : where_< mlc::neq_< oln_type_of(E, subset), mlc::none > >
+ {
+ typedef abstract::topology_having_subset<E> ret;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_ABSTRACT_TOPOLOGY_HAVING_SUBSET_HH
Index: oln/core/2d/aliases.hh
===================================================================
--- oln/core/2d/aliases.hh (revision 606)
+++ oln/core/2d/aliases.hh (working copy)
@@ -40,8 +40,8 @@
template <typename D> class neighb_;
template <typename P> class bbox_;
template <typename P> class topo_lbbox_;
- template <typename T> class fwd_piter_bbox_;
- template <typename T> class bkd_piter_bbox_;
+ template <typename P> class fwd_piter_bbox_;
+ template <typename P> class bkd_piter_bbox_;
class grid2d;
/// \}
@@ -55,8 +55,8 @@
typedef bbox_<point2d> bbox2d;
typedef topo_lbbox_<point2d> topo2d;
- typedef fwd_piter_bbox_<topo2d> fwd_piter2d;
- typedef bkd_piter_bbox_<topo2d> bkd_piter2d;
+ typedef fwd_piter_bbox_<point2d> fwd_piter2d;
+ typedef bkd_piter_bbox_<point2d> bkd_piter2d;
typedef point2d_<float> point2df;
typedef dpoint2d_<float> dpoint2df;
Index: oln/core/2d/neighb2d.hh
===================================================================
--- oln/core/2d/neighb2d.hh (revision 606)
+++ oln/core/2d/neighb2d.hh (working copy)
@@ -37,66 +37,74 @@
{
- neighb2d c4()
+ namespace internal
{
- static bool flower = true;
- static neighb2d the_;
- if (flower)
- {
- the_
- .add(dpoint2d(0, 1))
- .add(dpoint2d(1, 0));
- flower = false;
- }
- return the_;
- }
-
- neighb2d c8()
- {
- static bool flower = true;
- static neighb2d the_;
- if (flower)
- {
- the_
- .add(dpoint2d(0, 1))
- .add(dpoint2d(1,-1))
- .add(dpoint2d(1, 0))
- .add(dpoint2d(1, 1));
- flower = false;
- }
- return the_;
- }
-
+ neighb2d mk_c4()
+ {
+ static bool flower = true;
+ static neighb2d the_;
+ if (flower)
+ {
+ the_
+ .add(dpoint2d(0, 1))
+ .add(dpoint2d(1, 0));
+ flower = false;
+ }
+ return the_;
+ }
- neighb2d c2_row()
- {
- static bool flower = true;
- static neighb2d the_;
- if (flower)
- {
- the_
- .add(dpoint2d(0, 1));
- flower = false;
- }
- return the_;
- }
-
+ neighb2d mk_c8()
+ {
+ static bool flower = true;
+ static neighb2d the_;
+ if (flower)
+ {
+ the_
+ .add(dpoint2d(0, 1))
+ .add(dpoint2d(1,-1))
+ .add(dpoint2d(1, 0))
+ .add(dpoint2d(1, 1));
+ flower = false;
+ }
+ return the_;
+ }
- neighb2d c2_col()
- {
- static bool flower = true;
- static neighb2d the_;
- if (flower)
- {
- the_
- .add(dpoint2d(1, 0));
- flower = false;
- }
- return the_;
- }
+ neighb2d mk_c2_row()
+ {
+ static bool flower = true;
+ static neighb2d the_;
+ if (flower)
+ {
+ the_
+ .add(dpoint2d(0, 1));
+ flower = false;
+ }
+ return the_;
+ }
+ neighb2d mk_c2_col()
+ {
+ static bool flower = true;
+ static neighb2d the_;
+ if (flower)
+ {
+ the_
+ .add(dpoint2d(1, 0));
+ flower = false;
+ }
+ return the_;
+ }
+ } // end of namespace oln::internal
+
+
+ static const neighb2d c4 = internal::mk_c4();
+ static const neighb2d c8 = internal::mk_c8();
+ static const neighb2d c2r = internal::mk_c2_row();
+ static const neighb2d c2c = internal::mk_c2_col();
+
+
} // end of namespace oln
Index: oln/core/2d/image2d.hh
===================================================================
--- oln/core/2d/image2d.hh (revision 606)
+++ oln/core/2d/image2d.hh (working copy)
@@ -50,10 +50,7 @@
typedef grid2d grid_type;
typedef point2d point_type;
-
- typedef fwd_piter_bbox_<topo_type> fwd_piter_type;
- typedef bkd_piter_bbox_<topo_type> bkd_piter_type;
-
+
typedef T value_type;
typedef T lvalue_type;
typedef mlc::true_ is_mutable_type;
Index: oln/core/gen/piter_isubset.hh
===================================================================
--- oln/core/gen/piter_isubset.hh (revision 606)
+++ oln/core/gen/piter_isubset.hh (working copy)
@@ -68,17 +68,24 @@
typedef piter_isubset_<piter_t, isubset_t> self_t;
typedef abstract::iterator_on_points<self_t> super_t;
- typedef oln_type_of(self_t, point) topo_t;
- typedef oln_type_of(piter_t, point) point_t;
+ typedef oln_type_of(self_t, topo) topo_t;
+ typedef oln_type_of(self_t, point) point_t;
public:
template <typename T>
piter_isubset_(const abstract::topology<T>& topo)
: p_(topo),
- isubset_(topo.exact().isubset())
+ isubset_(topo.exact().subset())
{
}
+
+ template <typename P, typename T>
+ piter_isubset_(const P& p, const abstract::topology<T>& topo)
+ : p_(p, topo),
+ isubset_(topo.exact().subset())
+ {
+ }
void impl_start()
{
@@ -114,19 +121,12 @@
return p_.point_adr();
}
- const topo_t& topo() const
+ const topo_t topo() const
{
topo_t tmp(p_.topo(), isubset_);
return tmp;
}
- template <typename new_topo_t>
- struct change_topology_
- {
- typedef typename piter_t::template change_topology_<new_topo_t>::ret
new_piter_t;
- typedef piter_isubset_<new_piter_t, isubset_t> ret;
- };
-
protected:
piter_t p_;
Index: oln/core/gen/topo_add_isubset.hh
===================================================================
--- oln/core/gen/topo_add_isubset.hh (revision 606)
+++ oln/core/gen/topo_add_isubset.hh (working copy)
@@ -53,7 +53,7 @@
template <typename topo, typename isubset>
struct vtypes< topo_add_isubset<topo, isubset> >
{
- typedef isubset isubset_type;
+ typedef isubset subset_type;
};
@@ -92,7 +92,7 @@
return topo_;
}
- const isubset_t& isubset() const
+ const isubset_t& impl_subset() const
{
return isubset_;
}
Index: oln/core/gen/topo_bbox.hh
===================================================================
--- oln/core/gen/topo_bbox.hh (revision 606)
+++ oln/core/gen/topo_bbox.hh (working copy)
@@ -89,6 +89,11 @@
return bb_;
}
+ bbox_t& impl_lbbox()
+ {
+ return bb_;
+ }
+
bool impl_has(const point& p) const
{
return bb_.has(p);
Index: oln/core/gen/fwd_piter_bbox.hh
===================================================================
--- oln/core/gen/fwd_piter_bbox.hh (revision 606)
+++ oln/core/gen/fwd_piter_bbox.hh (working copy)
@@ -30,6 +30,7 @@
# define OLN_CORE_GEN_FWD_PITER_BBOX_HH
# include <oln/core/abstract/topology.hh>
+# include <oln/core/abstract/point.hh>
# include <oln/core/internal/bbox_fwd_piter.hh>
@@ -38,74 +39,57 @@
// Forward declaration.
- template <typename topo> class fwd_piter_bbox_;
+ template <typename point_t> class fwd_piter_bbox_;
// Super type declaration.
- template <typename topo>
- struct set_super_type< fwd_piter_bbox_<topo> >
+ template <typename point_t>
+ struct set_super_type< fwd_piter_bbox_<point_t> >
{
- typedef fwd_piter_bbox_<topo> self_t;
+ typedef fwd_piter_bbox_<point_t> self_t;
typedef internal::bbox_fwd_piter<self_t> ret;
};
- /// Virtual types associated to oln::fwd_piter_bbox_<topo>.
- template <typename topo>
- struct vtypes< fwd_piter_bbox_<topo> >
+ /// Virtual types associated to oln::fwd_piter_bbox_<point_t>.
+ template <typename point_t>
+ struct vtypes< fwd_piter_bbox_<point_t> >
{
- typedef oln_type_of(topo, point) point_type;
- typedef oln_type_of(topo, grid) grid_type;
- typedef topo topo_type;
+ typedef point_t point_type;
+ typedef oln_type_of(point_t, grid) grid_type;
};
/// Abstract forward point iterator class.
- template <typename topo_t>
- class fwd_piter_bbox_ : public internal::bbox_fwd_piter<
fwd_piter_bbox_<topo_t> >,
- private mlc::assert_< mlc_is_a(topo_t, abstract::topology) >
+ template <typename point_t>
+ class fwd_piter_bbox_ : public internal::bbox_fwd_piter<
fwd_piter_bbox_<point_t> >,
+ private mlc::assert_< mlc_is_a(point_t, abstract::point) >
{
- typedef fwd_piter_bbox_<topo_t> self_t;
+ typedef fwd_piter_bbox_<point_t> self_t;
typedef internal::bbox_fwd_piter<self_t> super_t;
public:
template <typename T>
fwd_piter_bbox_(const abstract::topology<T>& topo)
- : super_t(topo.exact().bbox()),
- topo_(topo.exact())
+ : super_t(topo.exact().bbox())
{
}
-
- const topo_t& topo() const
- {
- return topo_;
- }
void print(std::ostream& ostr) const
{
- ostr << "{ p=" << super_t::p_
+ ostr << "{ p=" << this->p_
<< " }";
}
friend
- std::ostream& operator<<(std::ostream& ostr, const
fwd_piter_bbox_<topo_t>& t)
+ std::ostream& operator<<(std::ostream& ostr, const
fwd_piter_bbox_<point_t>& t)
{
t.print(ostr);
return ostr;
}
- template <typename new_topo_t>
- struct change_topology_
- {
- typedef fwd_piter_bbox_<new_topo_t> ret;
- };
-
- protected:
-
- const topo_t topo_;
-
}; // end of class oln::fwd_piter_bbox_<point>
Index: oln/core/gen/fwd_niter_neighb.hh
===================================================================
--- oln/core/gen/fwd_niter_neighb.hh (revision 0)
+++ oln/core/gen/fwd_niter_neighb.hh (revision 0)
@@ -0,0 +1,165 @@
+// 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 OLN_CORE_GEN_FWD_NITER_NEIGHB_HH
+# define OLN_CORE_GEN_FWD_NITER_NEIGHB_HH
+
+# include <oln/core/abstract/topology.hh>
+# include <oln/core/abstract/iterator_on_points.hh>
+# include <oln/core/gen/neighb.hh>
+
+
+namespace oln
+{
+
+
+ // Forward declaration.
+ template <typename point_t> class fwd_niter_neighb_;
+
+
+ // Super type declaration.
+ template <typename point_t>
+ struct set_super_type< fwd_niter_neighb_<point_t> >
+ {
+ typedef fwd_niter_neighb_<point_t> self_t;
+ typedef abstract::iterator_on_points<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::fwd_niter_neighb_<point_t>.
+ template <typename point_t>
+ struct vtypes< fwd_niter_neighb_<point_t> >
+ {
+ typedef point_t point_type;
+ typedef oln_type_of(point_t, grid) grid_type;
+ };
+
+
+
+ /// Abstract forward point iterator class.
+ template <typename point_t>
+ class fwd_niter_neighb_ : public abstract::iterator_on_points<
fwd_niter_neighb_<point_t> >
+ {
+ typedef fwd_niter_neighb_<point_t> self_t;
+ typedef abstract::iterator_on_points<self_t> super_t;
+
+ typedef oln_type_of(point_t, dpoint) dpoint_t;
+
+ public:
+
+ template <typename P, typename T>
+ fwd_niter_neighb_(const abstract::iterator_on_points<P>& it,
+ const abstract::topology<T>& topo)
+ : p_ref_(it.point_adr()),
+ nbh_(topo.exact().neighborhood())
+ {
+ precondition(nbh_.card() > 0);
+ i_ = -1;
+ }
+
+// template <typename P, typename N>
+// fwd_niter_neighb_(const abstract::iterator_on_points<P>& it,
+// const abstract::neighborhood<N>& nbh)
+// : p_ref_(it.point_adr()),
+// nbh_(nbh.exact())
+// {
+// precondition(nbh_.card() > 0);
+// i_ = -1;
+// }
+
+// template <typename P, typename T>
+// fwd_niter_neighb_(const abstract::point<P>& p,
+// const abstract::topology<T>& topo)
+// : p_ref_(&(p.exact())),
+// nbh_(topo.exact().neighborhood())
+// {
+// precondition(nbh_.card() > 0);
+// i_ = -1;
+// }
+
+// template <typename P, typename N>
+// fwd_niter_neighb_(const abstract::point<P>& p,
+// const abstract::neighborhood<N>& nbh)
+// : p_ref_(&(p.exact())),
+// nbh_(nbh.exact())
+// {
+// precondition(nbh_.card() > 0);
+// i_ = -1;
+// }
+
+ void impl_start()
+ {
+ i_ = 0;
+ p_ = *p_ref_+ nbh_.dp(i_);
+ }
+
+ void impl_next()
+ {
+ ++i_;
+ if (i_ == int(nbh_.card()))
+ {
+ i_ = -1;
+ return;
+ }
+ p_ = *p_ref_ + nbh_.dp(i_);
+ }
+
+ void impl_invalidate()
+ {
+ i_ = -1;
+ }
+
+ bool impl_is_valid() const
+ {
+ return i_ != -1;
+ }
+
+ point_t impl_to_point() const
+ {
+ return p_;
+ }
+
+ const point_t* impl_point_adr() const
+ {
+ return &p_;
+ }
+
+ protected:
+
+ const point_t* p_ref_;
+ neighb_<dpoint_t> nbh_;
+ int i_;
+ point_t p_;
+
+ }; // end of class oln::fwd_niter_neighb_<point_t>
+
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_GEN_FWD_NITER_NEIGHB_HH
+
Index: oln/core/gen/fwd_qiter_win.hh
===================================================================
--- oln/core/gen/fwd_qiter_win.hh (revision 0)
+++ oln/core/gen/fwd_qiter_win.hh (revision 0)
@@ -0,0 +1,145 @@
+// 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 OLN_CORE_GEN_FWD_QITER_WIN_HH
+# define OLN_CORE_GEN_FWD_QITER_WIN_HH
+
+# include <oln/core/abstract/topology.hh>
+# include <oln/core/abstract/iterator_on_points.hh>
+# include <oln/core/gen/win.hh>
+
+
+namespace oln
+{
+
+
+ // Forward declaration.
+ template <typename point_t> class fwd_qiter_win_;
+
+
+ // Super type declaration.
+ template <typename point_t>
+ struct set_super_type< fwd_qiter_win_<point_t> >
+ {
+ typedef fwd_qiter_win_<point_t> self_t;
+ typedef abstract::iterator_on_points<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::fwd_qiter_win_<point_t>.
+ template <typename point_t>
+ struct vtypes< fwd_qiter_win_<point_t> >
+ {
+ typedef point_t point_type;
+ typedef oln_type_of(point_t, grid) grid_type;
+ };
+
+
+
+ /// Abstract forward point iterator class.
+ template <typename point_t>
+ class fwd_qiter_win_ : public abstract::iterator_on_points<
fwd_qiter_win_<point_t> >
+ {
+ typedef fwd_qiter_win_<point_t> self_t;
+ typedef abstract::iterator_on_points<self_t> super_t;
+
+ typedef oln_type_of(point_t, dpoint) dpoint_t;
+
+ public:
+
+ template <typename P, typename D>
+ fwd_qiter_win_(const abstract::iterator_on_points<P>& it,
+ const window_<D>& win)
+ : p_ref_(it.point_adr()),
+ win_(win)
+ {
+ precondition(win_.card() > 0);
+ i_ = -1;
+ }
+
+ template <typename P, typename D>
+ fwd_qiter_win_(const abstract::point<P>& p,
+ const window_<D>& win)
+ : p_ref_(&(p.exact())),
+ win_(win)
+ {
+ precondition(win_.card() > 0);
+ i_ = -1;
+ }
+
+ void impl_start()
+ {
+ i_ = 0;
+ p_ = *p_ref_+ win_.dp(i_);
+ }
+
+ void impl_next()
+ {
+ ++i_;
+ if (i_ == int(win_.card()))
+ {
+ i_ = -1;
+ return;
+ }
+ p_ = *p_ref_ + win_.dp(i_);
+ }
+
+ void impl_invalidate()
+ {
+ i_ = -1;
+ }
+
+ bool impl_is_valid() const
+ {
+ return i_ != -1;
+ }
+
+ point_t impl_to_point() const
+ {
+ return p_;
+ }
+
+ const point_t* impl_point_adr() const
+ {
+ return &p_;
+ }
+
+ protected:
+
+ const point_t* p_ref_;
+ window_<dpoint_t> win_;
+ int i_;
+ point_t p_;
+
+ }; // end of class oln::fwd_qiter_win_<point_t>
+
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_GEN_FWD_QITER_WIN_HH
+
Index: oln/core/gen/window.hh
===================================================================
--- oln/core/gen/window.hh (revision 0)
+++ oln/core/gen/window.hh (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (C) 2001, 2003, 2004, 2005, 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 OLN_CORE_GEN_WINDOW_HH
+# define OLN_CORE_GEN_WINDOW_HH
+
+# include <set>
+# include <vector>
+
+
+namespace oln
+{
+
+ /// Abstract forward dpoint iterator class.
+ template <typename dpoint>
+ class window_ : private mlc::assert_< mlc_is_a(dpoint, abstract::dpoint) >
+ {
+ typedef window_<dpoint> self_t;
+
+ public:
+
+ window_()
+ {
+ }
+
+ self_t& add(const dpoint& dp)
+ {
+ s_.insert(dp);
+ update_();
+ return *this;
+ }
+
+ template <typename D>
+ self_t& add(const abstract::dpoint<D>& dp)
+ {
+ return this->add(dp.exact());
+ }
+
+ unsigned card() const
+ {
+ return v_.size();
+ }
+
+ dpoint dp(unsigned i) const
+ {
+ precondition(i < v_.size());
+ return v_[i];
+ }
+
+ protected:
+
+ std::set<dpoint> s_;
+ std::vector<dpoint> v_;
+
+ void update_()
+ {
+ v_.clear();
+ std::copy(s_.begin(), s_.end(),
+ std::back_inserter(v_));
+ }
+
+ }; // end of class oln::window_<dpoint>
+
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_GEN_WINDOW_HH
Index: oln/core/gen/bkd_piter_bbox.hh
===================================================================
--- oln/core/gen/bkd_piter_bbox.hh (revision 606)
+++ oln/core/gen/bkd_piter_bbox.hh (working copy)
@@ -30,6 +30,7 @@
# define OLN_CORE_GEN_BKD_PITER_BBOX_HH
# include <oln/core/abstract/topology.hh>
+# include <oln/core/abstract/point.hh>
# include <oln/core/internal/bbox_bkd_piter.hh>
@@ -38,75 +39,58 @@
// Forward declaration.
- template <typename topo> class bkd_piter_bbox_;
+ template <typename point_t> class bkd_piter_bbox_;
// Super type declaration.
- template <typename topo>
- struct set_super_type< bkd_piter_bbox_<topo> >
+ template <typename point_t>
+ struct set_super_type< bkd_piter_bbox_<point_t> >
{
- typedef bkd_piter_bbox_<topo> self_t;
+ typedef bkd_piter_bbox_<point_t> self_t;
typedef internal::bbox_bkd_piter<self_t> ret;
};
- /// Virtual types associated to oln::bkd_piter_bbox_<topo>.
- template <typename topo>
- struct vtypes< bkd_piter_bbox_<topo> >
+ /// Virtual types associated to oln::bkd_piter_bbox_<point_t>.
+ template <typename point_t>
+ struct vtypes< bkd_piter_bbox_<point_t> >
{
- typedef oln_type_of(topo, point) point_type;
- typedef oln_type_of(topo, grid) grid_type;
- typedef topo topo_type;
+ typedef point_t point_type;
+ typedef oln_type_of(point_t, grid) grid_type;
};
/// Abstract forward point iterator class.
- template <typename topo_t>
- class bkd_piter_bbox_ : public internal::bbox_bkd_piter<
bkd_piter_bbox_<topo_t> >,
- private mlc::assert_< mlc_is_a(topo_t, abstract::topology) >
+ template <typename point_t>
+ class bkd_piter_bbox_ : public internal::bbox_bkd_piter<
bkd_piter_bbox_<point_t> >,
+ private mlc::assert_< mlc_is_a(point_t, abstract::point) >
{
- typedef bkd_piter_bbox_<topo_t> self_t;
+ typedef bkd_piter_bbox_<point_t> self_t;
typedef internal::bbox_bkd_piter<self_t> super_t;
public:
template <typename T>
bkd_piter_bbox_(const abstract::topology<T>& topo)
- : super_t(topo.exact().bbox()),
- topo_(topo.exact())
+ : super_t(topo.exact().bbox())
{
}
- const topo_t& topo() const
- {
- return topo_;
- }
-
void print(std::ostream& ostr) const
{
- ostr << "{ p=" << super_t::p_
+ ostr << "{ p=" << this->p_
<< " }";
}
friend
- std::ostream& operator<<(std::ostream& ostr, const
bkd_piter_bbox_<topo_t>& t)
+ std::ostream& operator<<(std::ostream& ostr, const
bkd_piter_bbox_<point_t>& t)
{
t.print(ostr);
return ostr;
}
- template <typename new_topo_t>
- struct change_topology_
- {
- typedef bkd_piter_bbox_<new_topo_t> ret;
- };
-
- protected:
-
- const topo_t topo_;
-
- }; // end of class oln::bkd_piter_bbox_<point>
+ }; // end of class oln::bkd_piter_bbox_<point_t>
} // end of namespace oln
Index: oln/basics2d.hh
===================================================================
--- oln/basics2d.hh (revision 606)
+++ oln/basics2d.hh (working copy)
@@ -47,10 +47,10 @@
namespace oln { template class topo_lbbox_<point2d>; }
# include <oln/core/gen/fwd_piter_bbox.hh>
-namespace oln { template class fwd_piter_bbox_<topo2d>; }
+namespace oln { template class fwd_piter_bbox_<point2d>; }
# include <oln/core/gen/bkd_piter_bbox.hh>
-namespace oln { template class bkd_piter_bbox_<topo2d>; }
+namespace oln { template class bkd_piter_bbox_<point2d>; }
# include <oln/core/gen/neighb.hh>
namespace oln { template class neighb_<dpoint2d>; }
Index: oln/Makefile.am
===================================================================
--- oln/Makefile.am (revision 606)
+++ oln/Makefile.am (working copy)
@@ -82,6 +82,7 @@
core/abstract/topology_being_random_accessible.hh \
core/abstract/topology_having_bbox.hh \
core/abstract/topology_having_neighborhood.hh \
+ core/abstract/topology_having_subset.hh \
core/abstract/topology_hierarchies.hh \
\
core/automatic/image.hh \
@@ -93,17 +94,23 @@
core/automatic/topology_being_random_accessible.hh \
core/automatic/topology_having_bbox.hh \
core/automatic/topology_having_neighborhood.hh \
+ core/automatic/topology_having_subset.hh \
\
+ core/fwd_piter.hh \
+ \
core/gen/bbox.hh \
core/gen/bbox_bkd_piter.hh \
core/gen/bbox_fwd_piter.hh \
core/gen/bkd_piter_bbox.hh \
+ core/gen/fwd_niter_neighb.hh \
core/gen/fwd_piter_bbox.hh \
+ core/gen/fwd_qiter_win.hh \
core/gen/mapimage.hh \
core/gen/neighb.hh \
core/gen/topo_add_nbh.hh \
core/gen/topo_bbox.hh \
core/gen/topo_lbbox.hh \
+ core/gen/window.hh \
\
core/internal/bbox_bkd_piter.hh \
core/internal/bbox_fwd_piter.hh \
Index: oln/morpher/add_isubset.hh
===================================================================
--- oln/morpher/add_isubset.hh (revision 606)
+++ oln/morpher/add_isubset.hh (working copy)
@@ -58,26 +58,49 @@
// Topology type.
typedef topo_add_isubset< oln_type_of(Image, topo), Isubset > topo_type;
- // Piter types.
- typedef piter_isubset_<oln_type_of(Image, fwd_piter), Isubset> fwd_piter_type;
- typedef piter_isubset_<oln_type_of(Image, bkd_piter), Isubset> bkd_piter_type;
-
// Isubset type.
typedef Isubset subset_type;
};
+// template <typename Image, typename Isubset>
+// struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::fwd_niter_type >
+// {
+// private:
+// typedef oln_type_of(Image, fwd_niter) basic_fwd_niter_type;
+// typedef topo_add_isubset< oln_type_of(Image, topo), Isubset >
new_topo_type;
+// typedef typename basic_fwd_niter_type::template
change_topology_<new_topo_type>::ret intra_fwd_niter_type;
+// public:
+// typedef piter_isubset_<intra_fwd_niter_type, Isubset> ret;
+// };
+
+
+// template <typename Image, typename Isubset>
+// struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::bkd_niter_type >
+// {
+// private:
+// typedef oln_type_of(Image, bkd_niter) basic_bkd_niter_type;
+// typedef topo_add_isubset< oln_type_of(Image, topo), Isubset >
new_topo_type;
+// typedef typename basic_bkd_niter_type::template
change_topology_<new_topo_type>::ret intra_bkd_niter_type;
+// public:
+// typedef piter_isubset_<intra_bkd_niter_type, Isubset> ret;
+// };
+
+
namespace morpher
{
/// Isubset addition morpher.
template <typename Image, typename Isubset>
- class add_isubset : public stc_get_supers(mlc_comma_1(add_isubset<Image,
Isubset>))
+ class add_isubset : public morpher::internal::image_extension< Image,
+ add_isubset<Image, Isubset> >
+ // FIXME: Uncomment. stc_get_supers(mlc_comma_1(add_isubset<Image, Isubset>))
{
private:
typedef add_isubset<Image, Isubset> self_t;
typedef stc_get_nth_super(self_t, 1) super_t;
- typedef oln_type_of(self_t, topo) topo_t;
+ typedef oln_direct_type_of(self_t, topo) topo_t;
+ // FIXME: use of oln_direct_type_of here!!! otherwise we get some compilation
trouble...
public:
Index: oln/morpher/internal/image_extension.hh
===================================================================
--- oln/morpher/internal/image_extension.hh (revision 606)
+++ oln/morpher/internal/image_extension.hh (working copy)
@@ -78,6 +78,12 @@
{
public:
+// template <typename I>
+// image_extension(const abstract::image<I>& image)
+// {
+// mlc::abort_<I>::check();
+// }
+
// FIXME: Handle the constness.
image_extension(const Image& image) :
image_(image)
@@ -90,7 +96,7 @@
}
protected:
- const Image& image_;
+ Image image_;
};
} // end of namespace oln::morpher::internal
Index: oln/morpher/add_neighborhood.hh
===================================================================
--- oln/morpher/add_neighborhood.hh (revision 606)
+++ oln/morpher/add_neighborhood.hh (working copy)
@@ -30,6 +30,7 @@
# include <oln/morpher/internal/image_extension.hh>
# include <oln/core/gen/topo_add_nbh.hh>
+# include <oln/core/gen/fwd_niter_neighb.hh>
namespace oln
@@ -54,18 +55,9 @@
template <typename Image, typename Neighb>
struct vtypes< morpher::add_neighborhood<Image, Neighb> >
{
- private:
-
- typedef oln_type_of(Image, fwd_piter) basic_fwd_piter_type;
- typedef oln_type_of(Image, bkd_piter) basic_bkd_piter_type;
-
- public:
// Topology type.
typedef topo_add_nbh< oln_type_of(Image, topo), Neighb > topo_type;
- typedef typename basic_fwd_piter_type::template
change_topology_<topo_type>::ret fwd_piter_type;
- typedef typename basic_bkd_piter_type::template
change_topology_<topo_type>::ret bkd_piter_type;
-
// Neighborhood type.
typedef Neighb neighborhood_type;
};
@@ -75,7 +67,9 @@
{
/// Neighborhood addition morpher.
template <typename Image, typename Neighb>
- class add_neighborhood : public stc_get_supers(mlc_comma_1(add_neighborhood<Image,
Neighb>))
+ class add_neighborhood : public morpher::internal::image_extension< Image,
+ add_neighborhood<Image, Neighb> >
+ // FIXME: Uncomment. stc_get_supers(mlc_comma_1(add_neighborhood<Image,
Neighb>))
{
private:
@@ -87,6 +81,12 @@
// FIXME: Handle the constness.
+// template <typename I, typename N>
+// add_neighborhood(const abstract::image<I>& image, const N& nbh)
+// : super_t(image)
+// {
+// }
+
add_neighborhood(const Image& image, const Neighb& nbh) :
super_t(image),
topo_(image.topo(), nbh)