3949: Improve compatibility with g++-2.95.

https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Improve compatibility with g++-2.95. * mln/core/internal/exact_gcc_2_95.hh: New. * mln/core/routine/exact.hh: Calls the previous version if g++ version is less than 3. * mln/core/internal/exact.hh (make_): Add code so that it passes g++-2.95. * tests/core/routine/exact.cc: Augment. * trash/fi_adaptor.cc, * mln/topo/face.hh, * mln/topo/internal/complex_iterator_base.hh, * mln/core/site_set/p_array.hh, * mln/core/site_set/p_image.hh, * mln/core/image/imorph/tr_image.hh, * mln/core/image/imorph/interpolated.hh, * mln/core/image/imorph/labeled_image.hh, * mln/core/point.hh, * mln/core/concept/pseudo_site.hh, * mln/core/category.hh, * mln/core/internal/check/image_fastest.hh, * mln/core/internal/graph_psite_base.hh, * mln/accu/transform_directional.hh, * mln/accu/transform_diagonal.hh, * mln/accu/transform_snake.hh, * mln/value/internal/gray_.hh, * mln/convert/to_p_array.hh, * mln/binarization/binarization.hh, * mln/binarization/threshold.hh, * mln/canvas/browsing/backdiagonal2d.hh, * mln/canvas/browsing/internal/graph_first_search.hh, * mln/labeling/compute.hh, * tests/core/image/imorph/tr_image.cc, * tests/core/image/imorph/labeled_image.cc, * tests/accu/site_set/rectangularity.cc, * tests/accu/compute.cc, * tests/canvas/browsing/fwd.cc, * tests/canvas/browsing/snake_fwd.cc, * tests/canvas/browsing/snake_vert.cc, * tests/canvas/browsing/snake_generic_2d_vert.cc, * tests/canvas/browsing/snake_generic_2d_hori.cc, * tests/canvas/browsing/snake_generic_3d_vert.cc, * tests/canvas/browsing/snake_generic_3d_hori.cc, * tests/canvas/browsing/hyper_directional.cc, * tests/canvas/browsing/diagonal2d.cc, * tests/canvas/browsing/backdiagonal2d.cc: Better pass g++-2.95. Misc. * mln/trait/concrete.hh (mln_concrete_ch_value): Remove. We have mln_ch_value. mln/accu/transform_diagonal.hh | 5 mln/accu/transform_directional.hh | 6 mln/accu/transform_snake.hh | 2 mln/binarization/binarization.hh | 14 - mln/binarization/threshold.hh | 10 - mln/canvas/browsing/backdiagonal2d.hh | 9 - mln/canvas/browsing/internal/graph_first_search.hh | 9 - mln/convert/to_p_array.hh | 4 mln/core/category.hh | 37 ++-- mln/core/concept/pseudo_site.hh | 14 + mln/core/image/imorph/interpolated.hh | 14 - mln/core/image/imorph/labeled_image.hh | 9 - mln/core/image/imorph/tr_image.hh | 17 +- mln/core/internal/check/image_fastest.hh | 10 - mln/core/internal/exact.hh | 24 ++ mln/core/internal/exact_gcc_2_95.hh | 173 +++++++++++++++++++++ mln/core/internal/graph_psite_base.hh | 5 mln/core/point.hh | 29 ++- mln/core/routine/exact.hh | 23 ++ mln/core/site_set/p_array.hh | 11 - mln/core/site_set/p_image.hh | 25 ++- mln/labeling/compute.hh | 4 mln/topo/face.hh | 10 - mln/topo/internal/complex_iterator_base.hh | 7 mln/trait/concrete.hh | 8 mln/value/internal/gray_.hh | 2 tests/accu/compute.cc | 8 tests/accu/site_set/rectangularity.cc | 5 tests/canvas/browsing/backdiagonal2d.cc | 4 tests/canvas/browsing/diagonal2d.cc | 3 tests/canvas/browsing/fwd.cc | 9 - tests/canvas/browsing/hyper_directional.cc | 3 tests/canvas/browsing/snake_fwd.cc | 9 - tests/canvas/browsing/snake_generic_2d_hori.cc | 14 - tests/canvas/browsing/snake_generic_2d_vert.cc | 14 - tests/canvas/browsing/snake_generic_3d_hori.cc | 14 - tests/canvas/browsing/snake_generic_3d_vert.cc | 14 - tests/canvas/browsing/snake_vert.cc | 11 - tests/core/image/imorph/labeled_image.cc | 10 - tests/core/image/imorph/tr_image.cc | 8 tests/core/routine/exact.cc | 170 +++++++++++++++++++- trash/fi_adaptor.cc | 4 42 files changed, 608 insertions(+), 173 deletions(-) Index: trash/fi_adaptor.cc --- trash/fi_adaptor.cc (revision 3948) +++ trash/fi_adaptor.cc (working copy) @@ -50,8 +50,8 @@ int main() { - using typename value::int_u8; - using typename value::rgb8; + using value::int_u8; + using value::rgb8; { /* FIXME: Under GNU/Linux or under any *nix OS (i.e. under Unix or Index: mln/topo/face.hh --- mln/topo/face.hh (revision 3948) +++ mln/topo/face.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 @@ -29,7 +30,8 @@ # define MLN_TOPO_FACE_HH /// \file mln/topo/face.hh -/// Face of a complex. +/// +/// \brief Face of a complex. # include <iostream> # include <vector> @@ -357,7 +359,7 @@ face<D>::lower_dim_adj_faces() const { // FIXME: Warning: might prevent any attempt to build a complex<0>. - metal::bool_< D != 0 >::check(); + metal::bool_<( D != 0 )>::check(); return n_ > 0 ? internal::lower_dim_adj_faces_if_dim_matches_<D, D>()(*this) : @@ -370,7 +372,7 @@ face<D>::higher_dim_adj_faces() const { // FIXME: Warning: might prevent any attempt to build a complex<0>. - metal::bool_< D != 0 >::check(); + metal::bool_<( D != 0 )>::check(); return n_ < D ? internal::higher_dim_adj_faces_if_dim_matches_<D - 1, D>()(*this) : Index: mln/topo/internal/complex_iterator_base.hh --- mln/topo/internal/complex_iterator_base.hh (revision 3948) +++ mln/topo/internal/complex_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 @@ -29,7 +30,8 @@ # define MLN_TOPO_INTERNAL_COMPLEX_ITERATOR_BASE_HH /** \file mln/topo/internal/complex_iterator_base.hh - Definition of an implementation (factoring) class for + + \brief Definition of an implementation (factoring) class for iterators on complexes. Concrete iterators should inherit either from @@ -56,6 +58,7 @@ */ # include <iosfwd> +# include <iostream> # include <mln/core/concept/iterator.hh> # include <mln/topo/complex.hh> Index: mln/trait/concrete.hh --- mln/trait/concrete.hh (revision 3948) +++ mln/trait/concrete.hh (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 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,7 +31,7 @@ /// \file mln/trait/concrete.hh /// -/// Definition of the concrete image trait. +/// \brief Definition of the concrete image trait. # include <mln/trait/ch_value.hh> @@ -39,8 +39,6 @@ # define mln_concrete(I) typename mln::trait::concrete< I >::ret # define mln_concrete_(I) mln::trait::concrete< I >::ret -# define mln_concrete_ch_value(I, V) mln_ch_value(mln_concrete(I), V) - namespace mln { Index: mln/core/site_set/p_array.hh --- mln/core/site_set/p_array.hh (revision 3948) +++ mln/core/site_set/p_array.hh (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 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,12 +31,14 @@ /// \file mln/core/site_set/p_array.hh /// -/// Definition of a point set class based on std::vector. +/// \brief Definition of a point set class based on std::vector. /// /// \todo Add a facade to index_of_in so that it dispatches when /// calling it with Object<p_array_site>. /// /// \todo Use util::index (instead of int) as many times as possible. +/// +/// \todo See also the 'todo' entry in mln/core/concept/pseudo_site.hh. # include <vector> @@ -188,6 +190,9 @@ // pseudo site knows the site set it refers to. typedef S target; + typedef S target_t; // To please g++-2.95. + // Also read the 'todo' in mln/core/concept/pseudo_site.hh. + // As a Proxy: const element& subj_(); Index: mln/core/site_set/p_image.hh --- mln/core/site_set/p_image.hh (revision 3948) +++ mln/core/site_set/p_image.hh (working copy) @@ -67,21 +67,36 @@ } // end of namespace trait + namespace internal + { + + template <typename I> + struct p_image_site_set // Hack to help g++-2.95. + { + private: + typedef mln_domain(I) S_; + typedef fun::eq_v2b_expr_< pw::value_<I>, pw::cst_<bool> > F_; + public: + typedef p_if<S_, F_> ret; + }; + + + } // end of namespace internal + + /// \brief Site set based on an image of Booleans. /// /// \ingroup modsitesetsparse template <typename I> class p_image : public internal::site_set_base_< mln_psite(I), p_image<I> > { - typedef mln_domain(I) S_; - typedef fun::eq_v2b_expr_< pw::value_<I>, pw::cst_<bool> > F_; public: /// Equivalent site_set type. - typedef p_if<S_, F_> S; + typedef typename internal::p_image_site_set<I>::ret S; /// Conversion towards the equivalent site set. - operator S() const; + operator typename internal::p_image_site_set<I>::ret () const; /// Element associated type. @@ -159,7 +174,7 @@ template <typename I> inline - p_image<I>::operator S() const + p_image<I>::operator typename internal::p_image_site_set<I>::ret () const { S tmp(ima_.domain(), pw::value(ima_) == pw::cst(true)); return tmp; Index: mln/core/image/imorph/tr_image.hh --- mln/core/image/imorph/tr_image.hh (revision 3948) +++ mln/core/image/imorph/tr_image.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/core/image/imorph/tr_image.hh /// -/// Definition of the morpher mln::tr_image presenting an image +/// \brief Definition of the morpher mln::tr_image presenting an image /// through a (bijective) transformation. # include <cmath> @@ -40,6 +40,7 @@ # include <mln/algebra/vec.hh> # include <mln/value/set.hh> + namespace mln { @@ -126,7 +127,7 @@ using super_::has; /// Test if a pixel value is accessible at \p v. - bool has(const mln::algebra::vec<I::psite::dim, float>& v) const; + bool has(const mln::algebra::vec<site::dim, float>& v) const; /// Read-only access of pixel value at point site \p p. /// Mutable access is only OK for reading (not writing). @@ -186,12 +187,12 @@ template <typename S, typename I, typename T> inline bool - tr_image<S,I,T>::has(const algebra::vec<I::psite::dim, float>& v) const + tr_image<S,I,T>::has(const algebra::vec<site::dim, float>& v) const { mln_psite(I) p; - algebra::vec<I::point::dim, float> v2 = this->data_->tr_.inv()(v); - for (unsigned i = 0; i < I::point::dim; ++i) - p[i] = static_cast<int>(round(v2[i])); + algebra::vec<I::site::dim, float> v2 = this->data_->tr_.inv()(v); + for (unsigned i = 0; i < I::site::dim; ++i) + p[i] = static_cast<int>(v2[i]); return this->delegatee_().has(p); } @@ -201,7 +202,7 @@ mln_value(I) tr_image<S,I,T>::operator()(const psite& p) const { - algebra::vec<I::psite::dim, float> v = p.to_vec(); + algebra::vec<site::dim, float> v = p.to_vec(); return this->data_->ima_(this->data_->tr_.inv()(v)); } @@ -210,7 +211,7 @@ mln_value(I) tr_image<S,I,T>::operator()(const psite& p) { - algebra::vec<I::psite::dim, float> v = p.to_vec(); + algebra::vec<site::dim, float> v = p.to_vec(); return this->data_->ima_(this->data_->tr_.inv()(v)); } Index: mln/core/image/imorph/interpolated.hh --- mln/core/image/imorph/interpolated.hh (revision 3948) +++ mln/core/image/imorph/interpolated.hh (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 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,7 +31,7 @@ /// \file mln/core/image/imorph/interpolated.hh /// -/// Definition of a morpher that makes an image become readable +/// \brief Definition of a morpher that makes an image become readable /// with floating coordinates. /// /// \todo think having has(algebra::vec v) as a method @@ -128,8 +128,8 @@ /// Mutable access is only OK for reading (not writing). using super_::operator(); - mln_value(I) operator()(const mln::algebra::vec<I::psite::dim, float>& v) const; - mln_value(I) operator()(const mln::algebra::vec<I::psite::dim, float>& v); + mln_value(I) operator()(const mln::algebra::vec<psite::dim, float>& v) const; + mln_value(I) operator()(const mln::algebra::vec<psite::dim, float>& v); const F<I> fun_; }; @@ -197,7 +197,7 @@ template <typename I, template <class> class F> inline mln_value(I) - interpolated<I,F>::operator()(const mln::algebra::vec<I::psite::dim, float>& v) const + interpolated<I,F>::operator()(const mln::algebra::vec<psite::dim, float>& v) const { return fun_(v); } @@ -205,7 +205,7 @@ template <typename I, template <class> class F> inline mln_value(I) - interpolated<I,F>::operator()(const mln::algebra::vec<I::psite::dim, float>& v) + interpolated<I,F>::operator()(const mln::algebra::vec<psite::dim, float>& v) { return fun_(v); } Index: mln/core/image/imorph/labeled_image.hh --- mln/core/image/imorph/labeled_image.hh (revision 3948) +++ mln/core/image/imorph/labeled_image.hh (working copy) @@ -31,14 +31,11 @@ /// \file mln/core/image/imorph/labeled_image.hh /// -/// Definition of a morpher on a labeled image. +/// \brief Definition of a morpher on a labeled image. # include <mln/core/image/dmorph/image_if.hh> - # include <mln/core/concept/function.hh> - # include <mln/core/internal/image_identity.hh> - # include <mln/core/site_set/box.hh> # include <mln/accu/pair.hh> @@ -340,8 +337,8 @@ void labeled_image<I>::update_() { - this->data_->bboxes_ - = labeling::compute(accu::meta::bbox(), this->data_->ima_, + this->data_->bboxes_ = labeling::compute(accu::meta::bbox(), + this->data_->ima_, this->data_->nlabels_); } Index: mln/core/routine/exact.hh --- mln/core/routine/exact.hh (revision 3948) +++ mln/core/routine/exact.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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,9 +29,9 @@ #ifndef MLN_CORE_ROUTINE_EXACT_HH # define MLN_CORE_ROUTINE_EXACT_HH -/*! \file mln/core/routine/exact.hh - * \brief Definition of the mln::exact downcast routines. - */ +/// \file mln/core/routine/exact.hh +/// +/// \brief Definition of the mln::exact downcast routines. /// FIXME: Doc! #define mln_exact(T) typename mln::internal::exact_<T>::ret @@ -38,9 +39,17 @@ #include <mln/core/internal/exact.hh> + + +# if defined(__GNUC__) && __GNUC__ < 3 +# include <mln/core/internal/exact_gcc_2_95.hh> +# else + + namespace mln { + /*! \brief Exact cast routine for mln objects. * * This set of routines can be used to downcast an object towards @@ -65,7 +74,7 @@ # ifndef MLN_INCLUDE_ONLY - // exact + // Exact. template <typename T> inline @@ -85,4 +94,8 @@ } // end of namespace mln + +# endif // ! (defined(__GNUC__) && __GNUC__ < 3) + + #endif // ! MLN_CORE_ROUTINE_EXACT_HH Index: mln/core/point.hh --- mln/core/point.hh (revision 3948) +++ mln/core/point.hh (working copy) @@ -31,7 +31,12 @@ /// \file mln/core/point.hh /// -/// Definition of the generic point class mln::point. +/// \brief Definition of the generic point class mln::point. +/// +/// \todo the structure subject_point_impl is useless: first it is +/// only used for 3D points (and it can be usefull for other points); +/// second there is a room for the couple of methods (in the +/// subject_impl specializations defined in core/alias/point*d.hh). # include <mln/core/def/coord.hh> # include <mln/core/concept/proxy.hh> @@ -76,6 +81,17 @@ + namespace internal + { + // This is a hack so that g++-2.95 can compile the method + // "point<G,C>::operator vec() const". + template <typename G, typename C> + struct vec_of_point + { + typedef algebra::vec<G::dim, float> ret; + }; + } + /// Generic point class. /// /// Parameters are \c n the dimension of the space and \c C the @@ -176,7 +192,7 @@ https://trac.lrde.org/olena/changeset/1224#file2 https://www.lrde.epita.fr/pipermail/olena-patches/2007-October/001592.html */ - operator algebra::vec<G::dim, float> () const; + operator typename internal::vec_of_point<G,C>::ret () const; // Hack to help g++-2.95. /// Explicit conversion towards mln::algebra::vec. vec to_vec() const; @@ -207,7 +223,7 @@ struct subject_point_impl< point<G,C>, E > { typename point<G,C>::vec to_vec() const; - operator algebra::vec<G::dim, float>() const; + operator typename point<G,C>::vec () const; // Hack to help g++-2.95. private: const E& exact_() const; @@ -226,6 +242,7 @@ const util::yes& cut_(const point<grid::tick,C>& p); + # ifndef MLN_INCLUDE_ONLY namespace convert @@ -430,7 +447,7 @@ template <typename G, typename C> inline - point<G,C>::operator algebra::vec<G::dim, float> () const + point<G,C>::operator typename internal::vec_of_point<G,C>::ret () const // Hack to help g++-2.95. { return to_vec(); } @@ -521,7 +538,7 @@ template <typename G, typename C, typename E> inline - subject_point_impl< point<G,C>, E >::operator algebra::vec<G::dim, float>() const + subject_point_impl< point<G,C>, E >::operator typename point<G,C>::vec () const // Hack to help g++-2.95. { return exact_().get_subject(); } @@ -530,7 +547,7 @@ template <typename G, typename C> inline - algebra::vec<point<G,C>::dim - 1, C> + const algebra::vec<point<G,C>::dim - 1, C>& cut_(const point<G,C>& p) { return *(algebra::vec<point<G,C>::dim - 1, C>*)(& p.to_vec()); Index: mln/core/concept/pseudo_site.hh --- mln/core/concept/pseudo_site.hh (revision 3948) +++ mln/core/concept/pseudo_site.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,10 +29,13 @@ #ifndef MLN_CORE_CONCEPT_PSEUDO_SITE_HH # define MLN_CORE_CONCEPT_PSEUDO_SITE_HH -/*! \file mln/core/concept/pseudo_site.hh - * - * \brief Definition of the concept of mln::Pseudo_Site. - */ +/// \file mln/core/concept/pseudo_site.hh +/// +/// \brief Definition of the concept of mln::Pseudo_Site. +/// +/// \todo Inconsistency: "if_possible::change_target" expects +/// "::target_t" from a pseudo-site, whereas the concept checks for +/// "::target". # include <mln/core/concept/site_proxy.hh> # include <mln/metal/is_a.hh> Index: mln/core/category.hh --- mln/core/category.hh (revision 3948) +++ mln/core/category.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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,10 +29,9 @@ #ifndef MLN_CORE_CATEGORY_HH # define MLN_CORE_CATEGORY_HH -/*! \file mln/core/category.hh - * - * \brief Definition of the category holder type. - */ +/// \file mln/core/category.hh +/// +/// \brief Definition of the category holder type. # include <mln/metal/equal.hh> @@ -80,24 +80,35 @@ namespace internal { - template < typename Category, typename T > - struct helper_super_category_; + // The code above could be merged into a couple of structures. + // Yet g++-2.95 needs help so we first decompose Category<S> + // into (Category, S) then we solve. + + template < template <class> class Category, typename S, typename T > + struct helper_super_category_solve_ + : + private metal::equal< typename Category<void>::super, void* >::check_t + { + // New case. + typedef S ret; + }; template < template <class> class Category, typename T > - struct helper_super_category_< Category<void>, T > + struct helper_super_category_solve_< Category, void, T > { typedef typename Category<void>::super ret; // One super category: keep it. }; + template < typename Category, typename T > + struct helper_super_category_; + template < template <class> class Category, typename S, typename T > - struct helper_super_category_< Category<S>, T > - : - private metal::equal< typename Category<void>::super, void* >::check_t + struct helper_super_category_< Category<S>, T > : helper_super_category_solve_< Category, S, T > { - // New case. - typedef S ret; }; + + // For bwd in-compatibility. template < template <class> class Category, typename T > struct helper_super_category_< Category<void*>, T >; Index: mln/core/internal/exact.hh --- mln/core/internal/exact.hh (revision 3948) +++ mln/core/internal/exact.hh (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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,9 +29,9 @@ #ifndef MLN_CORE_INTERNAL_EXACT_HH # define MLN_CORE_INTERNAL_EXACT_HH -/*! \file mln/core/internal/exact.hh - * \brief Meta-code for the mln::exact downcast routines. - */ +/// \file mln/core/internal/exact.hh +/// +/// \brief Meta-code for the mln::exact downcast routines. /// Forward declaration. @@ -88,7 +89,8 @@ struct exact_ { enum { id = sizeof(exact_selector_(make_<T>::ptr())) }; - typedef typename exact_ret_<id, T>::ret ret; + typedef exact_ret_<id, T> helper; + typedef typename helper::ret ret; static ret* run(T* t) { return exact_run_(t, t); @@ -99,7 +101,8 @@ struct exact_<const T> { enum { id = sizeof(exact_selector_(make_<T>::ptr())) }; - typedef const typename exact_ret_<id, T>::ret ret; + typedef exact_ret_<id, T> helper; + typedef const typename helper::ret ret; static ret* run(const T* t) { return exact_run_((T*)t, (T*)t); @@ -109,6 +112,15 @@ # ifndef MLN_INCLUDE_ONLY + template <typename T> + inline + T* + make_<T>::ptr() // This piece of code is defined to prevent an ICE from g++-2.95. + { + T* tmp; + return tmp; + } + template <typename E, typename T> inline E* exact_run_(Object<E>* t, T*) Index: mln/core/internal/check/image_fastest.hh --- mln/core/internal/check/image_fastest.hh (revision 3948) +++ mln/core/internal/check/image_fastest.hh (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 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,18 +31,18 @@ /// \file mln/core/internal/check/image_fastest.hh /// -/// Class that statically checks the interface of fastest +/// \brief Class that statically checks the interface of fastest /// images. /// /// \todo Check and convert p in index_of_point towards E::psite. - # include <mln/metal/bool.hh> # include <mln/core/macros.hh> # include <mln/core/trait/pixter.hh> # include <mln/core/trait/qlf_value.hh> # include <mln/core/internal/force_exact.hh> + namespace mln { @@ -121,8 +121,10 @@ unsigned (E::*m8)() const = & E::nelements; m8 = 0; +# if defined(__GNUC__) && __GNUC__ >= 3 unsigned (E::*m9)(const psite& p) const = & E::index_of_point; m9 = 0; +# endif // FIXME: how to check that qixter are defined when W is unknown! } Index: mln/core/internal/graph_psite_base.hh --- mln/core/internal/graph_psite_base.hh (revision 3948) +++ mln/core/internal/graph_psite_base.hh (working copy) @@ -32,6 +32,9 @@ /// \file mln/core/internal/graph_psite_base.hh /// /// Base implementation for graph based psites. +/// +/// \todo Do not compile when id_t is unsigned (so the conversion +/// operator is defined twice!) # include <mln/core/internal/pseudo_site_base.hh> @@ -309,7 +312,7 @@ template <typename S, typename E> inline - graph_psite_base<S,E>::operator unsigned() const + graph_psite_base<S,E>::operator unsigned() const // HERE { mln_precondition(is_valid()); return elt_.id(); Index: mln/core/internal/exact_gcc_2_95.hh --- mln/core/internal/exact_gcc_2_95.hh (revision 0) +++ mln/core/internal/exact_gcc_2_95.hh (revision 0) @@ -0,0 +1,173 @@ +// 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_EXACT_GCC_2_95_HH +# define MLN_CORE_INTERNAL_EXACT_GCC_2_95_HH + +/// \file mln/core/internal/exact_gcc_2_95.hh +/// +/// \brief Definition of the mln::exact downcast routines +/// for g++-2.95. + + +namespace mln +{ + + namespace internal + { + + // For exact(T&): + + template <typename T> + struct exact_gcc_2_95 + { + typedef mln_exact(T) E; + typedef E& ret; + static ret run(T& t) + { + return *internal::exact_<T>::run(&t); + } + }; + + template <typename T> + struct exact_gcc_2_95< const T > + { + typedef mln_exact(T) E; + typedef const E& ret; + static ret run(T& t) + { + return *internal::exact_<T>::run(const_cast<T*>(&t)); + } + }; + + template <typename T> + struct exact_gcc_2_95< T* > + { + typedef mln_exact(T) E; + typedef E* ret; + static ret run(T* t) + { + return internal::exact_<T>::run(t); + } + }; + + template <typename T> + struct exact_gcc_2_95< const T* > + { + typedef mln_exact(T) E; + typedef const E* ret; + static ret run(const T* t) + { + return internal::exact_<T>::run(const_cast<T*>(t)); + } + }; + + + + // For exact(const T&): + + template <typename T> + struct exact_const_gcc_2_95 + { + typedef mln_exact(T) E; + typedef const E& ret; + static ret run(T& t) + { + return *internal::exact_<T>::run(&t); + } + }; + + template <typename T> + struct exact_const_gcc_2_95< const T > + { + typedef mln_exact(T) E; + typedef const E& ret; + static ret run(T& t) + { + return *internal::exact_<T>::run(const_cast<T*>(&t)); + } + }; + + template <typename T> + struct exact_const_gcc_2_95< T* > + { + typedef mln_exact(T) E; + typedef E* ret; + static ret run(T* t) + { + return internal::exact_<T>::run(t); + } + }; + + template <typename T> + struct exact_const_gcc_2_95< const T*const > + { + typedef mln_exact(T) E; + typedef const E* ret; + static ret run(T* t) + { + return internal::exact_<T>::run(const_cast<T*>(t)); + } + }; + + template <typename T> + struct exact_const_gcc_2_95< const T* > + { + typedef mln_exact(T) E; + typedef const E* ret; + static ret run(const T* t) + { + return internal::exact_<T>::run(const_cast<T*>(t)); + } + }; + + + } // end of namespace mln::internal + + + + template <typename T> + typename internal::exact_gcc_2_95<T>::ret + inline + exact(T& t) + { + return internal::exact_gcc_2_95<T>::run(t); + } + + template <typename T> + typename internal::exact_const_gcc_2_95<T>::ret + inline + exact(const T& t) + { + return internal::exact_const_gcc_2_95<T>::run(const_cast<T&>(t)); + } + + + +} // end of namespace mln + +#endif // ! MLN_CORE_INTERNAL_EXACT_GCC_2_95_HH Index: mln/accu/transform_directional.hh --- mln/accu/transform_directional.hh (revision 3948) +++ mln/accu/transform_directional.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/accu/transform_directional.hh /// -/// Run an accumulator over a particular direction. +/// \brief Run an accumulator over a particular direction. /// /// \todo Split dispatch and impl. /// @@ -123,7 +123,9 @@ const W& win; mln_ch_value(I, mln_result(A)) output; A accu; - enum { dim = I::site::dim }; + + typedef mln_site(I) S; // Help g++-2.95. + enum { dim = S::dim }; mln_psite(I) p; unsigned dir; Index: mln/accu/transform_diagonal.hh --- mln/accu/transform_diagonal.hh (revision 3948) +++ mln/accu/transform_diagonal.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/accu/transform_diagonal.hh /// -/// Run an accumulator over a diagonal. +/// \brief Run an accumulator over a diagonal. /// /// \todo Split dispatch and impl. /// @@ -114,7 +114,8 @@ A accu; mln_psite(I) p; - enum { dim = I::site::dim }; + typedef mln_site(I) S; // Help g++-2.95. + enum { dim = S::dim }; window2d win_left, win_right; Index: mln/accu/transform_snake.hh --- mln/accu/transform_snake.hh (revision 3948) +++ mln/accu/transform_snake.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/accu/transform_snake.hh /// -/// Run an accumulator in a snake-like browsing. +/// \brief Run an accumulator in a snake-like browsing. /// /// \todo Make it n-D. /// Index: mln/value/internal/gray_.hh --- mln/value/internal/gray_.hh (revision 3948) +++ mln/value/internal/gray_.hh (working copy) @@ -232,7 +232,7 @@ inline long convert(int val) { - using typename mln::metal::int_; + using mln::metal::int_; typedef mlc_max(int_<n_dest - n_src> , int_<n_src - n_dest>) m; if (n_dest == n_src) Index: mln/convert/to_p_array.hh --- mln/convert/to_p_array.hh (revision 3948) +++ mln/convert/to_p_array.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/convert/to_p_array.hh /// -/// Conversions to mln::p_array. +/// \brief Conversions to mln::p_array. /// /// \todo Move these conversion in from_to related mechanisms. @@ -59,7 +59,7 @@ /// Convert an image \p img into a p_array. template <typename I> - p_array<mln_point(I)> + p_array<mln_psite(I)> to_p_array(const Image<I>& img); Index: mln/binarization/binarization.hh --- mln/binarization/binarization.hh (revision 3948) +++ mln/binarization/binarization.hh (working copy) @@ -31,7 +31,9 @@ /// \file mln/binarization/threshold.hh /// -/// Threshold the contents of an image into another binary one. +/// \brief Threshold an image. +/// +/// \todo Rename and/or remove (that is this?) # include <mln/core/concept/function.hh> # include <mln/data/transform.hh> @@ -52,7 +54,7 @@ /// for_all(p), output(p) = fun(p) template <typename I, typename F> inline - mln_concrete_ch_value(I, bool) + mln_ch_value(I, bool) binarization(const Image<I>& input, const Function_v2b<F>& fun); @@ -63,11 +65,11 @@ template <typename I, typename F> inline - mln_concrete_ch_value(I, bool) + mln_ch_value(I, bool) binarization_(const I& input, const Function_v2b<F>& fun) { trace::entering("binarization::impl::binarization_"); - mln_concrete_ch_value(I, bool) output(input.domain()); + mln_ch_value(I, bool) output(input.domain()); output = data::transform(input, fun); @@ -83,13 +85,13 @@ template <typename I, typename F> inline - mln_concrete_ch_value(I, bool) + mln_ch_value(I, bool) binarization(const Image<I>& input, const Function_v2b<F>& fun) { trace::entering("binarization::binarization"); mln_precondition(exact(input).is_valid()); - mln_concrete_ch_value(I, bool) output(exact(input).domain()); + mln_ch_value(I, bool) output(exact(input).domain()); output = impl::binarization_(exact(input), fun); trace::exiting("binarization::binarization"); Index: mln/binarization/threshold.hh --- mln/binarization/threshold.hh (revision 3948) +++ mln/binarization/threshold.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/binarization/threshold.hh /// -/// Threshold the contents of an image into another binary one. +/// \brief Threshold an image. # include <mln/binarization/binarization.hh> # include <mln/fun/v2b/threshold.hh> @@ -52,7 +52,7 @@ /// If input(p) is greater or equal than the threshold, the /// value in the output image in the same point will be TRUE, else FALSE. template <typename I> - mln_concrete_ch_value(I, bool) + mln_ch_value(I, bool) threshold(const Image<I>& input, const mln_value(I) threshold); @@ -60,7 +60,7 @@ template <typename I> inline - mln_concrete_ch_value(I, bool) + mln_ch_value(I, bool) threshold(const Image<I>& input, const mln_value(I) threshold_value) { trace::entering("binarization::threshold"); @@ -69,12 +69,12 @@ mlc_is(mln_trait_value_nature(mln_value(I)), trait::value::nature::scalar)::check(); - mln_concrete_ch_value(I, bool) output(exact(input).domain()); + mln_ch_value(I, bool) output(exact(input).domain()); // FIXME : threshold value should be a percentage. fun::v2b::threshold< mln_value(I) > f(threshold_value); - output = binarization::binarization(exact(input), f); + output = mln::binarization::binarization(exact(input), f); trace::exiting("binarization::threshold"); return output; Index: mln/canvas/browsing/backdiagonal2d.hh --- mln/canvas/browsing/backdiagonal2d.hh (revision 3948) +++ mln/canvas/browsing/backdiagonal2d.hh (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 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,11 +31,12 @@ /// \file mln/canvas/browsing/backdiagonal2d.hh /// -/// Backdiagonal2d browsing of an image. +/// \brief Backdiagonal2d browsing of an image. # include <mln/core/concept/browsing.hh> # include <mln/core/concept/image.hh> + namespace mln { @@ -89,6 +90,8 @@ extern const backdiagonal2d_t backdiagonal2d; + + # ifndef MLN_INCLUDE_ONLY const backdiagonal2d_t backdiagonal2d; Index: mln/canvas/browsing/internal/graph_first_search.hh --- mln/canvas/browsing/internal/graph_first_search.hh (revision 3948) +++ mln/canvas/browsing/internal/graph_first_search.hh (working copy) @@ -30,8 +30,10 @@ /// \file mln/canvas/browsing/internal/graph_first_search.hh /// -/// Depth-limited search algorithm for graph. -/// Browse over all vertices for each component. +/// \brief Depth-limited search algorithm for graph. Browse over all +/// vertices for each component. +/// +/// \todo Code "next(const S& stack)". /*! ** The functor should provide the following methods: @@ -126,8 +128,9 @@ util::vertex_id_t next(const S& stack) { + mln_assertion(0); /// Not defined yet! - mlc_abort(S)::check(); + // mlc_abort(S)::check(); return 0; } Index: mln/labeling/compute.hh --- mln/labeling/compute.hh (revision 3948) +++ mln/labeling/compute.hh (working copy) @@ -31,8 +31,8 @@ /// \file mln/labeling/compute.hh /// -/// Compute accumulators onto sites/values of each labeled component -/// of an image. +/// \brief Compute accumulators onto sites/values of each labeled +/// component of an image. /// /// \todo write fastest version. /// Index: tests/core/image/imorph/tr_image.cc --- tests/core/image/imorph/tr_image.cc (revision 3948) +++ tests/core/image/imorph/tr_image.cc (working copy) @@ -28,11 +28,12 @@ /// \file tests/core/image/imorph/tr_image.cc /// -/// Tests on mln::tr_image. -/// FIXME: write a real test! - +/// \brief Tests on mln::tr_image. +/// +/// \todo Write an effective test! #include <iostream> + #include <mln/fun/x2x/rotation.hh> #include <mln/core/image/image3d.hh> #include <mln/value/int_u8.hh> @@ -40,6 +41,7 @@ #include <mln/debug/iota.hh> #include <mln/debug/println.hh> + int main() { using namespace mln; Index: tests/core/image/imorph/labeled_image.cc --- tests/core/image/imorph/labeled_image.cc (revision 3948) +++ tests/core/image/imorph/labeled_image.cc (working copy) @@ -28,24 +28,20 @@ /// \file tests/core/image/imorph/labeled_image.cc /// -/// Tests on mln::labeled_image. - +/// \brief Tests on mln::labeled_image. #include <mln/core/image/image2d.hh> #include <mln/core/image/imorph/labeled_image.hh> #include <mln/core/routine/duplicate.hh> - #include <mln/make/image.hh> - #include <mln/make/box2d.hh> - #include <mln/value/label_8.hh> - #include <mln/accu/pair.hh> #include <mln/accu/center.hh> #include <mln/accu/bbox.hh> + static const unsigned bboxes_1[][4] = { { 1,1, 1,1 }, { 2,0, 2,1 }, { 0,0, 0,1 }, @@ -59,7 +55,6 @@ - namespace mln { @@ -106,5 +101,4 @@ lbl_i.relabel(f); test_image(lbl_i, bboxes_2); - } Index: tests/core/routine/exact.cc --- tests/core/routine/exact.cc (revision 3948) +++ tests/core/routine/exact.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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 @@ -25,25 +26,178 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/*! \file tests/core/routine/exact.cc - * - * \brief Tests on mln::exact. - */ +/// \file tests/core/routine/exact.cc +/// +/// \brief Tests on mln::exact. #include <typeinfo> #include <mln/core/routine/exact.hh> + struct test : mln::Object< test > { }; +namespace mln +{ + + template <typename E> + struct Base : Object<E> + { + void m() + { + int** i = exact(this)->m_impl(); + } + void m() const + { + int* i = exact(this)->m_impl(); + } + }; + + struct concrete : Base< concrete > + { + int** m_impl() { return 0; } + int* m_impl() const { return 0; } + }; + +} + + int main() { using namespace mln; - test t; - Object<test>& t_ = t; - mln_assertion(typeid(exact(t_)).name() == typeid(exact(t)).name()); + { + + concrete c; + Base<concrete>& b = c; + b.m(); + const Base<concrete>& bb = c; + bb.m(); + + } + + +// ----------------------------------- + +// test t; +// Object<test>& t_ = t; +// mln_assertion(typeid(exact(t_)).name() == typeid(exact(t)).name()); + +// { +// int i; +// exact(i); // `int' from `float' +// exact(&i); // `int *' from `const double' +// } +// { +// const int j = 0; +// exact(j); // `int' from `const double' +// exact(&j); // `const int *' from `const double +// } + +// { +// int i; +// int& j = i; +// exact(j); // `int' from `float' +// exact(&j); // `int *' from `const double' +// } +// { +// int i; +// const int& j = i; +// exact(j); // `int' from `const double' +// exact(&j); // `const int *' from `const double' +// } + +// { +// int* i; +// exact(i); // `int *' from `float' +// exact(*i); // `int' from `float' +// int *const j = 0; +// exact(j); // `int *' from `const double' +// exact(*j); `int' from `float' +// } + +// { +// const int* i; +// exact(i); // `const int *' from `float' +// exact(*i); // `int' from `const double' +// const int *const j = 0; +// exact(j); // `const int *' from `const double' +// exact(*j); `int' from `const double' +// } + + +// ----------------------------------- + + +// { +// int i; +// exact(&i); // `int *' from `const double' +// } +// { +// const int j = 0; +// exact(j); // `int' from `const double' +// exact(&j); // `const int *' from `const double +// } + +// { +// int i; +// int& j = i; +// exact(&j); // `int *' from `const double' +// } +// { +// int i; +// const int& j = i; +// exact(j); // `int' from `const double' +// exact(&j); // `const int *' from `const double' +// } + +// { +// int *const j = 0; +// exact(j); // `int *' from `const double' +// } + +// { +// const int* i; +// exact(*i); // `int' from `const double' +// const int *const j = 0; +// exact(j); // `const int *' from `const double' +// exact(*j); // `int' from `const double' +// } + + +// ----------------------------------- + + +// { +// int* i; +// exact(i); +// } + +// { +// int i; +// exact(i); // `int' from `float' +// } + +// { +// int i; +// int& j = i; +// exact(j); // `int' from `float' +// } + +// { +// int* i; +// exact(i); // `int *' from `float' +// exact(*i); // `int' from `float' +// int *const j = 0; +// exact(*j); // `int' from `float' +// } + +// { +// const int* i; +// exact(i); // `const int *' from `float' +// } + } Index: tests/accu/site_set/rectangularity.cc --- tests/accu/site_set/rectangularity.cc (revision 3948) +++ tests/accu/site_set/rectangularity.cc (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory +// 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 @@ -36,6 +36,7 @@ #include <mln/accu/site_set/rectangularity.hh> #include <mln/set/compute.hh> + int main() { using namespace mln; @@ -59,7 +60,7 @@ { box2d b(2,2); - float r = set::compute(accu::site_set::rectangularity<point2d>(), b); + float r = mln::set::compute(accu::site_set::rectangularity<point2d>(), b); mln_assertion(r == 1.0f); } Index: tests/accu/compute.cc --- tests/accu/compute.cc (revision 3948) +++ tests/accu/compute.cc (working copy) @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 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,7 +28,7 @@ /// \file tests/accu/compute.cc /// -/// Tests on mln::accu::compute. +/// \brief Tests on mln::accu::compute. #include <mln/core/image/image2d.hh> #include <mln/value/int_u8.hh> @@ -40,7 +40,7 @@ int main() { using namespace mln; - using typename value::int_u8; + using value::int_u8; unsigned n = 3; image2d<int_u8> ima(n, n); Index: tests/canvas/browsing/fwd.cc --- tests/canvas/browsing/fwd.cc (revision 3948) +++ tests/canvas/browsing/fwd.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 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 @@ -27,7 +28,7 @@ /// \file tests/canvas/browsing/fwd.cc /// -/// Tests on mln::canvas::browsing::fwd.hh +/// \brief Tests on mln::canvas::browsing::fwd.hh #include <mln/core/image/image2d.hh> #include <mln/canvas/browsing/fwd.hh> @@ -39,8 +40,8 @@ struct assign_browsing_functor { typedef I_ I; - enum { dim = I::site::dim }; - + typedef mln_site(I) S; + enum { dim = S::dim }; I input; F f; Index: tests/canvas/browsing/snake_fwd.cc --- tests/canvas/browsing/snake_fwd.cc (revision 3948) +++ tests/canvas/browsing/snake_fwd.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 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 @@ -27,7 +28,7 @@ /// \file tests/canvas/browsing/snake_fwd.cc /// -/// Tests on mln::canvas::browsing::snake_fwd. +/// \brief Tests on mln::canvas::browsing::snake_fwd. #include <mln/core/image/image2d.hh> #include <mln/canvas/browsing/snake_fwd.hh> @@ -38,8 +39,8 @@ template <typename I, typename F> struct assign_browsing_functor { - enum { dim = I::site::dim }; - + typedef mln_site(I) S; + enum { dim = S::dim }; I input; F f; Index: tests/canvas/browsing/snake_vert.cc --- tests/canvas/browsing/snake_vert.cc (revision 3948) +++ tests/canvas/browsing/snake_vert.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 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 @@ -27,21 +28,23 @@ /// \file tests/canvas/browsing/snake_vert.cc /// -/// Tests on mln::canvas::browsing::snake_vert. +/// \brief Tests on mln::canvas::browsing::snake_vert. #include <mln/core/image/image2d.hh> #include <mln/canvas/browsing/snake_vert.hh> #include <mln/fun/p2v/iota.hh> #include <mln/debug/println.hh> + unsigned res[2][7] = { { 1, 4, 5, 8, 9, 12, 13 }, { 2, 3, 6, 7, 10, 11, 14 } }; + template <typename I, typename F> struct assign_browsing_functor { - enum { dim = I::site::dim }; - + typedef mln_site(I) S; + enum { dim = S::dim }; I input; F f; Index: tests/canvas/browsing/snake_generic_2d_vert.cc --- tests/canvas/browsing/snake_generic_2d_vert.cc (revision 3948) +++ tests/canvas/browsing/snake_generic_2d_vert.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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 @@ -25,20 +26,21 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/*! \file tests/canvas/browsing/snake_generic_2d_vert.cc - * - * \brief Tests on mln::canvas::browsing::snake_generic. - */ +/// \file tests/canvas/browsing/snake_generic_2d_vert.cc +/// +/// \brief Tests on mln::canvas::browsing::snake_generic. #include <mln/core/image/image2d.hh> #include <mln/canvas/browsing/snake_generic.hh> #include <mln/fun/p2v/iota.hh> #include <mln/debug/println.hh> + template <typename I, typename F> struct assign_browsing_functor { - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; typedef assign_browsing_functor<I, F> self; typedef mln_deduce(I, psite, delta) dpsite; Index: tests/canvas/browsing/snake_generic_2d_hori.cc --- tests/canvas/browsing/snake_generic_2d_hori.cc (revision 3948) +++ tests/canvas/browsing/snake_generic_2d_hori.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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 @@ -25,20 +26,21 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/*! \file tests/canvas/browsing/snake_generic_3d_hori.cc - * - * \brief Tests on mln::canvas::browsing::snake_generic. - */ +/// \file tests/canvas/browsing/snake_generic_3d_hori.cc +/// +/// \brief Tests on mln::canvas::browsing::snake_generic. #include <mln/core/image/image2d.hh> #include <mln/canvas/browsing/snake_generic.hh> #include <mln/fun/p2v/iota.hh> #include <mln/debug/println.hh> + template <typename I, typename F> struct assign_browsing_functor { - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; typedef assign_browsing_functor<I, F> self; typedef mln_deduce(I, psite, delta) dpsite; Index: tests/canvas/browsing/snake_generic_3d_vert.cc --- tests/canvas/browsing/snake_generic_3d_vert.cc (revision 3948) +++ tests/canvas/browsing/snake_generic_3d_vert.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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 @@ -25,20 +26,21 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/*! \file tests/canvas/browsing/snake_generic_3d_vert.cc - * - * \brief Tests on mln::canvas::browsing::snake_generic. - */ +/// \file tests/canvas/browsing/snake_generic_3d_vert.cc +/// +/// \brief Tests on mln::canvas::browsing::snake_generic. #include <mln/core/image/image3d.hh> #include <mln/canvas/browsing/snake_generic.hh> #include <mln/fun/p2v/iota.hh> #include <mln/debug/println.hh> + template <typename I, typename F> struct assign_browsing_functor { - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; typedef assign_browsing_functor<I, F> self; typedef mln_deduce(I, psite, delta) dpsite; Index: tests/canvas/browsing/snake_generic_3d_hori.cc --- tests/canvas/browsing/snake_generic_3d_hori.cc (revision 3948) +++ tests/canvas/browsing/snake_generic_3d_hori.cc (working copy) @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 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 @@ -25,20 +26,21 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/*! \file tests/canvas/browsing/snake_generic_3d_hori.cc - * - * \brief Tests on mln::canvas::browsing::snake_generic. - */ +/// \file tests/canvas/browsing/snake_generic_3d_hori.cc +/// +/// \brief Tests on mln::canvas::browsing::snake_generic. #include <mln/core/image/image3d.hh> #include <mln/canvas/browsing/snake_generic.hh> #include <mln/fun/p2v/iota.hh> #include <mln/debug/println.hh> + template <typename I, typename F> struct assign_browsing_functor { - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; typedef assign_browsing_functor<I, F> self; typedef mln_deduce(I, psite, delta) dpsite; Index: tests/canvas/browsing/hyper_directional.cc --- tests/canvas/browsing/hyper_directional.cc (revision 3948) +++ tests/canvas/browsing/hyper_directional.cc (working copy) @@ -41,7 +41,8 @@ struct assign_browsing_functor { typedef I_ I; - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; I input; Index: tests/canvas/browsing/diagonal2d.cc --- tests/canvas/browsing/diagonal2d.cc (revision 3948) +++ tests/canvas/browsing/diagonal2d.cc (working copy) @@ -40,7 +40,8 @@ struct assign_browsing_functor { typedef I_ I; - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; typedef assign_browsing_functor<I, F> self; typedef mln_deduce(I, psite, delta) dpsite; Index: tests/canvas/browsing/backdiagonal2d.cc --- tests/canvas/browsing/backdiagonal2d.cc (revision 3948) +++ tests/canvas/browsing/backdiagonal2d.cc (working copy) @@ -35,11 +35,13 @@ #include <mln/fun/p2v/iota.hh> #include <mln/debug/println.hh> + template <typename I_, typename F> struct assign_browsing_functor { typedef I_ I; - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; typedef assign_browsing_functor<I, F> self; typedef mln_deduce(I, psite, delta) dpsite;
participants (1)
-
Thierry Geraud