2512: Add a complex relative iterator adapter adding the center/ref. face.

* mln/topo/centered_iter_adapter.hh: New. --- milena/ChangeLog | 6 + milena/mln/topo/centered_iter_adapter.hh | 161 ++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+), 0 deletions(-) create mode 100644 milena/mln/topo/centered_iter_adapter.hh diff --git a/milena/ChangeLog b/milena/ChangeLog index 5375a7d..c86e12a 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,11 @@ 2008-10-04 Roland Levillain <roland@lrde.epita.fr> + Add a complex relative iterator adapter adding the center/ref. face. + + * mln/topo/centered_iter_adapter.hh: New. + +2008-10-04 Roland Levillain <roland@lrde.epita.fr> + Add a complex relative iterator iterating on its center only. * mln/topo/center_only_iter.hh: New. diff --git a/milena/mln/topo/centered_iter_adapter.hh b/milena/mln/topo/centered_iter_adapter.hh new file mode 100644 index 0000000..b9cb399 --- /dev/null +++ b/milena/mln/topo/centered_iter_adapter.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_CENTERED_ITER_ADAPTER_HH +# define MLN_TOPO_CENTERED_ITER_ADAPTER_HH + +/// \file mln/topo/centered_iter_adapter.hh +/// \brief Complex relative iterator adapters adding the central +/// (reference) point to the set of iterated faces. + +# include <mln/topo/internal/complex_relative_iterator_sequence.hh> +# include <mln/topo/center_only_iter.hh> + +# include <mln/topo/face.hh> + + +namespace mln +{ + + namespace topo + { + + /*----------------------------------------. + | topo::centered_fwd_iter_adapter<D, I>. | + `----------------------------------------*/ + + // FIXME: We should deduce D from I. + + /// \brief Backward complex relative iterator adapters adding the + /// central (reference) point to the set of iterated faces. + /// + /// \arg \p D The dimension of the complex this iterator belongs to. + /// \arg \p I The adapated complex relative iterator. + template <unsigned D, typename I> + class centered_fwd_iter_adapter + : public internal::complex_relative_iterator_sequence< center_only_iter<D>, + I, + centered_fwd_iter_adapter<D, I> > + { + typedef centered_fwd_iter_adapter<D, I> self_; + typedef center_only_iter<D> iter1_; + typedef I iter2_; + typedef internal::complex_relative_iterator_sequence< iter1_, + iter2_, + self_ > super_; + + public: + /// Construction. + /// \{ + centered_fwd_iter_adapter(); + template <typename Fref> + centered_fwd_iter_adapter(const Fref& f_ref); + /// \} + }; + + + /*----------------------------------------. + | topo::centered_bkd_iter_adapter<D, I>. | + `----------------------------------------*/ + + // FIXME: We should deduce D from I. + + /// \brief Forward complex relative iterator adapters adding the + /// central (reference) point to the set of iterated faces. + /// + /// \arg \p D The dimension of the complex this iterator belongs to. + /// \arg \p I The adapated complex relative iterator. + template <unsigned D, typename I> + class centered_bkd_iter_adapter + : public internal::complex_relative_iterator_sequence< I, + center_only_iter<D>, + centered_bkd_iter_adapter<D, I> > + { + typedef centered_bkd_iter_adapter<D, I> self_; + typedef I iter1_; + typedef center_only_iter<D> iter2_; + typedef internal::complex_relative_iterator_sequence< iter1_, + iter2_, + self_ > super_; + + public: + /// Construction. + /// \{ + centered_bkd_iter_adapter(); + template <typename Fref> + centered_bkd_iter_adapter(const Fref& f_ref); + /// \} + }; + + + +# ifndef MLN_INCLUDE_ONLY + + /*----------------------------------------. + | topo::centered_fwd_iter_adapter<D, I>. | + `----------------------------------------*/ + + template <unsigned D, typename I> + inline + centered_fwd_iter_adapter<D, I>::centered_fwd_iter_adapter() + { + } + + template <unsigned D, typename I> + template <typename Fref> + inline + centered_fwd_iter_adapter<D, I>::centered_fwd_iter_adapter(const Fref& f_ref) + : super_(f_ref) + { + } + + + /*----------------------------------------. + | topo::centered_bkd_iter_adapter<D, I>. | + `----------------------------------------*/ + + template <unsigned D, typename I> + inline + centered_bkd_iter_adapter<D, I>::centered_bkd_iter_adapter() + { + } + + template <unsigned D, typename I> + template <typename Fref> + inline + centered_bkd_iter_adapter<D, I>::centered_bkd_iter_adapter(const Fref& f_ref) + : super_(f_ref) + { + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::topo + +} // end of namespace mln + +#endif // ! MLN_TOPO_CENTERED_ITER_ADAPTER_HH -- 1.6.0.1
participants (1)
-
Roland Levillain