* mln/core/image/complex_lower_neighborhood.hh,
* mln/core/image/complex_higher_neighborhood.hh,
* mln/core/image/complex_lower_higher_neighborhood.hh:
Factor using mln::internal::complex_neighborhood_base.
---
milena/ChangeLog | 9 ++
.../mln/core/image/complex_higher_neighborhood.hh | 78 ++-----------------
.../image/complex_lower_higher_neighborhood.hh | 82 ++------------------
.../mln/core/image/complex_lower_neighborhood.hh | 78 ++-----------------
4 files changed, 29 insertions(+), 218 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 774c861..1a4fe48 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,14 @@
2008-10-17 Roland Levillain <roland(a)lrde.epita.fr>
+ Factor concrete neighborhoods of complex image.
+
+ * mln/core/image/complex_lower_neighborhood.hh,
+ * mln/core/image/complex_higher_neighborhood.hh,
+ * mln/core/image/complex_lower_higher_neighborhood.hh:
+ Factor using mln::internal::complex_neighborhood_base.
+
+2008-10-17 Roland Levillain <roland(a)lrde.epita.fr>
+
Add a factored implementation of neighborhood of complex image.
* mln/core/internal/complex_neighborhood_base.hh: New.
diff --git a/milena/mln/core/image/complex_higher_neighborhood.hh
b/milena/mln/core/image/complex_higher_neighborhood.hh
index 4dce482..d68051a 100644
--- a/milena/mln/core/image/complex_higher_neighborhood.hh
+++ b/milena/mln/core/image/complex_higher_neighborhood.hh
@@ -32,88 +32,22 @@
/// \brief A neighborhood centered on a n-face of complex returning its
/// adjacent (n+1)-faces.
-# include <mln/core/concept/neighborhood.hh>
-
-# include <mln/core/site_set/complex_psite.hh>
-
+# include <mln/core/internal/complex_neighborhood_base.hh>
# include <mln/topo/adj_higher_face_iter.hh>
-// FIXME: Factor with complex_lower_neighborhood.
-
namespace mln
{
- // Forward declarations.
- template <typename I, typename G, typename N>
- class complex_neighborhood_fwd_piter;
- template <typename I, typename G, typename N>
- class complex_neighborhood_bkd_piter;
-
- /// \brief Neighborhood centered on a n-face of complex returning its
- /// adjacent (n-1)-faces.
template <unsigned D, typename G>
- class complex_higher_neighborhood
- : public Neighborhood< complex_higher_neighborhood<D, G> >
+ struct complex_higher_neighborhood
+ : internal::complex_neighborhood_base< D, G,
+ topo::adj_higher_face_fwd_iter<D>,
+ topo::adj_higher_face_bkd_iter<D>,
+ complex_higher_neighborhood<D, G> >
{
- typedef complex_higher_neighborhood<D, G> self_;
-
- public:
- /// The associated complex iterators.
- /// \{
- typedef topo::adj_higher_face_fwd_iter<D> complex_fwd_iter;
- typedef topo::adj_higher_face_bkd_iter<D> complex_bkd_iter;
- /// \}
-
- public:
- /// Associated types.
- /// \{
- /// The type of psite corresponding to the neighborhood.
- typedef complex_psite<D, G> psite;
- /// The type of site corresponding to the neighborhood.
- typedef mln_site(psite) site;
-
- /// \brief Site_Iterator type to browse the psites of the neighborhood
- /// w.r.t. the ordering of vertices.
- typedef
- complex_neighborhood_fwd_piter<complex_fwd_iter, G, self_> fwd_niter;
-
- /// \brief Site_Iterator type to browse the psites of the neighborhood
- /// w.r.t. the reverse ordering of vertices.
- typedef
- complex_neighborhood_bkd_piter<complex_bkd_iter, G, self_> bkd_niter;
-
- /// The default niter type.
- typedef fwd_niter niter;
- /// \}
-
- /// Conversions.
- /// \{
- /// The window type corresponding to this neighborhood.
- // FIXME: Dummy.
- typedef self_ window;
- /// Create a window corresponding to this neighborhood.
- const window& win() const;
- /// \}
};
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- // FIXME: Dummy.
- template <unsigned D, typename G>
- inline
- // FIXME: Change (dummy) type.
- const typename complex_higher_neighborhood<D, G>::window&
- complex_higher_neighborhood<D, G>::win() const
- {
- // FIXME: Dummy.
- return *this;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln
#endif // ! MLN_CORE_IMAGE_COMPLEX_HIGHER_NEIGHBORHOOD_HH
diff --git a/milena/mln/core/image/complex_lower_higher_neighborhood.hh
b/milena/mln/core/image/complex_lower_higher_neighborhood.hh
index 459913a..593982d 100644
--- a/milena/mln/core/image/complex_lower_higher_neighborhood.hh
+++ b/milena/mln/core/image/complex_lower_higher_neighborhood.hh
@@ -32,90 +32,24 @@
/// \brief A neighborhood centered on a n-face of complex returning its
/// adjacent (n-1)-faces and (n+1)-faces.
-# include <mln/core/concept/neighborhood.hh>
-
-# include <mln/core/site_set/complex_psite.hh>
-
+# include <mln/core/internal/complex_neighborhood_base.hh>
# include <mln/topo/adj_lower_higher_face_iter.hh>
-/* FIXME: Factor with complex_lower_neighborhood and
- complex_higher_neighborhood (e.g., using an
- internal::complex_neighborhood_base common base class). */
-
namespace mln
{
- // Forward declarations.
- template <typename I, typename G, typename N>
- class complex_neighborhood_fwd_piter;
- template <typename I, typename G, typename N>
- class complex_neighborhood_bkd_piter;
-
- /// \brief Neighborhood centered on a n-face of complex returning its
- /// adjacent (n-1)-faces.
template <unsigned D, typename G>
- class complex_lower_higher_neighborhood
- : public Neighborhood< complex_lower_higher_neighborhood<D, G> >
+ struct complex_lower_higher_neighborhood
+ : internal::complex_neighborhood_base<
+ D, G,
+ topo::adj_lower_higher_face_fwd_iter<D>,
+ topo::adj_lower_higher_face_bkd_iter<D>,
+ complex_lower_higher_neighborhood<D, G>
+ >
{
- typedef complex_lower_higher_neighborhood<D, G> self_;
-
- public:
- /// The associated complex iterators.
- /// \{
- typedef topo::adj_lower_higher_face_fwd_iter<D> complex_fwd_iter;
- typedef topo::adj_lower_higher_face_bkd_iter<D> complex_bkd_iter;
- /// \}
-
- public:
- /// Associated types.
- /// \{
- /// The type of psite corresponding to the neighborhood.
- typedef complex_psite<D, G> psite;
- /// The type of site corresponding to the neighborhood.
- typedef mln_site(psite) site;
-
- /// \brief Site_Iterator type to browse the psites of the neighborhood
- /// w.r.t. the ordering of vertices.
- typedef
- complex_neighborhood_fwd_piter<complex_fwd_iter, G, self_> fwd_niter;
-
- /// \brief Site_Iterator type to browse the psites of the neighborhood
- /// w.r.t. the reverse ordering of vertices.
- typedef
- complex_neighborhood_bkd_piter<complex_bkd_iter, G, self_> bkd_niter;
-
- /// The default niter type.
- typedef fwd_niter niter;
- /// \}
-
- /// Conversions.
- /// \{
- /// The window type corresponding to this neighborhood.
- // FIXME: Dummy.
- typedef self_ window;
- /// Create a window corresponding to this neighborhood.
- const window& win() const;
- /// \}
};
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- // FIXME: Dummy.
- template <unsigned D, typename G>
- inline
- // FIXME: Change (dummy) type.
- const typename complex_lower_higher_neighborhood<D, G>::window&
- complex_lower_higher_neighborhood<D, G>::win() const
- {
- // FIXME: Dummy.
- return *this;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln
#endif // ! MLN_CORE_IMAGE_COMPLEX_LOWER_HIGHER_NEIGHBORHOOD_HH
diff --git a/milena/mln/core/image/complex_lower_neighborhood.hh
b/milena/mln/core/image/complex_lower_neighborhood.hh
index a93298b..c7fc882 100644
--- a/milena/mln/core/image/complex_lower_neighborhood.hh
+++ b/milena/mln/core/image/complex_lower_neighborhood.hh
@@ -32,88 +32,22 @@
/// \brief A neighborhood centered on a n-face of complex returning its
/// adjacent (n-1)-faces.
-# include <mln/core/concept/neighborhood.hh>
-
-# include <mln/core/site_set/complex_psite.hh>
-
+# include <mln/core/internal/complex_neighborhood_base.hh>
# include <mln/topo/adj_lower_face_iter.hh>
-// FIXME: Factor with complex_higher_neighborhood.
-
namespace mln
{
- // Forward declarations.
- template <typename I, typename G, typename N>
- class complex_neighborhood_fwd_piter;
- template <typename I, typename G, typename N>
- class complex_neighborhood_bkd_piter;
-
- /// \brief Neighborhood centered on a n-face of complex returning its
- /// adjacent (n-1)-faces.
template <unsigned D, typename G>
- class complex_lower_neighborhood
- : public Neighborhood< complex_lower_neighborhood<D, G> >
+ struct complex_lower_neighborhood
+ : internal::complex_neighborhood_base< D, G,
+ topo::adj_lower_face_fwd_iter<D>,
+ topo::adj_lower_face_bkd_iter<D>,
+ complex_lower_neighborhood<D, G> >
{
- typedef complex_lower_neighborhood<D, G> self_;
-
- public:
- /// The associated complex iterators.
- /// \{
- typedef topo::adj_lower_face_fwd_iter<D> complex_fwd_iter;
- typedef topo::adj_lower_face_bkd_iter<D> complex_bkd_iter;
- /// \}
-
- public:
- /// Associated types.
- /// \{
- /// The type of psite corresponding to the neighborhood.
- typedef complex_psite<D, G> psite;
- /// The type of site corresponding to the neighborhood.
- typedef mln_site(psite) site;
-
- /// \brief Site_Iterator type to browse the psites of the neighborhood
- /// w.r.t. the ordering of vertices.
- typedef
- complex_neighborhood_fwd_piter<complex_fwd_iter, G, self_> fwd_niter;
-
- /// \brief Site_Iterator type to browse the psites of the neighborhood
- /// w.r.t. the reverse ordering of vertices.
- typedef
- complex_neighborhood_bkd_piter<complex_bkd_iter, G, self_> bkd_niter;
-
- /// The default niter type.
- typedef fwd_niter niter;
- /// \}
-
- /// Conversions.
- /// \{
- /// The window type corresponding to this neighborhood.
- // FIXME: Dummy.
- typedef self_ window;
- /// Create a window corresponding to this neighborhood.
- const window& win() const;
- /// \}
};
-
-
-# ifndef MLN_INCLUDE_ONLY
-
- // FIXME: Dummy.
- template <unsigned D, typename G>
- inline
- // FIXME: Change (dummy) type.
- const typename complex_lower_neighborhood<D, G>::window&
- complex_lower_neighborhood<D, G>::win() const
- {
- // FIXME: Dummy.
- return *this;
- }
-
-# endif // ! MLN_INCLUDE_ONLY
-
} // end of namespace mln
#endif // ! MLN_CORE_IMAGE_COMPLEX_LOWER_NEIGHBORHOOD_HH
--
1.6.0.1