Commit 5cd8093c authored by Roland Levillain's avatar Roland Levillain
Browse files

Have complex neighborhoods depend on complex windows.

	* mln/core/internal/complex_neighborhood_base.hh
	(mln::internal::complex_neighborhood_base<D, G, F, B, E>):
	Turn class into...
	(mln::internal::complex_neighborhood_base<W, E>):
	...this.
	(mln::internal::complex_neighborhood_base<W, E>::complex_fwd_iter)
	(mln::internal::complex_neighborhood_base<W, E>::complex_bkd_iter)
	(mln::internal::complex_neighborhood_base<W, E>::psite)
	(mln::internal::complex_neighborhood_base<W, E>::site)
	(mln::internal::complex_neighborhood_base<W, E>::window):
	Depend on W.
	(mln::internal::complex_neighborhood_base<W, E>::G):
	New typedef.
	(mln::internal::complex_neighborhood_base<W, E>::win)
	(mln::internal::complex_neighborhood_base<W, E>::is_valid):
	Provide actual implementations.
	(mln::internal::complex_neighborhood_base<W, E>::win_):
	New attribute.
	* mln/core/image/complex_neighborhoods.hh
	(mln_gen_complex_neighborhood(Nbh,Fwd_Complex_Iter,Bkd_Complex_Iter)):
	Turn macro into...
	(mln_gen_complex_neighborhood(Nbh,Win)):
	...this.
	Adjust callers.
	* mln/core/internal/complex_window_base.hh: Typo in comment.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@4575 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 2a937a13
2009-09-29 Roland Levillain <roland@lrde.epita.fr>
Have complex neighborhoods depend on complex windows.
* mln/core/internal/complex_neighborhood_base.hh
(mln::internal::complex_neighborhood_base<D, G, F, B, E>):
Turn class into...
(mln::internal::complex_neighborhood_base<W, E>):
...this.
(mln::internal::complex_neighborhood_base<W, E>::complex_fwd_iter)
(mln::internal::complex_neighborhood_base<W, E>::complex_bkd_iter)
(mln::internal::complex_neighborhood_base<W, E>::psite)
(mln::internal::complex_neighborhood_base<W, E>::site)
(mln::internal::complex_neighborhood_base<W, E>::window):
Depend on W.
(mln::internal::complex_neighborhood_base<W, E>::G):
New typedef.
(mln::internal::complex_neighborhood_base<W, E>::win)
(mln::internal::complex_neighborhood_base<W, E>::is_valid):
Provide actual implementations.
(mln::internal::complex_neighborhood_base<W, E>::win_):
New attribute.
* mln/core/image/complex_neighborhoods.hh
(mln_gen_complex_neighborhood(Nbh,Fwd_Complex_Iter,Bkd_Complex_Iter)):
Turn macro into...
(mln_gen_complex_neighborhood(Nbh,Win)):
...this.
Adjust callers.
* mln/core/internal/complex_window_base.hh: Typo in comment.
2009-09-29 Roland Levillain <roland@lrde.epita.fr>
 
