cleanup-2008 2282: Fix double_neighb2d name.

https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Fix double_neighb2d name. * mln/core/image/ch_piter.hh: New. * mln/make/dual_neighb2d.hh: Rename as... * mln/make/double_neighb2d.hh: ...this. * doc/examples/tuto_bis.cc: Update. doc/examples/tuto_bis.cc | 39 ---------- mln/core/image/ch_piter.hh | 167 ++++++++++++++++++++++++++++++++++++++++++++ mln/make/double_neighb2d.hh | 13 +-- 3 files changed, 176 insertions(+), 43 deletions(-) Index: doc/examples/tuto_bis.cc --- doc/examples/tuto_bis.cc (revision 2281) +++ doc/examples/tuto_bis.cc (working copy) @@ -7,7 +7,7 @@ # include <mln/core/alias/window2d.hh> # include <mln/core/alias/neighb2d.hh> -# include <mln/make/dual_neighb2d.hh> +# include <mln/make/double_neighb2d.hh> # include <mln/core/site_set/p_centered.hh> # include <mln/literal/origin.hh> @@ -26,39 +26,6 @@ # include <mln/debug/println.hh> -/* - -namespace mln -{ - - namespace level - { - - template<typename I, typename R> - mln_ch_value(I, R) - transform(const Image<I>& input_, const std::vector<R>& v) - { - trace::entering("level::transform"); - const I& input = exact(input_); - - mln_ch_value(I, R) output; - initialize(output, input); - - mln_piter(I) p(input.domain()); - for_all(p) - output(p) = v[input(p)]; - - trace::exiting("level::transform"); - return output; - } - - } // mln::level - - -} // mln - -*/ - namespace mln { @@ -220,7 +187,7 @@ 1, 0, 1, 0, 0, 0 }; - mln_VAR( e2c, make::dual_neighb2d(is_row_odd, e2c_h, e2c_v) ); + mln_VAR( e2c, make::double_neighb2d(is_row_odd, e2c_h, e2c_v) ); bool e2e_h[] = { 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, @@ -234,7 +201,7 @@ 0, 1, 0, 1, 0, 0, 0, 0, 0, 0 }; - mln_VAR( e2e, make::dual_neighb2d(is_row_odd, e2e_h, e2e_v) ); + mln_VAR( e2e, make::double_neighb2d(is_row_odd, e2e_h, e2e_v) ); Index: mln/core/image/ch_piter.hh --- mln/core/image/ch_piter.hh (revision 0) +++ mln/core/image/ch_piter.hh (revision 0) @@ -0,0 +1,167 @@ +// Copyright (C) 2008 EPITA Research and Development Laboratory +// +// 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_IMAGE_CH_PITER_HH +# define MLN_CORE_IMAGE_CH_PITER_HH + +/*! + * \file mln/core/image/ch_piter.hh + * + * \brief Definition of a morpher that changes the iterators. + */ + +# include <mln/core/internal/image_identity.hh> + + + +namespace mln +{ + + // Forward declaration. + template <typename I, typename Fwd> struct ch_piter_image; + + + namespace internal + { + + /// \internal Data structure for \c mln::ch_piter_image<I,Fwd>. + template <typename I, typename Fwd> + struct data< ch_piter_image<I,Fwd> > + { + data(I& ima); + I ima_; + }; + + } // end of namespace mln::internal + + + namespace trait + { + + template <typename I, typename Fwd> + struct image_< ch_piter_image<I,Fwd> > : image_< I > // Same as I except... + { + // ...theis change. + typedef trait::image::category::identity_morpher category; + }; + + } // end of namespace mln::trait + + + + // FIXME: Doc! + + template <typename I, typename Fwd> + class ch_piter_image : public internal::image_identity< I, + mln_pset(I), + ch_piter_image<I,Fwd> > + { + public: + + /// Skeleton. + typedef ch_piter_image< tag::image_<I>, Fwd > skeleton; + + typedef Fwd fwd_piter; + typedef Fwd bkd_piter; // FIXME + typedef fwd_piter piter; + + ch_piter_image(); + ch_piter_image(I& ima); + + // Deferred initialization. + void init_(I& ima); + }; + + + + template <typename Fwd, typename I> + ch_piter_image<I,Fwd> + ch_piter(Image<I>& ima); + + + +# ifndef MLN_INCLUDE_ONLY + + + // internal::data< ch_piter_image<I,S> > + + namespace internal + { + + template <typename I, typename Fwd> + inline + data< ch_piter_image<I,Fwd> >::data(I& ima) + : ima_(ima) + { + } + + } // end of namespace mln::internal + + + // ch_piter_image<I,Fwd> + + template <typename I, typename Fwd> + inline + ch_piter_image<I,Fwd>::ch_piter_image() + { + } + + template <typename I, typename Fwd> + inline + ch_piter_image<I,Fwd>::ch_piter_image(I& ima) + { + mln_precondition(ima.has_data()); + init_(ima); + } + + template <typename I, typename Fwd> + inline + void + ch_piter_image<I,Fwd>::init_(I& ima) + { + mln_precondition(ima.has_data()); + this->data_ = new internal::data< ch_piter_image<I,Fwd> >(ima); + } + + + // ch_piter + + template <typename Fwd, typename I> + inline + ch_piter_image<I,Fwd> + ch_piter(Image<I>& ima) + { + ch_piter_image<I,Fwd> tmp(exact(ima)); + return tmp; + } + +# endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + + +#endif // ! MLN_CORE_IMAGE_CH_PITER_HH Index: mln/make/double_neighb2d.hh --- mln/make/double_neighb2d.hh (revision 2281) +++ mln/make/double_neighb2d.hh (working copy) @@ -25,10 +25,10 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_MAKE_DUAL_NEIGHB2D_HH -# define MLN_MAKE_DUAL_NEIGHB2D_HH +#ifndef MLN_MAKE_DOUBLE_NEIGHB2D_HH +# define MLN_MAKE_DOUBLE_NEIGHB2D_HH -/*! \file mln/make/dual_neighb2d.hh +/*! \file mln/make/double_neighb2d.hh * * \brief Routine to create a dual neighborhood. */ @@ -47,7 +47,7 @@ template <typename A, unsigned St, unsigned Sf> neighb< win::multiple<window2d, bool(*)(A)> > - dual_neighb2d(bool (*test)(A), + double_neighb2d(bool (*test)(A), bool const (&when_true) [St], bool const (&when_false)[Sf]); @@ -55,11 +55,10 @@ # ifndef MLN_INCLUDE_ONLY - template <typename A, unsigned St, unsigned Sf> inline neighb< win::multiple<window2d, bool(*)(A)> > - dual_neighb2d(bool (*test)(A), + double_neighb2d(bool (*test)(A), bool const (&when_true) [St], bool const (&when_false)[Sf]) { @@ -78,4 +77,4 @@ } // end of namespace mln -#endif // ! MLN_MAKE_DUAL_NEIGHB2D_HH +#endif // ! MLN_MAKE_DOUBLE_NEIGHB2D_HH
participants (1)
-
Thierry Geraud