3523: Add an identity site iterator adaptor.

https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Add an identity site iterator adaptor. * mln/core/internal/piter_identity.hh: New. * mln/core/internal/site_iterator_base.hh (todo): Remove; done. * mln/core/internal/site_set_iterator_base.hh (pset): New. Upgrade file doc style. piter_identity.hh | 88 ++++++++++++++++++++++++++++++++++++++++++++++ site_iterator_base.hh | 8 +--- site_set_iterator_base.hh | 29 ++++++++------- 3 files changed, 106 insertions(+), 19 deletions(-) Index: mln/core/internal/piter_identity.hh --- mln/core/internal/piter_identity.hh (revision 0) +++ mln/core/internal/piter_identity.hh (revision 0) @@ -0,0 +1,88 @@ +// Copyright (C) 2009 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. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_INTERNAL_PITER_IDENTITY_HH +# define MLN_CORE_INTERNAL_PITER_IDENTITY_HH + +/// \file mln/core/internal/piter_identity.hh +/// +/// \brief Definition of site iterator identity adaptors. + +# include <mln/core/internal/piter_adaptor.hh> + + +namespace mln +{ + + namespace internal + { + + /// A base class for site iterator identity adaptors. + /// + /// Parameter \c Pi is the type of the site iterator adaptee; + /// parameter E is the exact type. + /// + template <typename Pi, typename E> + class piter_identity_ : public piter_adaptor_< Pi, // Adaptee. + mln_pset(Pi), // Site set. + E > // Exact type. + { + typedef piter_adaptor_< Pi, mln_pset(Pi), E > super_; + + protected: + + /// Constructor without argument. + piter_identity_(); + + /// Constructor from a point iterator \p piter. + piter_identity_(const Pi& piter); + }; + + +# ifndef MLN_INCLUDE_ONLY + + template <typename Pi, typename E> + inline + piter_identity_<Pi,E>::piter_identity_() + { + } + + template <typename Pi, typename E> + inline + piter_identity_<Pi,E>::piter_identity_(const Pi& pi) + : super_(pi) + { + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::internal + +} // end of namespace mln + + +#endif // ! MLN_CORE_INTERNAL_PITER_IDENTITY_HH Index: mln/core/internal/site_iterator_base.hh --- mln/core/internal/site_iterator_base.hh (revision 3521) +++ mln/core/internal/site_iterator_base.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2008, 2009 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 @@ -31,17 +32,12 @@ /// \file mln/core/internal/site_iterator_base.hh /// /// Base class to factor code for site iterator classes. -/// -/// \todo Import tech doc from home. # include <mln/core/concept/site_iterator.hh> # include <mln/core/concept/pseudo_site.hh> // Use of if_possible::change_target. -// FIXME: See todo. - - namespace mln { Index: mln/core/internal/site_set_iterator_base.hh --- mln/core/internal/site_set_iterator_base.hh (revision 3521) +++ mln/core/internal/site_set_iterator_base.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2008 EPITA Research and Development Laboratory +// Copyright (C) 2008, 2009 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 @@ -28,11 +29,10 @@ #ifndef MLN_CORE_INTERNAL_SITE_SET_ITERATOR_BASE_HH # define MLN_CORE_INTERNAL_SITE_SET_ITERATOR_BASE_HH -/*! \file mln/core/internal/site_set_iterator_base.hh - * - * \brief Base class to factor code for iterator classes directly - * working on site sets. - */ +/// \file mln/core/internal/site_set_iterator_base.hh +/// +/// \brief Base class to factor code for iterator classes directly +/// working on site sets. # include <mln/core/internal/site_iterator_base.hh> @@ -43,18 +43,21 @@ namespace internal { - /*! A base class for site iterators. - * - * Parameter \c S is the targeted site set type. - * - * IMPORTANT: Sub-classes have to define start_, next_, - * is_valid_ and invalidate_. - */ + /// A base class for iterators on site sets. + /// + /// Parameter \c S is the targeted site set type. + /// + /// IMPORTANT: Sub-classes have to define start_, next_, + /// is_valid_ and invalidate_. + // template <typename S, typename E> class site_set_iterator_base : public site_iterator_base<S, E> { public: + /// The associated site set type. + typedef S pset; + /// Give the site set that this iterator browses. const S& site_set() const;
participants (1)
-
Thierry Geraud