
* mln/topo/adj_lower_higher_face_iter.hh: New. Include this header... * mln/topo/complex.hh: ...here. --- milena/ChangeLog | 8 ++ milena/mln/topo/adj_lower_higher_face_iter.hh | 161 +++++++++++++++++++++++++ milena/mln/topo/complex.hh | 1 + 3 files changed, 170 insertions(+), 0 deletions(-) create mode 100644 milena/mln/topo/adj_lower_higher_face_iter.hh diff --git a/milena/ChangeLog b/milena/ChangeLog index 755c13d..4ebc231 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,13 @@ 2008-10-03 Roland Levillain <roland@lrde.epita.fr> + Add iterators on both lower- and higher-dimension adjacent faces. + + * mln/topo/adj_lower_higher_face_iter.hh: New. + Include this header... + * mln/topo/complex.hh: ...here. + +2008-10-03 Roland Levillain <roland@lrde.epita.fr> + Add a meta iterator sequencing two complex relative iterators. * mln/topo/internal/complex_relative_iterator_sequence.hh: New. diff --git a/milena/mln/topo/adj_lower_higher_face_iter.hh b/milena/mln/topo/adj_lower_higher_face_iter.hh new file mode 100644 index 0000000..e28b64a --- /dev/null +++ b/milena/mln/topo/adj_lower_higher_face_iter.hh @@ -0,0 +1,161 @@ +// 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_TOPO_ADJ_LOWER_HIGHER_FACE_ITER_HH +# define MLN_TOPO_ADJ_LOWER_HIGHER_FACE_ITER_HH + +/// \file mln/topo/adj_lower_higher_face_iter.hh +/// \brief Definition of forward and backward iterators on all the +/// adjacent (n-1)-faces and (n+1)-faces of a (reference) n-face in a +/// complex. + +# include <mln/topo/internal/complex_relative_iterator_sequence.hh> +# include <mln/topo/adj_lower_face_iter.hh> +# include <mln/topo/adj_higher_face_iter.hh> + +# include <mln/topo/face.hh> + + +namespace mln +{ + + namespace topo + { + + // Forward declaration. + template <unsigned D> class complex; + + + /*------------------------------------------. + | topo::adj_lower_higher_face_fwd_iter<D>. | + `------------------------------------------*/ + + /// \brief Forward iterator on all the adjacent (n-1)-faces and + /// (n+1)-faces of the n-face of an mln::complex<D>. + /// + /// \arg \p D The dimension of the complex this iterator belongs to. + template <unsigned D> + class adj_lower_higher_face_fwd_iter + : public internal::complex_relative_iterator_sequence<adj_lower_face_fwd_iter<D>, + adj_higher_face_fwd_iter<D>, + adj_lower_higher_face_fwd_iter<D> > + { + typedef adj_lower_higher_face_fwd_iter<D> self_; + typedef adj_lower_face_fwd_iter<D> iter1_; + typedef adj_higher_face_fwd_iter<D> iter2_; + typedef internal::complex_relative_iterator_sequence< iter1_, + iter2_, + self_ > super_; + + public: + /// Construction. + /// \{ + adj_lower_higher_face_fwd_iter(); + template <typename Fref> + adj_lower_higher_face_fwd_iter(const Fref& f_ref); + /// \} + }; + + + /*------------------------------------------. + | topo::adj_lower_higher_face_bkd_iter<D>. | + `------------------------------------------*/ + + /// \brief Forward iterator on all the adjacent (n-1)-faces and + /// (n+1)-faces of the n-face of an mln::complex<D>. + /// + /// \arg \p D The dimension of the complex this iterator belongs to. + template <unsigned D> + class adj_lower_higher_face_bkd_iter + : public internal::complex_relative_iterator_sequence<adj_higher_face_bkd_iter<D>, + adj_lower_face_bkd_iter<D>, + adj_lower_higher_face_bkd_iter<D> > + { + typedef adj_lower_higher_face_bkd_iter<D> self_; + typedef adj_higher_face_bkd_iter<D> iter1_; + typedef adj_lower_face_bkd_iter<D> iter2_; + typedef internal::complex_relative_iterator_sequence< iter1_, + iter2_, + self_ > super_; + + public: + /// Construction. + /// \{ + adj_lower_higher_face_bkd_iter(); + template <typename Fref> + adj_lower_higher_face_bkd_iter(const Fref& f_ref); + /// \} + }; + + + +# ifndef MLN_INCLUDE_ONLY + + /*------------------------------------------. + | topo::adj_lower_higher_face_fwd_iter<D>. | + `------------------------------------------*/ + + template <unsigned D> + inline + adj_lower_higher_face_fwd_iter<D>::adj_lower_higher_face_fwd_iter() + { + } + + template <unsigned D> + template <typename Fref> + inline + adj_lower_higher_face_fwd_iter<D>::adj_lower_higher_face_fwd_iter(const Fref& f_ref) + : super_(f_ref) + { + } + + + /*------------------------------------------. + | topo::adj_lower_higher_face_bkd_iter<D>. | + `------------------------------------------*/ + + template <unsigned D> + inline + adj_lower_higher_face_bkd_iter<D>::adj_lower_higher_face_bkd_iter() + { + } + + template <unsigned D> + template <typename Fref> + inline + adj_lower_higher_face_bkd_iter<D>::adj_lower_higher_face_bkd_iter(const Fref& f_ref) + : super_(f_ref) + { + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::topo + +} // end of namespace mln + +#endif // ! MLN_TOPO_ADJ_LOWER_HIGHER_FACE_ITER_HH diff --git a/milena/mln/topo/complex.hh b/milena/mln/topo/complex.hh index c053879..1291ca7 100644 --- a/milena/mln/topo/complex.hh +++ b/milena/mln/topo/complex.hh @@ -58,6 +58,7 @@ # 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> namespace mln -- 1.6.0.1