Fix target change in complex piters.
......@@ -30,34 +30,24 @@
/// \brief Definitions of some neighborhoods of complex images.
# include <mln/core/internal/complex_neighborhood_base.hh>
# include <mln/core/image/complex_windows.hh>
# include <mln/topo/adj_lower_face_iter.hh>
# include <mln/topo/adj_higher_face_iter.hh>
# include <mln/topo/adj_lower_higher_face_iter.hh>
# include <mln/topo/adj_lower_dim_connected_n_face_iter.hh>
# include <mln/topo/adj_higher_dim_connected_n_face_iter.hh>
# include <mln/topo/complex_iterators.hh>
/** \brief Generate a complex neighborhood class.
/** \brief Generate a complex neighborhood class (based on a window).
\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.
\param Nbh The name of the class to generate.
\param Win The underlying window (with no parameter).
The generated class inherits from
mln:: internal::complex_neighborhood_base< D, G,
Fwd_Complex_Iter<D>,
Bkd_Complex_Iter<D>,
Nbh <D, G> >
mln::internal::complex_neighborhood_base< Win <D, G>, 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) \
# define mln_gen_complex_neighborhood(Nbh, Win) \
template <unsigned D, typename G> \
struct Nbh \
: internal::complex_neighborhood_base< D, G, \
Fwd_Complex_Iter <D>, \
Bkd_Complex_Iter <D>, \
Nbh <D, G> > \
: internal::complex_neighborhood_base< Win <D, G>, Nbh <D, G> > \
{ \
}
......@@ -68,38 +58,32 @@ namespace mln
/// \brief Neighborhood centered on an n-face of complex returning
/// its adjacent (n-1)-faces.
mln_gen_complex_neighborhood(complex_lower_neighborhood,
topo::adj_lower_face_fwd_iter,
topo::adj_lower_face_bkd_iter);
complex_lower_window);
/// \brief Neighborhood centered on an n-face of complex returning
/// its adjacent (n+1)-faces.
mln_gen_complex_neighborhood(complex_higher_neighborhood,
topo::adj_higher_face_fwd_iter,
topo::adj_higher_face_bkd_iter);
complex_higher_window);
/// \brief Neighborhood centered on an n-face of complex returning
/// its adjacent (n-1)-faces and (n+1)-faces.
mln_gen_complex_neighborhood(complex_lower_higher_neighborhood,
topo::adj_lower_higher_face_fwd_iter,
topo::adj_lower_higher_face_bkd_iter);
complex_lower_higher_window);
/// \brief Neighborhood centered on an n-face of complex returning
/// the n-faces sharing an (n-1)-face with the center n-face.
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);
complex_lower_dim_connected_n_face_window);
/// \brief Neighborhood centered on an n-face of complex returning
/// the n-faces sharing an (n+1)-face with the center n-face.
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);
complex_higher_dim_connected_n_face_window);
/// \brief Neighborhood centered on an n-face of complex returning
/// the m-faces transitively adjacent to this center n-face.
mln_gen_complex_neighborhood(complex_m_face_neighborhood,
topo::adj_m_face_fwd_iter,
topo::adj_m_face_bkd_iter);
complex_m_face_window);
} // end of namespace mln
......
......@@ -27,15 +27,15 @@
# define MLN_CORE_INTERNAL_COMPLEX_NEIGHBORHOOD_BASE_HH
/// \file
/// \brief Definition of a generic neighborhood centered on the face
/// of a complex, based on a pair of (forward and backward) complex
/// \brief Definition of a generic neighborhood of the face of a
/// complex, based on a pair of (forward and backward) complex
/// iterators.
# include <mln/core/concept/neighborhood.hh>
# include <mln/core/site_set/complex_psite.hh>
# include <mln/core/image/complex_neighborhood_piter.hh>
// FIXME: Factor with mln::internal::complex_window_base.
# include <mln/core/internal/neighb_base.hh>
namespace mln
......@@ -48,7 +48,7 @@ namespace mln
namespace internal
{
template <unsigned D, typename G, typename F, typename B, typename E>
template <typename W, typename E>
class complex_neighborhood_base;
}
......@@ -58,78 +58,76 @@ namespace mln
/** \brief Generic neighborhood centered on the face of a complex,
based on an pair of (forward and backward) complex iterators.
\tparam D The dimension of the complex.
\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 W The underlying window.
\tparam E The exact type. */
template <unsigned D, typename G, typename F, typename B, typename E>
class complex_neighborhood_base : public Neighborhood<E>
{
public:
/// The associated complex iterators.
/// \{
typedef F complex_fwd_iter;
typedef B 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, E> 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, E> bkd_niter;
/// The default niter type.
typedef fwd_niter niter;
/// \}
/// Conversions.
/// \{
/// The window type corresponding to this neighborhood.
// FIXME: Dummy.
typedef E window;
/// Create a window corresponding to this neighborhood.
const window& win() const;
/// \}
/// Return true by default.
bool is_valid() const;
};
template <typename W, typename E>
class complex_neighborhood_base : public Neighborhood<E>
{
public:
/// The associated complex iterators.
/// \{
typedef typename W::complex_fwd_iter complex_fwd_iter;
typedef typename W::complex_bkd_iter complex_bkd_iter;
/// \}
public:
/// Associated types.
/// \{
/// The geometry of the complex.
typedef mln_geom(W) G;
/// The type of psite corresponding to the neighborhood.
typedef mln_psite(W) psite;
/// The type of site corresponding to the neighborhood.
typedef mln_site(W) 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, E> 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, E> bkd_niter;
/// The default niter type.
typedef fwd_niter niter;
/// The window type corresponding to this neighborhood.
typedef W window;
/// \}
public:
/// Get the corresponding window.
const W& win() const;
/// Is this neighborhood valid?
bool is_valid() const;
private:
/// The underlying window.
W win_;
};
# ifndef MLN_INCLUDE_ONLY
// FIXME: Dummy.
template <unsigned D, typename G, typename F, typename B, typename E>
inline
// FIXME: Change (dummy) type.
const typename complex_neighborhood_base<D, G, F, B, E>::window&
complex_neighborhood_base<D, G, F, B, E>::win() const
{
// FIXME: Dummy.
return exact(*this);
}
template <unsigned D, typename G, typename F, typename B, typename E>
inline
bool
complex_neighborhood_base<D, G, F, B, E>::is_valid() const
{
return true;
}
template <typename W, typename E>
inline
const W&
complex_neighborhood_base<W, E>::win() const
{
return win_;
}
template <typename W, typename E>
inline
bool
complex_neighborhood_base<W, E>::is_valid() const
{
return win().is_valid();
}
# endif // ! MLN_INCLUDE_ONLY
......
......@@ -103,7 +103,7 @@ namespace mln
typedef void dpsite;
/* FIXME: Ideally, the `is_centered' information should be
fetched from the iterators, but that's not an straighforward
fetched from the iterators, but that's not a straighforward
task. */
complex_window_base(bool is_centered = false);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment