
* mln/core/site_set/p_faces_piter.hh: New. Add forward declarations for these iterators... * mln/core/site_set/p_faces.hh: ...here. (mln::p_faces<N,D,P>::fwd_piter): Set to p_faces_fwd_piter_<N,D,P>. (mln::p_faces<N,D,P>::bkd_piter): Set to p_faces_bkd_piter_<N,D,P>. (mln::p_faces<N, D, P>::p_faces(const p_complex<D, P>&)): New ctor. --- milena/ChangeLog | 12 +++ milena/mln/core/site_set/p_faces.hh | 32 +++++-- milena/mln/core/site_set/p_faces_piter.hh | 148 +++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+), 8 deletions(-) create mode 100644 milena/mln/core/site_set/p_faces_piter.hh diff --git a/milena/ChangeLog b/milena/ChangeLog index 784f4a4..743cc09 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,17 @@ 2008-09-24 Roland Levillain <roland@lrde.epita.fr> + Add iterators on p_faces. + + * mln/core/site_set/p_faces_piter.hh: New. + Add forward declarations for these iterators... + * mln/core/site_set/p_faces.hh: ...here. + (mln::p_faces<N,D,P>::fwd_piter): Set to p_faces_fwd_piter_<N,D,P>. + (mln::p_faces<N,D,P>::bkd_piter): Set to p_faces_bkd_piter_<N,D,P>. + (mln::p_faces<N, D, P>::p_faces(const p_complex<D, P>&)): + New ctor. + +2008-09-24 Roland Levillain <roland@lrde.epita.fr> + Make internal::p_complex_piter_base generic w.r.t. the site set. * mln/core/internal/p_complex_piter_base.hh diff --git a/milena/mln/core/site_set/p_faces.hh b/milena/mln/core/site_set/p_faces.hh index 3c48100..21cd898 100644 --- a/milena/mln/core/site_set/p_faces.hh +++ b/milena/mln/core/site_set/p_faces.hh @@ -34,10 +34,12 @@ # include <mln/core/internal/site_set_base.hh> -# include <mln/accu/bbox.hh> # include <mln/core/complex.hh> # include <mln/core/faces_psite.hh> +# include <mln/core/site_set/p_faces_piter.hh> + +# include <mln/core/site_set/p_complex.hh> namespace mln @@ -45,11 +47,9 @@ namespace mln // Forward declarations. template <unsigned N, unsigned D, typename P> class p_faces; - // FIXME: Enable when available. -#if 0 + template <unsigned N, unsigned D, typename P> class p_faces_fwd_piter_; template <unsigned N, unsigned D, typename P> class p_faces_bkd_piter_; -#endif namespace trait @@ -79,8 +79,14 @@ namespace mln /// \brief Construct a faces psite set from an mln::complex. /// /// \param gr The complex upon which the complex psite set is built. + p_faces(const complex<D>& cplx); + + /// \brief Construct a faces psite set from an mln::p_complex. + /// + /// \param gr The complex upon which the complex psite set is built. /// - p_faces (const complex<D>& cplx); + /// \todo When available, get location information from \a pc. + p_faces(const p_complex<D, P>& pc); /// Associated types. /// \{ @@ -92,11 +98,11 @@ namespace mln // FIXME: Fake. /// Forward Site_Iterator associated type. - typedef void fwd_piter; + typedef p_faces_fwd_piter_<N, D, P> fwd_piter; // FIXME: Fake. /// Backward Site_Iterator associated type. - typedef void bkd_piter; + typedef p_faces_bkd_piter_<N, D, P> bkd_piter; /// Site_Iterator associated type. typedef fwd_piter piter; @@ -119,6 +125,7 @@ namespace mln // simplify (and lighten) the implementation of piters, psites, // etc. + // FIXME: This method is probably useless now. /// Is this site set valid? bool is_valid() const; @@ -192,6 +199,15 @@ namespace mln template <unsigned N, unsigned D, typename P> inline + p_faces<N, D, P>::p_faces(const p_complex<D, P>& pc) + : cplx_(pc.cplx()) + { + // Ensure N is compatible with D. + metal::bool_< N <= D >::check(); + } + + template <unsigned N, unsigned D, typename P> + inline unsigned p_faces<N, D, P>::nsites() const { @@ -223,7 +239,7 @@ namespace mln return // Check whether P's complex is compatible with this pset's complex. (p.site_set() == *this) && - // Check whether the complex has the face associated to P. + // Check whether P is valid. (p.is_valid()); } diff --git a/milena/mln/core/site_set/p_faces_piter.hh b/milena/mln/core/site_set/p_faces_piter.hh new file mode 100644 index 0000000..b26ca9b --- /dev/null +++ b/milena/mln/core/site_set/p_faces_piter.hh @@ -0,0 +1,148 @@ +// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE) +// +// 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. +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_SITE_SET_P_FACES_PITER_HH +# define MLN_CORE_SITE_SET_P_FACES_PITER_HH + +/// \file mln/core/site_set/p_faces_piter.hh +/// \brief Definition of point iterator on complex-based pset. + +# include <mln/core/site_set/p_faces.hh> +# include <mln/core/internal/p_complex_piter_base.hh> +# include <mln/core/faces_iter.hh> + + +namespace mln +{ + + // Forward declarations. + template <unsigned N, unsigned D, typename P> class p_faces; + + template <unsigned N, unsigned D> class faces_fwd_iter_; + template <unsigned N, unsigned D> class faces_bkd_iter_; + + + /*------------------------------. + | p_faces_fwd_piter_<N, D, P>. | + `------------------------------*/ + + /// \brief Forward iterator on point sites of a mln::p_faces<N, D, P>. + template <unsigned N, unsigned D, typename P> + class p_faces_fwd_piter_ + : public internal::p_complex_piter_base_< faces_fwd_iter_<N, D>, + p_faces<N, D, P>, + P, + p_faces_fwd_piter_<N, D, P> > + { + typedef p_faces_fwd_piter_<N, D, P> self_; + typedef internal::p_complex_piter_base_< faces_fwd_iter_<N, D>, + p_faces<N, D, P>, + P, + self_ > super_; + + public: + /// Construction and assignment. + /// \{ + p_faces_fwd_piter_(); + p_faces_fwd_piter_(const p_faces<N, D, P>& pc); + /// \} + }; + + + /*------------------------------. + | p_faces_bkd_piter_<N, D, P>. | + `------------------------------*/ + + /// \brief Backward iterator on point sites of a mln::p_faces<N, D, P>. + template <unsigned N, unsigned D, typename P> + class p_faces_bkd_piter_ + /* FIXME: Rename internal::p_complex_piter_base_ to something else, + as it is also used for p_faces piters! */ + : public internal::p_complex_piter_base_< faces_bkd_iter_<N, D>, + p_faces<N, D, P>, + P, + p_faces_bkd_piter_<N, D, P> > + { + typedef p_faces_bkd_piter_<N, D, P> self_; + typedef internal::p_complex_piter_base_< faces_bkd_iter_<N, D>, + p_faces<N, D, P>, + P, + self_ > super_; + + public: + /// Construction and assignment. + /// \{ + p_faces_bkd_piter_(); + p_faces_bkd_piter_(const p_faces<N, D, P>& pc); + /// \} + }; + + + +# ifndef MLN_INCLUDE_ONLY + + /*------------------------------. + | p_faces_fwd_piter_<N, D, P>. | + `------------------------------*/ + + template <unsigned N, unsigned D, typename P> + inline + p_faces_fwd_piter_<N, D, P>::p_faces_fwd_piter_() + { + } + + template <unsigned N, unsigned D, typename P> + inline + p_faces_fwd_piter_<N, D, P>::p_faces_fwd_piter_(const p_faces<N, D, P>& pc) + : super_(pc) + { + } + + + /*------------------------------. + | p_faces_bkd_piter_<N, D, P>. | + `------------------------------*/ + + template <unsigned N, unsigned D, typename P> + inline + p_faces_bkd_piter_<N, D, P>::p_faces_bkd_piter_() + { + } + + template <unsigned N, unsigned D, typename P> + inline + p_faces_bkd_piter_<N, D, P>::p_faces_bkd_piter_(const p_faces<N, D, P>& pc) + : super_(pc) + { + } + +# endif // ! MLN_INCLUDE_ONLY + +} // end of mln + + +#endif // ! MLN_CORE_SITE_SET_P_FACES_PITER_HH -- 1.6.0.1
participants (1)
-
Roland Levillain