* mln/core/internal/complex_window_p_base.hh
(complex_window_p_base): Inherit from complex_window_p_base.
(trait::window_< mln::internal::complex_window_p_base<D, G, F, B, E>)
Adjust traits.
Remove all typedefs and methods.
(complex_window_p_base::complex_window_p_base): New ctor.
---
milena/ChangeLog | 15 +++
milena/mln/core/image/complex_windows.hh | 46 +++++----
milena/mln/core/internal/complex_window_p_base.hh | 103 ++++-----------------
3 files changed, 59 insertions(+), 105 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index aa0ac48..c8c8fca 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,20 @@
2009-09-25 Roland Levillain <roland(a)lrde.epita.fr>
+ Refactor complex_window_p_base using complex_window_base.
+
+ * mln/core/internal/complex_window_p_base.hh
+ (complex_window_p_base): Inherit from complex_window_p_base.
+ (trait::window_< mln::internal::complex_window_p_base<D, G, F, B, E>)
+ Adjust traits.
+ Remove all typedefs and methods.
+ (complex_window_p_base::complex_window_p_base): New ctor.
+ * mln/core/image/complex_windows.hh (mln_gen_complex_window):
+ Rename (internal) macro as..
+ (mln_gen_complex_window_p): ...this.
+ Adjust.
+
+2009-09-25 Roland Levillain <roland(a)lrde.epita.fr>
+
Introduce a base class for general complex windows.
* mln/core/internal/complex_window_base.hh: New.
diff --git a/milena/mln/core/image/complex_windows.hh
b/milena/mln/core/image/complex_windows.hh
index 2f22470..906ac16 100644
--- a/milena/mln/core/image/complex_windows.hh
+++ b/milena/mln/core/image/complex_windows.hh
@@ -35,7 +35,7 @@
# include <mln/topo/adj_higher_face_iter.hh>
# include <mln/topo/adj_lower_higher_face_iter.hh>
-/** \brief Generate a complex window class, as well as its traits.
+/** \brief Generate a centered complex window class, as well as its traits.
\param Win The name of the class to generate.
\param Fwd_Complex_Iter The underlying forward iterator type.
@@ -49,7 +49,7 @@
Win <D, G> >
where D and G are template parameters of the generated Win class. */
-# define mln_gen_complex_window(Win, Fwd_Complex_Iter, Bkd_Complex_Iter) \
+# define mln_gen_complex_window_p(Win, Fwd_Complex_Iter, Bkd_Complex_Iter) \
/* Forward declaration. */ \
template <unsigned D, typename G> struct Win; \
\
@@ -80,47 +80,51 @@
namespace mln
{
+ /*-------------------.
+ | Centered windows. |
+ `-------------------*/
+
/// \brief Window centered on an n-face of complex returning its
/// adjacent (n-1)-faces as well as the center n-face.
- mln_gen_complex_window(complex_lower_window_p,
- topo::adj_lower_face_fwd_iter,
- topo::adj_lower_face_bkd_iter);
+ mln_gen_complex_window_p(complex_lower_window_p,
+ topo::adj_lower_face_fwd_iter,
+ topo::adj_lower_face_bkd_iter);
/// \brief Window centered on an n-face of complex returning its
/// adjacent (n+1)-faces as well as the center n-face.
- mln_gen_complex_window(complex_higher_window_p,
- topo::adj_higher_face_fwd_iter,
- topo::adj_higher_face_bkd_iter);
+ mln_gen_complex_window_p(complex_higher_window_p,
+ topo::adj_higher_face_fwd_iter,
+ topo::adj_higher_face_bkd_iter);
/// \brief Window centered on an n-face of complex returning its
/// adjacent (n-1)-faces and (n+1)-faces as well as the center
/// n-face.
- mln_gen_complex_window(complex_lower_higher_window_p,
- topo::adj_lower_higher_face_fwd_iter,
- topo::adj_lower_higher_face_bkd_iter);
+ mln_gen_complex_window_p(complex_lower_higher_window_p,
+ topo::adj_lower_higher_face_fwd_iter,
+ topo::adj_lower_higher_face_bkd_iter);
/// \brief Window centered on an n-face of complex returning the
/// n-faces sharing an (n-1)-face with the center n-face, as well as
/// this center n-face.
- mln_gen_complex_window(complex_lower_dim_connected_n_face_window_p,
- topo::adj_lower_dim_connected_n_face_fwd_iter,
- topo::adj_lower_dim_connected_n_face_bkd_iter);
+ mln_gen_complex_window_p(complex_lower_dim_connected_n_face_window_p,
+ topo::adj_lower_dim_connected_n_face_fwd_iter,
+ topo::adj_lower_dim_connected_n_face_bkd_iter);
/// \brief Window centered on an n-face of complex returning the
/// n-faces sharing an (n+1)-face with the center n-face, as well as
/// this center n-face.
- mln_gen_complex_window(complex_higher_dim_connected_n_face_window_p,
- topo::adj_higher_dim_connected_n_face_fwd_iter,
- topo::adj_higher_dim_connected_n_face_bkd_iter);
+ mln_gen_complex_window_p(complex_higher_dim_connected_n_face_window_p,
+ topo::adj_higher_dim_connected_n_face_fwd_iter,
+ topo::adj_higher_dim_connected_n_face_bkd_iter);
/// \brief Window centered on an n-face of complex returning
/// the m-faces transitively adjacent to this center n-face.
- mln_gen_complex_window(complex_m_face_window,
- topo::adj_m_face_fwd_iter,
- topo::adj_m_face_bkd_iter);
+ mln_gen_complex_window_p(complex_m_face_window,
+ topo::adj_m_face_fwd_iter,
+ topo::adj_m_face_bkd_iter);
} // end of namespace mln
-# undef mln_gen_complex_window
+# undef mln_gen_complex_window_p
#endif // ! MLN_CORE_IMAGE_COMPLEX_WINDOWS_HH
diff --git a/milena/mln/core/internal/complex_window_p_base.hh
b/milena/mln/core/internal/complex_window_p_base.hh
index 3f04a6f..65e79e9 100644
--- a/milena/mln/core/internal/complex_window_p_base.hh
+++ b/milena/mln/core/internal/complex_window_p_base.hh
@@ -31,22 +31,14 @@
/// of a complex, based on a pair of (forward and backward) complex
/// iterators. The center (site) is part of the window.
-# include <mln/core/concept/window.hh>
-# include <mln/core/site_set/complex_psite.hh>
-# include <mln/core/image/complex_window_piter.hh>
+# include <mln/core/internal/complex_window_base.hh>
# include <mln/topo/centered_iter_adapter.hh>
-// FIXME: Factor with mln::internal::complex_neighborhood_base.
namespace mln
{
- // Forward declarations.
- template <typename I, typename G, typename W>
- class complex_window_fwd_piter;
- template <typename I, typename G, typename W>
- class complex_window_bkd_piter;
namespace internal
{
@@ -60,10 +52,12 @@ namespace mln
template <unsigned D, typename G, typename F, typename B, typename E>
struct window_< mln::internal::complex_window_p_base<D, G, F, B, E> >
+ : window_< mln::internal::complex_window_base
+ < D, G,
+ mln::topo::centered_fwd_iter_adapter<D, F>,
+ mln::topo::centered_bkd_iter_adapter<D, B>,
+ E > >
{
- typedef trait::window::size::unknown size;
- typedef trait::window::support::irregular support;
- typedef trait::window::definition::varying definition;
};
} // end of namespace mln::trait
@@ -81,64 +75,20 @@ namespace mln
\tparam B The underlying backward iterator type.
\tparam E The exact type. */
template <unsigned D, typename G, typename F, typename B, typename E>
- class complex_window_p_base : public Window<E>
+ class complex_window_p_base
+ : public complex_window_base
+ < D, G,
+ mln::topo::centered_fwd_iter_adapter<D, F>,
+ mln::topo::centered_bkd_iter_adapter<D, B>,
+ E >
{
- /// The complex iterators <em>on the adjacent faces only</em>
- /// (without the center point).
- /// \{
- typedef F adj_only_fwd_iter_;
- typedef B adj_only_bkd_iter_;
- /// \}
+ typedef complex_window_base< D, G,
+ topo::centered_fwd_iter_adapter<D, F>,
+ topo::centered_bkd_iter_adapter<D, B>,
+ E > super;
public:
- /// The associated complex iterators.
- /// \{
- typedef topo::centered_fwd_iter_adapter<D, adj_only_fwd_iter_>
- complex_fwd_iter;
-
- typedef topo::centered_bkd_iter_adapter<D, adj_only_bkd_iter_>
- complex_bkd_iter;
- /// \}
-
- public:
- /// Associated types.
- /// \{
- /// The type of psite corresponding to the window.
- typedef complex_psite<D, G> psite;
- /// The type of site corresponding to the window.
- typedef mln_site(psite) site;
-
- // FIXME: This is a dummy value.
- typedef void dpsite;
-
- /// \brief Site_Iterator type to browse the psites of the window
- /// w.r.t. the ordering of vertices.
- typedef
- complex_window_fwd_piter<complex_fwd_iter, G, E> fwd_qiter;
-
- /// \brief Site_Iterator type to browse the psites of the window
- /// w.r.t. the reverse ordering of vertices.
- typedef
- complex_window_bkd_piter<complex_bkd_iter, G, E> bkd_qiter;
-
- /// The default qiter type.
- typedef fwd_qiter qiter;
- /// \}
-
- public:
- /// Services.
- /// \{
- /* FIXME: mln::morpho::dilation requires these method from models
- of concept Window, but Window does not list them in its
- requirements. Who's guilty: morpho::dilation or Window? */
- /// Is this window empty? (Always returns \c false).
- bool is_empty() const;
- /// Is this window centered? (Always returns \c true).
- bool is_centered() const;
-
- /// Return true by default.
- bool is_valid() const;
- /// \}
+ complex_window_p_base();
};
@@ -146,24 +96,9 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
template <unsigned D, typename G, typename F, typename B, typename E>
- bool
- complex_window_p_base<D, G, F, B, E>::is_empty() const
- {
- return false;
- }
-
- template <unsigned D, typename G, typename F, typename B, typename E>
- bool
- complex_window_p_base<D, G, F, B, E>::is_centered() const
- {
- return true;
- }
-
- template <unsigned D, typename G, typename F, typename B, typename E>
- bool
- complex_window_p_base<D, G, F, B, E>::is_valid() const
+ complex_window_p_base<D, G, F, B, E>::complex_window_p_base()
+ : super(true)
{
- return true;
}
# endif // ! MLN_INCLUDE_ONLY
--
1.6.3.1