2607: Factor mln/core/image/complex_neighborhoods.hh using the preprocessor.

* mln/core/image/complex_neighborhoods.hh (mln_gen_complex_neighborhood): New (generator) macro. Use it to factor... (mln::complex_lower_neighborhood<D, G>) (mln::complex_higher_neighborhood<D, G>) (mln::complex_lower_higher_neighborhood<D, G>) (mln::complex_lower_dim_connected_n_face_neighborhood<D, G>) (mln::complex_higher_dim_connected_n_face_neighborhood<D, G>): ...the definitions of these classes. * mln/core/internal/complex_neighborhood_base.hh (mln::internal::complex_neighborhood_base<D, G, F, B, E>): Be more precise in documentation. --- milena/ChangeLog | 17 ++++ milena/mln/core/image/complex_neighborhoods.hh | 87 +++++++++---------- .../mln/core/internal/complex_neighborhood_base.hh | 6 +- 3 files changed, 61 insertions(+), 49 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 37db01d..1aa444c 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,22 @@ 2008-10-18 Roland Levillain <roland@lrde.epita.fr> + Factor mln/core/image/complex_neighborhoods.hh using the preprocessor. + + * mln/core/image/complex_neighborhoods.hh + (mln_gen_complex_neighborhood): New (generator) macro. + Use it to factor... + (mln::complex_lower_neighborhood<D, G>) + (mln::complex_higher_neighborhood<D, G>) + (mln::complex_lower_higher_neighborhood<D, G>) + (mln::complex_lower_dim_connected_n_face_neighborhood<D, G>) + (mln::complex_higher_dim_connected_n_face_neighborhood<D, G>): + ...the definitions of these classes. + * mln/core/internal/complex_neighborhood_base.hh + (mln::internal::complex_neighborhood_base<D, G, F, B, E>): + Be more precise in documentation. + +2008-10-18 Roland Levillain <roland@lrde.epita.fr> + Add windows based on lower/higher-dimension connected n-faces. * mln/core/image/complex_windows.hh diff --git a/milena/mln/core/image/complex_neighborhoods.hh b/milena/mln/core/image/complex_neighborhoods.hh index 3dce74f..323df38 100644 --- a/milena/mln/core/image/complex_neighborhoods.hh +++ b/milena/mln/core/image/complex_neighborhoods.hh @@ -39,71 +39,66 @@ # include <mln/topo/adj_lower_dim_connected_n_face_iter.hh> # include <mln/topo/adj_higher_dim_connected_n_face_iter.hh> +/** \brief Generate a complex neighborhood class. + + \param Nbh The name of the class to generate. + \param Fwd_Complex_Iter The underlying forward iterator type. + \param Bkd_Complex_Iter The underlying backward iterator type. + + The generated class inherits from + + mln:: internal::complex_neighborhood_base< D, G, + Fwd_Complex_Iter<D>, + Bkd_Complex_Iter<D>, + Nbh <D, G> > + + where D and G are template parameters of the generated Nbh class. */ +# define mln_gen_complex_neighborhood(Nbh, Fwd_Complex_Iter, Bkd_Complex_Iter) \ + template <unsigned D, typename G> \ + struct Nbh \ + : internal::complex_neighborhood_base< D, G, \ + Fwd_Complex_Iter <D>, \ + Bkd_Complex_Iter <D>, \ + Nbh <D, G> > \ + { \ + } + namespace mln { /// \brief Neighborhood centered on an n-face of complex returning /// its adjacent (n-1)-faces. - template <unsigned D, typename 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> > - { - }; + mln_gen_complex_neighborhood(complex_lower_neighborhood, + topo::adj_lower_face_fwd_iter, + topo::adj_lower_face_bkd_iter); /// \brief Neighborhood centered on an n-face of complex returning /// its adjacent (n+1)-faces. - template <unsigned D, typename 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> > - { - }; + mln_gen_complex_neighborhood(complex_higher_neighborhood, + topo::adj_higher_face_fwd_iter, + topo::adj_higher_face_bkd_iter); /// \brief Neighborhood centered on an n-face of complex returning /// its adjacent (n-1)-faces and (n+1)-faces. - template <unsigned D, typename 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> - > - { - }; + mln_gen_complex_neighborhood(complex_lower_higher_neighborhood, + topo::adj_lower_higher_face_fwd_iter, + topo::adj_lower_higher_face_bkd_iter); /// \brief Neighborhood centered on an n-face of complex returning /// the n-faces sharing an (n-1)-face with the center n-face. - template <unsigned D, typename G> - struct complex_lower_dim_connected_n_face_neighborhood - : internal::complex_neighborhood_base< - D, G, - topo::adj_lower_dim_connected_n_face_fwd_iter<D>, - topo::adj_lower_dim_connected_n_face_bkd_iter<D>, - complex_lower_dim_connected_n_face_neighborhood<D, G> - > - { - }; + mln_gen_complex_neighborhood(complex_lower_dim_connected_n_face_neighborhood, + topo::adj_lower_dim_connected_n_face_fwd_iter, + topo::adj_lower_dim_connected_n_face_bkd_iter); /// \brief Neighborhood centered on an n-face of complex returning /// the n-faces sharing an (n+1)-face with the center n-face. - template <unsigned D, typename G> - struct complex_higher_dim_connected_n_face_neighborhood - : internal::complex_neighborhood_base< - D, G, - topo::adj_higher_dim_connected_n_face_fwd_iter<D>, - topo::adj_higher_dim_connected_n_face_bkd_iter<D>, - complex_higher_dim_connected_n_face_neighborhood<D, G> - > - { - }; + mln_gen_complex_neighborhood(complex_higher_dim_connected_n_face_neighborhood, + topo::adj_higher_dim_connected_n_face_fwd_iter, + topo::adj_higher_dim_connected_n_face_bkd_iter); } // end of namespace mln +# undef mln_gen_complex_neighborhood + #endif // ! MLN_CORE_IMAGE_COMPLEX_NEIGHBORHOODS_HH diff --git a/milena/mln/core/internal/complex_neighborhood_base.hh b/milena/mln/core/internal/complex_neighborhood_base.hh index 9ecf09f..d422792 100644 --- a/milena/mln/core/internal/complex_neighborhood_base.hh +++ b/milena/mln/core/internal/complex_neighborhood_base.hh @@ -60,9 +60,9 @@ namespace mln based on an pair of (forward and backward) complex iterators. \tparam D The dimension of the complex. - \tparam G The geometry functor of the complex. - \tparam F The underlying forward iterator. - \tparam B The underlying backward iterator. + \tparam G The type of the geometry functor of the complex. + \tparam F The underlying forward iterator type. + \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_neighborhood_base : public Neighborhood<E> -- 1.6.0.1
participants (1)
-
Roland Levillain