
https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Have extra tests pass g++-2.95. * mln/topo/face_iter.hh, * mln/topo/adj_higher_face_iter.hh, * mln/topo/face_data.hh, * mln/topo/n_face_iter.hh, * mln/topo/adj_lower_dim_connected_n_face_iter.hh, * mln/topo/center_only_iter.hh, * mln/topo/static_n_face_iter.hh, * mln/topo/attic/faces_iter.hh, * mln/topo/complex.hh, * mln/topo/adj_lower_face_iter.hh, * mln/topo/adj_m_face_iter.hh, * mln/topo/n_face.hh, * mln/topo/adj_higher_dim_connected_n_face_iter.hh, * mln/topo/internal/complex_relative_iterator_sequence.hh, * mln/topo/internal/complex_iterator_base.hh, * mln/core/site_set/p_faces.hh, * mln/core/site_set/p_complex.hh, * mln/io/off/save.hh, * tests/topo/complex.cc, * tests/morpho/complex_image_wst.cc, * apps/statues/save_bin_alt.hh (face): Explicit use as topo::face to fix the ambiguity. (nfaces): Rename the templated overload as... (nfaces_with_dim): ...this. (complex_data): Move definition after the specializations of faces_set_mixin. Update. Aestetic change. Upgrade doc style. * mln/topo/internal/complex_relative_iterator_sequence.hh (const_face_type_): New. (operator): Use it. * mln/topo/internal/complex_iterator_base.hh (operator): Simplify signature. Dispatch! * mln/topo/complex.hh (todo): New; for Roland. * mln/io/pgm/load.hh (todo): New; for Fabien. Misc. * mln/world/inter_pixel/neighb2d.hh: Fix missing const. * mln/core/site_set/p_vertices_psite.hh, * mln/core/site_set/p_edges_psite.hh, * mln/core/site_set/complex_psite.hh (target_t): New; was missing. * mln/core/image/edge_image.hh, * mln/core/image/vertex_image.hh (using): Remove. (operator()): Explicit write them, instead of inherit them. * mln/core/image/graph_window_if_piter.hh (s_): Fix accessibility. (is_masked_impl_selector): Fix typedef deduction. * mln/core/internal/is_masked_impl_selector.hh: Update. * mln/core/internal/graph_psite_base.hh (operator): Do not use id_t. * mln/make/image.hh (todo): New. * mln/metal/converts_to.hh: Have it work with g++-2.95. * mln/linear/gaussian/impl.hh, * mln/accu/transform_directional.hh, * mln/accu/transform_diagonal.hh: Ease constant deduction. * mln/fun/x2x/composed.hh: Fix Boolean expr as parameter. * mln/fun/x2x/translation.hh, * mln/fun/x2x/rotation.hh (using): Remove; useless. * mln/morpho/attribute/card.hh: Likewise. * mln/fun/stat/mahalanobis.hh (V::dim): Replace by n. * mln/canvas/browsing/internal/graph_first_search.hh (graph_first_search_t): Revamp weird params resolution. (queue): Rename as... (q): ...this. apps/statues/save_bin_alt.hh | 8 - mln/accu/transform_diagonal.hh | 9 + mln/accu/transform_directional.hh | 3 mln/canvas/browsing/internal/graph_first_search.hh | 23 ++-- mln/core/image/edge_image.hh | 32 ++++- mln/core/image/graph_window_if_piter.hh | 9 - mln/core/image/vertex_image.hh | 32 ++++- mln/core/internal/graph_psite_base.hh | 6 - mln/core/internal/is_masked_impl_selector.hh | 15 +- mln/core/site_set/complex_psite.hh | 6 - mln/core/site_set/p_complex.hh | 2 mln/core/site_set/p_edges_psite.hh | 4 mln/core/site_set/p_faces.hh | 2 mln/core/site_set/p_vertices_psite.hh | 4 mln/fun/stat/mahalanobis.hh | 11 +- mln/fun/x2x/composed.hh | 10 - mln/fun/x2x/rotation.hh | 13 +- mln/fun/x2x/translation.hh | 14 +- mln/io/off/save.hh | 10 - mln/io/pgm/load.hh | 17 +-- mln/linear/gaussian/impl.hh | 25 +++- mln/make/image.hh | 9 + mln/metal/converts_to.hh | 17 ++- mln/morpho/attribute/card.hh | 5 mln/topo/adj_higher_dim_connected_n_face_iter.hh | 21 ++- mln/topo/adj_higher_face_iter.hh | 23 ++-- mln/topo/adj_lower_dim_connected_n_face_iter.hh | 21 ++- mln/topo/adj_lower_face_iter.hh | 24 ++-- mln/topo/adj_m_face_iter.hh | 19 ++- mln/topo/attic/faces_iter.hh | 4 mln/topo/center_only_iter.hh | 8 - mln/topo/complex.hh | 88 ++++++++-------- mln/topo/face_data.hh | 4 mln/topo/face_iter.hh | 25 ++-- mln/topo/internal/complex_iterator_base.hh | 5 mln/topo/internal/complex_relative_iterator_sequence.hh | 14 ++ mln/topo/n_face.hh | 2 mln/topo/n_face_iter.hh | 21 ++- mln/topo/static_n_face_iter.hh | 20 ++- mln/world/inter_pixel/neighb2d.hh | 12 +- tests/morpho/complex_image_wst.cc | 12 +- tests/topo/complex.cc | 10 + 42 files changed, 373 insertions(+), 246 deletions(-) Index: mln/topo/face_iter.hh --- mln/topo/face_iter.hh (revision 3981) +++ mln/topo/face_iter.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_ITER_HH /// \file mln/topo/face_iter.hh -/// Definition of forward and backward iterators on all the +/// +/// \brief Definition of forward and backward iterators on all the /// faces of a complex. # include <mln/topo/internal/complex_set_iterator_base.hh> @@ -61,16 +63,19 @@ | topo::face_fwd_iter<D>. | `-------------------------*/ - /// Forward iterator on all the faces of an mln::complex<D>. + /// \brief Forward iterator on all the faces of an + /// mln::complex<D>. /// /// \arg \p D The dimension of the complex this iterator belongs to. + // template <unsigned D> class face_fwd_iter - : public internal::complex_set_iterator_base< face<D>, face_fwd_iter<D> > + : public internal::complex_set_iterator_base< topo::face<D>, face_fwd_iter<D> > { + // Tech note: we use topo::face to help g++-2.95. private: typedef face_fwd_iter<D> self_; - typedef internal::complex_set_iterator_base< face<D>, self_ > super_; + typedef internal::complex_set_iterator_base< topo::face<D>, self_ > super_; public: using super_::is_valid; @@ -102,16 +107,18 @@ | topo::face_bkd_iter<D>. | `-------------------------*/ - /// Backward iterator on all the faces of an mln::complex<D>. + /// \brief Backward iterator on all the faces of an mln::complex<D>. /// /// \arg \p D The dimension of the complex this iterator belongs to. + // template <unsigned D> class face_bkd_iter - : public internal::complex_set_iterator_base< face<D>, face_bkd_iter<D> > + : public internal::complex_set_iterator_base< topo::face<D>, face_bkd_iter<D> > { + // Tech note: we use topo::face to help g++-2.95. private: typedef face_bkd_iter<D> self_; - typedef internal::complex_set_iterator_base< face<D>, self_ > super_; + typedef internal::complex_set_iterator_base< topo::face<D>, self_ > super_; public: using super_::is_valid; @@ -220,7 +227,7 @@ face_bkd_iter<D>::start() { f_.set_n(D); - f_.set_face_id(f_.cplx().template nfaces<D>() - 1); + f_.set_face_id(f_.cplx().template nfaces_with_dim<D>() - 1); } template <unsigned D> Index: mln/topo/adj_higher_face_iter.hh --- mln/topo/adj_higher_face_iter.hh (revision 3981) +++ mln/topo/adj_higher_face_iter.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 @@ -30,7 +31,7 @@ /// \file mln/topo/adj_higher_face_iter.hh /// -/// Definition of forward and backward iterators on the +/// \brief Definition of forward and backward iterators on the /// adjacent (n+1)-faces of a (reference) n-face in a complex. # include <mln/topo/internal/complex_relative_iterator_base.hh> @@ -64,20 +65,22 @@ | topo::adj_higher_face_fwd_iter<D>. | `------------------------------------*/ - /// Forward iterator on all the adjacent (n+1)-faces of the + /// \brief Forward iterator on all the adjacent (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_higher_face_fwd_iter - : public internal::forward_complex_relative_iterator_base< face<D>, + : public internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_higher_face_fwd_iter<D> > { typedef adj_higher_face_fwd_iter<D> self_; - typedef internal::forward_complex_relative_iterator_base< face<D>, + typedef internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; + // Tech note: we use topo::face to help g++-2.95. public: /// Construction. @@ -96,20 +99,22 @@ | topo::adj_higher_face_bkd_iter<D>. | `------------------------------------*/ - /// Backward iterator on all the adjacent (n+1)-faces of the - /// n-face of an mln::complex<D>. + /// \brief Backward iterator on all the adjacent (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_higher_face_bkd_iter - : public internal::backward_complex_relative_iterator_base< face<D>, + : public internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_higher_face_bkd_iter<D> > { typedef adj_higher_face_bkd_iter<D> self_; - typedef internal::backward_complex_relative_iterator_base< face<D>, + typedef internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; + // Tech note: we use topo::face to help g++-2.95. public: /// Construction. Index: mln/topo/face_data.hh --- mln/topo/face_data.hh (revision 3981) +++ mln/topo/face_data.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,6 +30,7 @@ # define MLN_TOPO_FACE_DATA_HH /// \file mln/topo/face_data.hh +/// /// \brief Data associated to the faces of a complex. /// /// These data are actually lists of adjacent faces (of lower and Index: mln/topo/n_face_iter.hh --- mln/topo/n_face_iter.hh (revision 3981) +++ mln/topo/n_face_iter.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 @@ -30,8 +31,8 @@ /// \file mln/topo/n_face_iter.hh /// -/// Definition of forward and backward iterators on all the -/// \a n-faces of a complex, \a n being a dynamic value. +/// \brief Definition of forward and backward iterators on all the \a +/// n-faces of a complex, \a n being a dynamic value. # include <mln/topo/internal/complex_set_iterator_base.hh> # include <mln/topo/face.hh> @@ -65,17 +66,20 @@ | topo::n_face_fwd_iter<D>. | `---------------------------*/ - /// Forward iterator on all the faces of an mln::complex<D>. + /// \brief Forward iterator on all the faces of an + /// mln::complex<D>. /// /// \arg \p D The dimension of the complex this iterator belongs to. + // template <unsigned D> class n_face_fwd_iter - : public internal::complex_set_iterator_base< face<D>, + : public internal::complex_set_iterator_base< topo::face<D>, n_face_fwd_iter<D> > { + // Tech note: we use topo::face to help g++-2.95. private: typedef n_face_fwd_iter<D> self_; - typedef internal::complex_set_iterator_base< face<D>, self_ > super_; + typedef internal::complex_set_iterator_base< topo::face<D>, self_ > super_; public: using super_::is_valid; @@ -124,12 +128,13 @@ /// \arg \p D The dimension of the complex this iterator belongs to. template <unsigned D> class n_face_bkd_iter - : public internal::complex_set_iterator_base< face<D>, + : public internal::complex_set_iterator_base< topo::face<D>, n_face_bkd_iter<D> > { + // Tech note: we use topo::face to help g++-2.95. private: typedef n_face_bkd_iter<D> self_; - typedef internal::complex_set_iterator_base< face<D>, self_ > super_; + typedef internal::complex_set_iterator_base< topo::face<D>, self_ > super_; public: using super_::is_valid; Index: mln/topo/adj_lower_dim_connected_n_face_iter.hh --- mln/topo/adj_lower_dim_connected_n_face_iter.hh (revision 3981) +++ mln/topo/adj_lower_dim_connected_n_face_iter.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,7 @@ # define MLN_TOPO_ADJ_LOWER_DIM_CONNECTED_N_FACE_ITER_HH /// \file mln/topo/adj_lower_dim_connected_n_face_iter.hh - +/// /// \brief Definition of forward and backward iterators on all the /// n-faces sharing an adjacent (n-1)-face with a (reference) n-face /// in a complex. @@ -62,16 +63,18 @@ /// (n-1)-face with a (reference) 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_dim_connected_n_face_fwd_iter - : public internal::forward_complex_relative_iterator_base< face<D>, + : public internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_lower_dim_connected_n_face_fwd_iter<D> >, private internal::adj_lower_dim_connected_n_face_iterator<D> { + // Tech note: we use topo::face to help g++-2.95. private: typedef adj_lower_dim_connected_n_face_fwd_iter<D> self_; - typedef internal::forward_complex_relative_iterator_base< face<D>, + typedef internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; @@ -99,16 +102,18 @@ /// (n-1)-face with a (reference) 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_dim_connected_n_face_bkd_iter - : public internal::backward_complex_relative_iterator_base< face<D>, + : public internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_lower_dim_connected_n_face_bkd_iter<D> >, private internal::adj_lower_dim_connected_n_face_iterator<D> { + // Tech note: we use topo::face to help g++-2.95. private: typedef adj_lower_dim_connected_n_face_bkd_iter<D> self_; - typedef internal::backward_complex_relative_iterator_base< face<D>, + typedef internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; @@ -141,7 +146,7 @@ protected: /// The actual implementation of the computation of the set of /// faces adjacent to the reference face. - void update_adj_faces__(const face<D>& center, + void update_adj_faces__(const topo::face<D>& center, std::vector< algebraic_face<D> >& adj_faces); }; @@ -228,7 +233,7 @@ template <unsigned D> inline void - adj_lower_dim_connected_n_face_iterator<D>::update_adj_faces__(const face<D>& center, + adj_lower_dim_connected_n_face_iterator<D>::update_adj_faces__(const topo::face<D>& center, std::vector< algebraic_face<D> >& adj_faces) { // Reset the result container. Index: mln/topo/center_only_iter.hh --- mln/topo/center_only_iter.hh (revision 3981) +++ mln/topo/center_only_iter.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 @@ -73,13 +74,14 @@ \see mln::complex_lower_higher_window */ template <unsigned D> class center_only_iter - : public internal::forward_complex_relative_iterator_base< face<D>, + : public internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, center_only_iter<D> > { + // Tech note: we use topo::face to help g++-2.95. private: typedef center_only_iter<D> self_; - typedef internal::forward_complex_relative_iterator_base< face<D>, + typedef internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; Index: mln/topo/static_n_face_iter.hh --- mln/topo/static_n_face_iter.hh (revision 3981) +++ mln/topo/static_n_face_iter.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,6 +30,7 @@ # define MLN_TOPO_STATIC_N_FACE_ITER_HH /// \file mln/topo/static_n_face_iter.hh +/// /// \brief Definition of forward and backward iterators on all the /// \p N-faces of a complex, \p N being a static value. @@ -51,14 +53,16 @@ /// /// \arg \p N The dimension of the face associated to this iterator. /// \arg \p D The dimension of the complex this iterator belongs to. + // template <unsigned N, unsigned D> class static_n_face_fwd_iter - : public internal::complex_set_iterator_base< face<D>, + : public internal::complex_set_iterator_base< topo::face<D>, static_n_face_fwd_iter<N, D> > { + // Tech note: we use topo::face to help g++-2.95. private: typedef static_n_face_fwd_iter<N, D> self_; - typedef internal::complex_set_iterator_base< face<D>, self_ > super_; + typedef internal::complex_set_iterator_base< topo::face<D>, self_ > super_; public: using super_::is_valid; @@ -95,14 +99,16 @@ /// /// \arg \p N The dimension of the face associated to this iterator. /// \arg \p D The dimension of the complex this iterator belongs to. + // template <unsigned N, unsigned D> class static_n_face_bkd_iter - : public internal::complex_set_iterator_base< face<D>, + : public internal::complex_set_iterator_base< topo::face<D>, static_n_face_bkd_iter<N, D> > { + // Tech note: we use topo::face to help g++-2.95. private: typedef static_n_face_bkd_iter<N, D> self_; - typedef internal::complex_set_iterator_base< face<D>, self_ > super_; + typedef internal::complex_set_iterator_base< topo::face<D>, self_ > super_; public: using super_::is_valid; @@ -174,7 +180,7 @@ { if (is_valid()) { - if (f_.face_id() + 1 < f_.cplx().template nfaces<N>()) + if (f_.face_id() + 1 < f_.cplx().template nfaces_with_dim<N>()) f_.inc_face_id(); else invalidate(); @@ -213,7 +219,7 @@ void static_n_face_bkd_iter<N, D>::start() { - f_.set_face_id(f_.cplx().template nfaces<N>() - 1); + f_.set_face_id(f_.cplx().template nfaces_with_dim<N>() - 1); } template <unsigned N, unsigned D> Index: mln/topo/attic/faces_iter.hh --- mln/topo/attic/faces_iter.hh (revision 3981) +++ mln/topo/attic/faces_iter.hh (working copy) @@ -178,7 +178,7 @@ if (is_valid()) { unsigned face_id = face_.face_id(); - if (face_id + 1 < face_.cplx().template nfaces<N>()) + if (face_id + 1 < face_.cplx().template nfaces_with_dim<N>()) /* FIXME: Provide accessor n_face::n() returning a mutable reference? This way, we could just write @@ -221,7 +221,7 @@ void faces_bkd_iter_<N, D>::start() { - face_.set_face_id(face_.cplx().template nfaces<N>() - 1); + face_.set_face_id(face_.cplx().template nfaces_with_dim<N>() - 1); } template <unsigned N, unsigned D> Index: mln/topo/complex.hh --- mln/topo/complex.hh (revision 3981) +++ mln/topo/complex.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,10 +30,17 @@ # define MLN_TOPO_COMPLEX_HH /// \file mln/topo/complex.hh -/// Structures for general complexes. +/// +/// \brief Structures for general complexes. /// /// A complex defines a topological space which can be used as a /// support for an image (i.e., as site sets). +/// +/// \todo Roland: Check that the top of the inheritance diagram +/// is correct; you wrote: +/// faces_set_mixin<0, D> ---> lower_dim_faces_set_mixin<D, D> +/// I (theo) think it's: +/// faces_set_mixin<0, D> ---> lower_dim_faces_set_mixin<0, D> # include <cstddef> @@ -81,7 +89,8 @@ | Complex. | `----------*/ - /// General complex of dimension \p D. + /// \brief General complex of dimension \p D. + // template <unsigned D> class complex { @@ -127,7 +136,7 @@ /// Return the number of \p N-faces. template <unsigned N> - unsigned nfaces() const; + unsigned nfaces_with_dim() const; /// \} /// Dynamic manipulators. @@ -283,22 +292,6 @@ Classes mln::topo::internal::lower_dim_faces_set_mixin<N, D> are implementation classes factoring services related to complex data. */ - /// \{ - namespace internal - { - // Forward declarations. - template <unsigned N, unsigned D> - struct faces_set_mixin; - - /// Complex data. - template <unsigned D> - struct complex_data : faces_set_mixin<D, D> - { - // Data is contained in super classes. - }; - - } // end of namespace mln::topo::internal - /// \} /*---------------------. @@ -320,19 +313,24 @@ /// Recursive mixins of set of faces. /// \{ + template <unsigned N, unsigned D> struct faces_set_mixin; - /// Faces of highest dimension (\p D). - template <unsigned D> - struct faces_set_mixin<D, D> : public faces_set_mixin<D - 1, D>, - public lower_dim_faces_set_mixin<D, D> + + /// Faces of intermediate dimension (greater than 0, lower than \p D). + template <unsigned N, unsigned D> + struct faces_set_mixin : public faces_set_mixin<N - 1, D>, + public lower_dim_faces_set_mixin<N, D>, + public higher_dim_faces_set_mixin<N, D> { - std::vector< face_data<D, D> > faces_; + std::vector< face_data<N, D> > faces_; /// Pretty-printing. /// \{ - /// Print the faces of dimension \p D. + /// Print the faces of dimension \p N. void print(std::ostream& ostr) const; + /// Recursively print the faces of dimensions 0 to \p N + /// (in ascending dimension). void print_rec_asc(std::ostream& ostr) const; /// \} @@ -342,7 +340,7 @@ /// \see mln::complex<D>::fold_left_. template <typename BinaryFunction, typename T> T fold_left_(const BinaryFunction& f, const T& accu) const; - /// Apply a functor \a f to the list of faces if \a n == \p D. + /// Apply a functor \a f to the list of faces if \a n == \p N. /// \see mln::complex<D>::apply_if_dim_matches_. template <typename UnaryFunction> typename UnaryFunction::result_type @@ -350,20 +348,17 @@ /// \} }; - /// Faces of intermediate dimension (greater than 0, lower than \p D). - template <unsigned N, unsigned D> - struct faces_set_mixin : public faces_set_mixin<N - 1, D>, - public lower_dim_faces_set_mixin<N, D>, - public higher_dim_faces_set_mixin<N, D> + /// Faces of highest dimension (\p D). + template <unsigned D> + struct faces_set_mixin<D, D> : public faces_set_mixin<D - 1, D>, + public lower_dim_faces_set_mixin<D, D> { - std::vector< face_data<N, D> > faces_; + std::vector< face_data<D, D> > faces_; /// Pretty-printing. /// \{ - /// Print the faces of dimension \p N. + /// Print the faces of dimension \p D. void print(std::ostream& ostr) const; - /// Recursively print the faces of dimensions 0 to \p N - /// (in ascending dimension). void print_rec_asc(std::ostream& ostr) const; /// \} @@ -373,7 +368,7 @@ /// \see mln::complex<D>::fold_left_. template <typename BinaryFunction, typename T> T fold_left_(const BinaryFunction& f, const T& accu) const; - /// Apply a functor \a f to the list of faces if \a n == \p N. + /// Apply a functor \a f to the list of faces if \a n == \p D. /// \see mln::complex<D>::apply_if_dim_matches_. template <typename UnaryFunction> typename UnaryFunction::result_type @@ -437,6 +432,18 @@ /// \} + // Tech note: g++-2.95 highly prefers to have the complex_data + // class to be defined after the specializations of + // 'faces_set_mixin'. + + /// Complex data. + template <unsigned D> + struct complex_data : public faces_set_mixin<D, D> + { + // Data is contained in super classes. + }; + + // ------------------------------------------------- // // mln::topo::internal::lower_dim_faces_set_mixin. // // mln::topo::internal::higher_dim_faces_set_mixin. // @@ -483,8 +490,7 @@ /* FIXME: This is not thread-proof (these two lines should form an atomic section). */ data_->internal::faces_set_mixin<0u, D>::faces_.push_back(face_data<0u, D>()); - unsigned id = nfaces<0u>() - 1; - + unsigned id = nfaces_with_dim<0u>() - 1; return n_face<0u, D>(*this, id); } @@ -510,7 +516,7 @@ /* FIXME: This is not thread-proof (these two lines should form an atomic section). */ data_->internal::faces_set_mixin<N + 1, D>::faces_.push_back(f); - unsigned id = nfaces<N + 1>() - 1; + unsigned id = nfaces_with_dim<N + 1>() - 1; n_face<N + 1, D> fh(*this, id); // Connect F and its ADJACENT_FACES. @@ -587,7 +593,7 @@ template <unsigned N> inline unsigned - complex<D>::nfaces() const + complex<D>::nfaces_with_dim() const { return data_->internal::faces_set_mixin<N, D>::faces_.size(); } Index: mln/topo/adj_lower_face_iter.hh --- mln/topo/adj_lower_face_iter.hh (revision 3981) +++ mln/topo/adj_lower_face_iter.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 @@ -30,7 +31,7 @@ /// \file mln/topo/adj_lower_face_iter.hh /// -/// Definition of forward and backward iterators on the +/// \brief Definition of forward and backward iterators on the /// adjacent (n-1)-faces of a (reference) n-face in a complex. # include <mln/topo/internal/complex_relative_iterator_base.hh> @@ -65,19 +66,21 @@ | topo::adj_lower_face_fwd_iter<D>. | `-----------------------------------*/ - /// Forward iterator on all the adjacent (n-1)-faces of the + /// \brief Forward iterator on all the adjacent (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_face_fwd_iter - : public internal::forward_complex_relative_iterator_base< face<D>, + : public internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_lower_face_fwd_iter<D> > { + // Tech note: we use topo::face to help g++-2.95. private: typedef adj_lower_face_fwd_iter<D> self_; - typedef internal::forward_complex_relative_iterator_base< face<D>, + typedef internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; @@ -98,22 +101,23 @@ | topo::adj_lower_face_bkd_iter<D>. | `-----------------------------------*/ - /// Backward iterator on all the adjacent (n-1)-faces of the - /// n-face of an mln::complex<D>. + /// \brief Backward iterator on all the adjacent (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_face_bkd_iter - : public internal::backward_complex_relative_iterator_base< face<D>, + : public internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_lower_face_bkd_iter<D> > { + // Tech note: we use topo::face to help g++-2.95. private: typedef adj_lower_face_bkd_iter<D> self_; - typedef internal::backward_complex_relative_iterator_base< face<D>, + typedef internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; - public: /// Construction. /// \{ Index: mln/topo/adj_m_face_iter.hh --- mln/topo/adj_m_face_iter.hh (revision 3981) +++ mln/topo/adj_m_face_iter.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,7 @@ # define MLN_TOPO_ADJ_M_FACE_ITER_HH /// \file mln/topo/adj_m_face_iter.hh - +/// /// Definition of forward and backward iterators on all the /// m-faces transitively adjacent to a (reference) n-face in a /// complex. @@ -70,14 +71,15 @@ the iterated set is empty. */ template <unsigned D> class adj_m_face_fwd_iter - : public internal::forward_complex_relative_iterator_base< face<D>, + : public internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_m_face_fwd_iter<D> >, public internal::adj_m_face_iterator<D> { + // Tech note: we use topo::face to help g++-2.95. private: typedef adj_m_face_fwd_iter<D> self_; - typedef internal::forward_complex_relative_iterator_base< face<D>, + typedef internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; typedef internal::adj_m_face_iterator<D> impl_; @@ -117,14 +119,15 @@ the iterated set is empty. */ template <unsigned D> class adj_m_face_bkd_iter - : public internal::backward_complex_relative_iterator_base< face<D>, + : public internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_m_face_bkd_iter<D> >, public internal::adj_m_face_iterator<D> { + // Tech note: we use topo::face to help g++-2.95. private: typedef adj_m_face_bkd_iter<D> self_; - typedef internal::backward_complex_relative_iterator_base< face<D>, + typedef internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; typedef internal::adj_m_face_iterator<D> impl_; @@ -172,7 +175,7 @@ protected: /// The actual implementation of the computation of the set of /// faces adjacent to the reference face. - void update_adj_faces__(const face<D>& center, + void update_adj_faces__(const topo::face<D>& center, std::vector< algebraic_face<D> >& adj_faces); /// The dimension of the iterated faces. @@ -282,7 +285,7 @@ template <unsigned D> inline void - adj_m_face_iterator<D>::update_adj_faces__(const face<D>& center, + adj_m_face_iterator<D>::update_adj_faces__(const topo::face<D>& center, std::vector< algebraic_face<D> >& adj_faces) { adj_faces.clear(); Index: mln/topo/n_face.hh --- mln/topo/n_face.hh (revision 3981) +++ mln/topo/n_face.hh (working copy) @@ -180,7 +180,7 @@ bool n_face<N, D>::is_valid() const { - return face_id_ < cplx_.template nfaces<N>(); + return face_id_ < cplx_.template nfaces_with_dim<N>(); } template <unsigned N, unsigned D> Index: mln/topo/adj_higher_dim_connected_n_face_iter.hh --- mln/topo/adj_higher_dim_connected_n_face_iter.hh (revision 3981) +++ mln/topo/adj_higher_dim_connected_n_face_iter.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,7 @@ # define MLN_TOPO_ADJ_HIGHER_DIM_CONNECTED_N_FACE_ITER_HH /// \file mln/topo/adj_higher_dim_connected_n_face_iter.hh - +/// /// \brief Definition of forward and backward iterators on all the /// n-faces sharing an adjacent (n+1)-face with a (reference) n-face /// in a complex. @@ -62,16 +63,18 @@ /// (n+1)-face with a (reference) n-face of an mln::complex<D>. /// /// \arg \p D The dimension of the complex this iterator belongs to. + // template <unsigned D> class adj_higher_dim_connected_n_face_fwd_iter - : public internal::forward_complex_relative_iterator_base< face<D>, + : public internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_higher_dim_connected_n_face_fwd_iter<D> >, private internal::adj_higher_dim_connected_n_face_iterator<D> { + // Tech note: we use topo::face to help g++-2.95. private: typedef adj_higher_dim_connected_n_face_fwd_iter<D> self_; - typedef internal::forward_complex_relative_iterator_base< face<D>, + typedef internal::forward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; @@ -99,16 +102,18 @@ /// (n+1)-face with a (reference) n-face of an mln::complex<D>. /// /// \arg \p D The dimension of the complex this iterator belongs to. + // template <unsigned D> class adj_higher_dim_connected_n_face_bkd_iter - : public internal::backward_complex_relative_iterator_base< face<D>, + : public internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, adj_higher_dim_connected_n_face_bkd_iter<D> >, private internal::adj_higher_dim_connected_n_face_iterator<D> { + // Tech note: we use topo::face to help g++-2.95. private: typedef adj_higher_dim_connected_n_face_bkd_iter<D> self_; - typedef internal::backward_complex_relative_iterator_base< face<D>, + typedef internal::backward_complex_relative_iterator_base< topo::face<D>, algebraic_face<D>, self_ > super_; @@ -141,7 +146,7 @@ protected: /// The actual implementation of the computation of the set of /// faces adjacent to the reference face. - void update_adj_faces__(const face<D>& center, + void update_adj_faces__(const topo::face<D>& center, std::vector< algebraic_face<D> >& adj_faces); }; @@ -228,7 +233,7 @@ template <unsigned D> inline void - adj_higher_dim_connected_n_face_iterator<D>::update_adj_faces__(const face<D>& center, + adj_higher_dim_connected_n_face_iterator<D>::update_adj_faces__(const topo::face<D>& center, std::vector< algebraic_face<D> >& adj_faces) { // Reset the result container. Index: mln/topo/internal/complex_relative_iterator_sequence.hh --- mln/topo/internal/complex_relative_iterator_sequence.hh (revision 3981) +++ mln/topo/internal/complex_relative_iterator_sequence.hh (working copy) @@ -49,6 +49,15 @@ namespace internal { + + template <typename I1> + struct const_face_type_ + { + typedef typename I1::face_type F_; + typedef const F_& ret; + }; + + /// A meta relative iterator on the faces of a complex /// using two complex relative iterators sequentially. /// @@ -95,7 +104,8 @@ /// Conversion. /// \{ /// Return a reference to the corresponding face handle. - operator const face_type&() const; + operator typename const_face_type_<I1>::ret () const; + // that is: const face_type& /// \} protected: @@ -212,7 +222,7 @@ template <typename I1, typename I2, typename E> inline - complex_relative_iterator_sequence<I1, I2, E>::operator const face_type&() const + complex_relative_iterator_sequence<I1, I2, E>::operator typename const_face_type_<I1>::ret () const { return f_; } Index: mln/topo/internal/complex_iterator_base.hh --- mln/topo/internal/complex_iterator_base.hh (revision 3981) +++ mln/topo/internal/complex_iterator_base.hh (working copy) @@ -72,6 +72,7 @@ namespace internal { + /// Factoring class for iterators on mln::complex. /// /// \arg \p F The type of the face handle. @@ -92,7 +93,7 @@ /// Explicit conversion (accessor). const face& subject() const; /// Implicit conversion (conversion operator). - operator const face&() const; + operator const F&() const; /// \} protected: @@ -121,7 +122,7 @@ template <typename F, typename E> inline - complex_iterator_base<F, E>::operator const face&() const + complex_iterator_base<F, E>::operator const F& () const { return f_; } Index: mln/world/inter_pixel/neighb2d.hh --- mln/world/inter_pixel/neighb2d.hh (revision 3981) +++ mln/world/inter_pixel/neighb2d.hh (working copy) @@ -30,13 +30,13 @@ /// \file mln/world/inter_pixel/neighb2d.hh /// -/// Common neighborhood on inter-pixel images. - +/// \brief Common neighborhood on inter-pixel images. # include <mln/core/alias/neighb2d.hh> # include <mln/make/double_neighb2d.hh> # include <mln/world/inter_pixel/dim2/is_row_odd.hh> + namespace mln { @@ -60,11 +60,11 @@ const dbl_neighb2d& e2c() { - static bool e2c_h[] = { 0, 1, 0, + static const bool e2c_h[] = { 0, 1, 0, 0, 0, 0, 0, 1, 0 }; - static bool e2c_v[] = { 0, 0, 0, + static const bool e2c_v[] = { 0, 0, 0, 1, 0, 1, 0, 0, 0 }; @@ -76,13 +76,13 @@ const dbl_neighb2d& e2e() { - static bool e2e_h[] = { 0, 0, 1, 0, 0, + static const bool e2e_h[] = { 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0 }; - static bool e2e_v[] = { 0, 0, 0, 0, 0, + static const bool e2e_v[] = { 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, Index: mln/core/site_set/p_complex.hh --- mln/core/site_set/p_complex.hh (revision 3981) +++ mln/core/site_set/p_complex.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/core/site_set/p_complex.hh /// -/// Definition of a point set based on a complex. +/// \brief Definition of a point set based on a complex. # include <mln/core/internal/site_set_base.hh> Index: mln/core/site_set/p_faces.hh --- mln/core/site_set/p_faces.hh (revision 3981) +++ mln/core/site_set/p_faces.hh (working copy) @@ -225,7 +225,7 @@ unsigned p_faces<N, D, P>::nfaces() const { - return cplx_.template nfaces<N>(); + return cplx_.template nfaces_with_dim<N>(); } template <unsigned N, unsigned D, typename P> Index: mln/core/site_set/p_vertices_psite.hh --- mln/core/site_set/p_vertices_psite.hh (revision 3981) +++ mln/core/site_set/p_vertices_psite.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/core/site_set/p_vertices_psite.hh /// -/// Implementation of p_vertices psite. +/// \brief Implementation of p_vertices psite. # include <mln/core/concept/pseudo_site.hh> # include <mln/core/internal/graph_psite_base.hh> @@ -55,6 +55,8 @@ public: + typedef p_vertices<G,F> target_t; + p_vertices_psite(); p_vertices_psite(const p_vertices<G,F>& s); p_vertices_psite(const p_vertices<G,F>& s, unsigned id); Index: mln/core/site_set/p_edges_psite.hh --- mln/core/site_set/p_edges_psite.hh (revision 3981) +++ mln/core/site_set/p_edges_psite.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/core/site_set/p_edges_psite.hh /// -/// Implementation of p_edges psite. +/// \brief Implementation of p_edges psite. # include <mln/core/internal/graph_psite_base.hh> # include <mln/util/edge.hh> @@ -55,6 +55,8 @@ public: + typedef p_edges<G,F> target_t; + /// Constructors /// \{ p_edges_psite(); Index: mln/core/site_set/complex_psite.hh --- mln/core/site_set/complex_psite.hh (revision 3981) +++ mln/core/site_set/complex_psite.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,6 +30,7 @@ # define MLN_CORE_SITE_SET_COMPLEX_PSITE_HH /// \file mln/core/site_set/complex_psite.hh +/// /// \brief Definition of a complex-based point site. # include <mln/core/internal/pseudo_site_base.hh> @@ -66,6 +68,8 @@ // pseudo site knows the site set it refers to. typedef p_complex<D, G> target; + typedef p_complex<D, G> target_t; // To please g++-2.95. + // FIXME: Document. /// Construction and assignment. /// \{ Index: mln/core/image/edge_image.hh --- mln/core/image/edge_image.hh (revision 3981) +++ mln/core/image/edge_image.hh (working copy) @@ -133,6 +133,7 @@ edge_image<P,V,G> > super_; public: + typedef typename super_::psite psite; typedef typename super_::rvalue rvalue; typedef typename super_::lvalue lvalue; @@ -177,11 +178,15 @@ /// Value accessors/operators overloads. /// @{ - using super_::operator(); rvalue operator()(unsigned e_id) const; lvalue operator()(unsigned e_id); /// @} + // Just to help g++-2.95... + rvalue operator()(const psite& p) const; + lvalue operator()(const psite& p); + // ...because "using super_::operator()" does not properly work. + }; template <typename P, typename V, typename G, typename J> @@ -232,14 +237,14 @@ - // vertex_image<P,V,G> + // edge_image<P,V,G> + template <typename P, typename V, typename G> inline edge_image<P,V,G>::edge_image() { } - template <typename P, typename V, typename G> inline edge_image<P,V,G>::edge_image(const p_edges<G,site_function_t>& pe) @@ -247,7 +252,6 @@ { } - template <typename P, typename V, typename G> inline edge_image<P,V,G>::edge_image(const Graph<G>& g, @@ -258,7 +262,6 @@ { } - template <typename P, typename V, typename G> inline edge_image<P,V,G>::edge_image(const p_edges<G,site_function_t>& pe, @@ -267,7 +270,6 @@ { } - template <typename P, typename V, typename G> template <typename FP, typename FV> inline @@ -281,8 +283,6 @@ mlc_equal(mln_result(FV),V)::check(); } - - template <typename P, typename V, typename G> template <typename FV> inline @@ -307,9 +307,23 @@ return this->data_->f_(e_id); } -# endif // ! MLN_INCLUDE_ONLY + template <typename P, typename V, typename G> + typename edge_image<P,V,G>::rvalue + edge_image<P,V,G>::operator()(const typename edge_image<P,V,G>::psite& p) const + { + return this->super_::operator()(p); + } + + template <typename P, typename V, typename G> + typename edge_image<P,V,G>::lvalue + edge_image<P,V,G>::operator()(const typename edge_image<P,V,G>::psite& p) + { + return this->super_::operator()(p); + } +# endif // ! MLN_INCLUDE_ONLY } // end of namespace mln + #endif // ! MLN_CORE_IMAGE_EDGE_IMAGE_HH Index: mln/core/image/graph_window_if_piter.hh --- mln/core/image/graph_window_if_piter.hh (revision 3981) +++ mln/core/image/graph_window_if_piter.hh (working copy) @@ -31,8 +31,7 @@ /// \file mln/core/image/graph_window_if_piter.hh /// -/// Definition of a site iterator on a custom graph window. - +/// \brief Definition of a site iterator on a custom graph window. # include <mln/core/internal/is_masked_impl_selector.hh> # include <mln/core/internal/site_relative_iterator_base.hh> @@ -52,7 +51,7 @@ : public internal::site_relative_iterator_base< W, graph_window_if_piter<S,W,I> >, public internal::is_masked_impl_selector<S, - mln_domain(W::mask_t), + typename W::mask_t::domain_t, graph_window_if_piter<S,W,I> > { typedef graph_window_if_piter<S,W,I> self_; @@ -107,13 +106,15 @@ private: I iter_; + + protected: /// The underlying window. using super_::s_; }; -# ifndef MLN_INCLUDE_ONLY +# ifndef MLN_INCLUDE_ONLY template <typename S, typename W, typename I> inline Index: mln/core/image/vertex_image.hh --- mln/core/image/vertex_image.hh (revision 3981) +++ mln/core/image/vertex_image.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/core/image/vertex_image.hh /// -/// Image based on graph vertices. +/// \brief Image based on graph vertices. # include <mln/core/concept/graph.hh> # include <mln/core/image/graph_elt_window.hh> @@ -135,6 +135,7 @@ vertex_image<P,V,G> > super_; public: + typedef typename super_::psite psite; typedef typename super_::rvalue rvalue; typedef typename super_::lvalue lvalue; @@ -170,11 +171,16 @@ /// Value accessors/operators overloads. /// @{ - using super_::operator(); rvalue operator()(unsigned v_id) const; lvalue operator()(unsigned v_id); /// @} + + // Just to help g++-2.95... + rvalue operator()(const psite& p) const; + lvalue operator()(const psite& p); + // ...because "using super_::operator()" does not properly work. + }; template <typename P, typename V, typename G, typename J> @@ -234,7 +240,6 @@ { } - template <typename P, typename V, typename G> inline vertex_image<P,V,G>::vertex_image(const p_vertices<G,site_function_t>& pv) @@ -242,7 +247,6 @@ { } - template <typename P, typename V, typename G> inline vertex_image<P,V,G>::vertex_image(const p_vertices<G,site_function_t>& pv, @@ -251,7 +255,6 @@ { } - template <typename P, typename V, typename G> template <typename FV> inline @@ -262,14 +265,13 @@ mlc_equal(mln_result(FV),V)::check(); } - // template <typename P, typename V, typename G> // typename vertex_image<P,V,G>::rvalue // vertex_image<P,V,G>::operator()(const util::vertex<G>& v) const // { // return this->data_->f_(v.id()); // } -// + // template <typename P, typename V, typename G> // typename vertex_image<P,V,G>::lvalue // vertex_image<P,V,G>::operator()(const util::vertex<G>& v) @@ -291,9 +293,23 @@ return this->data_->f_(v_id); } -# endif // ! MLN_INCLUDE_ONLY + template <typename P, typename V, typename G> + typename vertex_image<P,V,G>::rvalue + vertex_image<P,V,G>::operator()(const typename vertex_image<P,V,G>::psite& p) const + { + return this->super_::operator()(p); + } + + template <typename P, typename V, typename G> + typename vertex_image<P,V,G>::lvalue + vertex_image<P,V,G>::operator()(const typename vertex_image<P,V,G>::psite& p) + { + return this->super_::operator()(p); + } +# endif // ! MLN_INCLUDE_ONLY } // end of namespace mln + #endif // ! MLN_CORE_IMAGE_VERTEX_IMAGE_HH Index: mln/core/internal/graph_psite_base.hh --- mln/core/internal/graph_psite_base.hh (revision 3981) +++ mln/core/internal/graph_psite_base.hh (working copy) @@ -95,7 +95,7 @@ operator unsigned() const; /// Convertion towards the graph element Id. - operator id_t() const; + operator typename S::graph_element::id_t () const; /// Conversion towards the graph element (vertex or edge). operator const typename S::graph_element&() const; @@ -304,7 +304,7 @@ template <typename S, typename E> inline - graph_psite_base<S,E>::operator id_t() const + graph_psite_base<S,E>::operator unsigned () const { mln_precondition(is_valid()); return elt_.id(); @@ -312,7 +312,7 @@ template <typename S, typename E> inline - graph_psite_base<S,E>::operator unsigned() const // HERE + graph_psite_base<S,E>::operator typename S::graph_element::id_t () const { mln_precondition(is_valid()); return elt_.id(); Index: mln/core/internal/is_masked_impl_selector.hh --- mln/core/internal/is_masked_impl_selector.hh (revision 3981) +++ mln/core/internal/is_masked_impl_selector.hh (working copy) @@ -26,16 +26,16 @@ // reasons why the executable file might be covered by the GNU General // Public License. - #ifndef MLN_CORE_INTERNAL_IS_MASKED_IMPL_SELECTOR # define MLN_CORE_INTERNAL_IS_MASKED_IMPL_SELECTOR /// \file mln/core/internal/is_masked_impl_selector.hh /// -/// Add a specific member to graph windows/neighborhoods. +/// \brief Add a specific member to graph windows/neighborhoods. # include <mln/util/edge.hh> + namespace mln { @@ -92,7 +92,7 @@ { (void) center; E& iter = internal::force_exact<E>(*this); - return !iter.s_->mask()(element.id()); + return ! iter.target_()->mask()(element.id()); } @@ -108,7 +108,7 @@ util::edge<G1> e = center.edge_with(element); mln_postcondition(e.is_valid()); - return !iter.s_->mask()(e.id()); + return ! iter.target_()->mask()(e.id()); } @@ -128,18 +128,17 @@ E& iter = internal::force_exact<E>(*this); if (center.v1() == element.v2() || center.v2() == element.v2()) - return !iter.s_->mask()(element.v1()); + return ! iter.target_()->mask()(element.v1()); //else if (center.v2() == element.v1() || center.v1() == element.v1()) - return !iter.s_->mask()(element.v2()); + return ! iter.target_()->mask()(element.v2()); } - # endif // ! MLN_INCLUDE_ONLY - } // end of namespace mln::internal } // end of namespace mln + #endif // ! MLN_CORE_INTERNAL_IS_MASKED_IMPL_SELECTOR Index: mln/metal/converts_to.hh --- mln/metal/converts_to.hh (revision 3981) +++ mln/metal/converts_to.hh (working copy) @@ -31,7 +31,8 @@ /// \file mln/metal/converts_to.hh /// -/// \brief Definition of a type that means "converts to". +/// \brief Definition of a type that checks if a type "converts to" +/// another one. # include <mln/metal/is_a.hh> # include <mln/metal/const.hh> @@ -58,11 +59,17 @@ namespace internal { + struct eat // Required by g++-2.95 for selector to work. + { + template <typename T> eat(const volatile T&); + template <typename T> eat(T&); + }; + template <typename T, typename U> struct helper_converts_to_ { - static yes_ selector(U); - static no_ selector(...); + static yes_ selector(U, int); + static no_ selector(eat, ...); }; } // end of namespace mln::metal::internal @@ -71,7 +78,9 @@ /// \brief "converts-to" check. template <typename T, typename U> - struct converts_to : bool_<( sizeof(internal::helper_converts_to_<T, U>::selector(*internal::make_<mlc_const(T)>::ptr()) ) + struct converts_to : bool_<( sizeof(internal::helper_converts_to_<T, U> + ::selector(*internal::make_<mlc_const(T)>::ptr(), + 0) ) == sizeof(internal::yes_) )> {}; Index: mln/linear/gaussian/impl.hh --- mln/linear/gaussian/impl.hh (revision 3981) +++ mln/linear/gaussian/impl.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/linear/gaussian/impl.hh /// -/// Gaussian filter implementation. +/// \brief Gaussian filter implementation. /// /// \todo Add a clean reference Rachid Deriche /// Recursively implementing the gaussian and its derivatives (1993) @@ -176,8 +176,9 @@ Image<I>& img_, const F& coef, int dir) { I& img = exact(img_); - mln_precondition(dir < I::site::dim); + typedef mln_site(I) S; // Help g++-2.95. + mln_precondition(dir < S::dim); recursivefilter_<mln_value(I)>(img, coef, point1d(static_cast<def::coord>(-img.border())), @@ -194,9 +195,9 @@ Image<I>& img_, const F& coef, int dir) { I& img = exact(img_); + typedef mln_site(I) S; // Help g++-2.95. - mln_precondition(dir < I::site::dim); - + mln_precondition(dir < S::dim); if (dir == 0) { @@ -234,7 +235,9 @@ Image<I>& img_, const F& coef, int dir) { I& img = exact(img_); - mln_precondition(dir < I::site::dim); + typedef mln_site(I) S; // Help g++-2.95. + + mln_precondition(dir < S::dim); if (dir == 0) { @@ -303,6 +306,8 @@ double sigma, Image<O>& out) { + typedef mln_site(I) S; // Help g++-2.95. + mln_ch_value(O, double) work_img(exact(in).domain()); data::paste(in, work_img); extension::adjust_fill(work_img, 4, 0); @@ -310,7 +315,7 @@ // On tiny sigma, Derich algorithm doesn't work. // It is the same thing that to convolve with a Dirac. if (sigma > 0.006) - for (int i = 0; i < I::site::dim; ++i) + for (int i = 0; i < S::dim; ++i) generic_filter_(mln_trait_image_dimension(I)(), work_img, coef, i); @@ -352,6 +357,8 @@ double sigma, Image<O>& out) { + typedef mln_site(I) S; // Help g++-2.95. + mln_ch_value(O, double) work_img(exact(in).domain()); data::paste(in, work_img); extension::adjust_fill(work_img, 4, 0); @@ -359,7 +366,7 @@ // On tiny sigma, Derich algorithm doesn't work. // It is the same thing that to convolve with a Dirac. if (sigma > 0.006) - for (int i = 0; i < I::site::dim; ++i) + for (int i = 0; i < S::dim; ++i) generic_filter_(mln_trait_image_dimension(I)(), work_img, coef, i); @@ -402,6 +409,8 @@ double sigma, Image<O>& out) { + typedef mln_site(I) S; // Help g++-2.95. + // typedef algebra::vec<3, double> vec3f; // mln_ch_value(O, vec3f) work_img(exact(in).domain()); // FIXME : paste does not work (rgb8 -> vec3f). @@ -410,7 +419,7 @@ // On tiny sigma, Derich algorithm doesn't work. // It is the same thing that to convolve with a Dirac. if (sigma > 0.006) - for (int i = 0; i < I::site::dim; ++i) + for (int i = 0; i < S::dim; ++i) generic_filter_(mln_trait_image_dimension(I)(), out, coef, i); } Index: mln/accu/transform_directional.hh --- mln/accu/transform_directional.hh (revision 3981) +++ mln/accu/transform_directional.hh (working copy) @@ -198,7 +198,8 @@ A accu; mln_psite(I) p; - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; unsigned dir; window2d win_left, win_right; Index: mln/accu/transform_diagonal.hh --- mln/accu/transform_diagonal.hh (revision 3981) +++ mln/accu/transform_diagonal.hh (working copy) @@ -177,7 +177,8 @@ A accu; mln_psite(I) p; - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; window2d win_left, win_right; @@ -242,7 +243,8 @@ A accu; mln_psite(I) p; - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; window2d win_left, win_right; @@ -303,7 +305,8 @@ A accu; mln_psite(I) p; - enum { dim = I::site::dim }; + typedef mln_site(I) S; + enum { dim = S::dim }; window2d win_left, win_right; Index: mln/make/image.hh --- mln/make/image.hh (revision 3981) +++ mln/make/image.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,10 @@ /// \file mln/make/image.hh /// -/// Routine to create an image from values given as a C-array. +/// \brief Routine to create an image from values given as a C-array. +/// +/// \todo I guess that we should modify V into mln_unconst(V); test +/// with C arrays being "const int[]" and run g++-2.95... # include <mln/core/image/image1d.hh> # include <mln/core/image/image2d.hh> Index: mln/fun/x2x/composed.hh --- mln/fun/x2x/composed.hh (revision 3981) +++ mln/fun/x2x/composed.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/fun/x2x/composed.hh /// -/// Definition of a composed transformation. +/// \brief Definition of a composed transformation. # include <mln/core/concept/function.hh> # include <mln/fun/internal/x2x_linear_impl.hh> @@ -138,8 +138,8 @@ template <typename T2, typename T1> struct composed : public internal::helper_composed_<T2,T1,composed<T2,T1>, - mlc_is(T2, Function_v2v<T2>)::value && - mlc_is(T1, Function_v2v<T1>)::value>, + (mlc_is(T2, Function_v2v<T2>)::value && + mlc_is(T1, Function_v2v<T1>)::value) >, private metal::and_< metal::bool_<(T2::dim == T1::dim)>, metal::is<mln_argument(T2), mln_result(T1)> >::check_t @@ -150,8 +150,8 @@ /// Constructor with the two transformation to be composed. composed(const T2& f, const T1& g) : internal::helper_composed_<T2,T1,composed<T2,T1>, - mlc_is(T2, Function_v2v<T2>)::value && - mlc_is(T1, Function_v2v<T1>)::value>(f, g) + (mlc_is(T2, Function_v2v<T2>)::value && + mlc_is(T1, Function_v2v<T1>)::value) >(f, g) {} }; Index: mln/fun/x2x/translation.hh --- mln/fun/x2x/translation.hh (revision 3981) +++ mln/fun/x2x/translation.hh (working copy) @@ -30,7 +30,7 @@ /// \file mln/fun/x2x/translation.hh /// -/// Define a translation function. +/// \brief Define a translation function. # include <mln/core/concept/function.hh> # include <mln/fun/internal/x2x_linear_impl.hh> @@ -38,6 +38,7 @@ # include <mln/algebra/h_mat.hh> # include <mln/fun/i2v/all.hh> + namespace mln { @@ -47,14 +48,14 @@ namespace x2x { - /// Represent a translation function. + /// Translation function-object. + // template <unsigned n, typename C> struct translation - : fun::internal::x2x_linear_impl_< algebra::vec<n,C>, translation<n,C> > - , public Function_v2v< translation<n,C> > + : + fun::internal::x2x_linear_impl_< algebra::vec<n,C>, translation<n,C> >, + public Function_v2v< translation<n,C> > { - typedef fun::internal::x2x_linear_impl_< algebra::vec<n,C>, translation<n,C> > super_; - /// Type of the inverse function. typedef translation<n,C> invert; /// Return the inverse function. @@ -65,7 +66,6 @@ /// Constructor with the translation vector. translation(const algebra::vec<n,C>& t); - using super_::operator(); /// Perform the translation of the given vector algebra::vec<n,C> operator()(const algebra::vec<n,C>& v) const; Index: mln/fun/x2x/rotation.hh --- mln/fun/x2x/rotation.hh (revision 3981) +++ mln/fun/x2x/rotation.hh (working copy) @@ -31,7 +31,7 @@ /// \file mln/fun/x2x/rotation.hh /// -/// Define a rotation function. +/// \brief Define a rotation function. /// /// \todo store the quaternion instead of (axis, alpha) /// => better precision while composing two rotation matrices. @@ -40,6 +40,7 @@ /// http://jeux.developpez.com/faq/matquat/?page=quaternions#Q56 # include <cmath> + # include <mln/core/concept/function.hh> # include <mln/fun/internal/x2x_linear_impl.hh> # include <mln/algebra/vec.hh> @@ -49,6 +50,7 @@ # include <mln/norm/l2.hh> + namespace mln { @@ -136,11 +138,11 @@ /// Represent a rotation function. template <unsigned n, typename C> struct rotation - : fun::internal::x2x_linear_impl_< algebra::vec<n,C>, rotation<n,C> > - , public Function_v2v< rotation<n,C> > + : + fun::internal::x2x_linear_impl_< algebra::vec<n,C>, rotation<n,C> > + , + public Function_v2v< rotation<n,C> > { - typedef fun::internal::x2x_linear_impl_< algebra::vec<n,C>, rotation<n,C> > super_; - /// Type of the inverse function. typedef rotation<n,C> invert; /// Return the invere function. @@ -155,7 +157,6 @@ /// Constructor with h_mat. rotation(const algebra::h_mat<n,C>& m); - using super_::operator(); /// Perform the rotation of the given vector. algebra::vec<n,C> operator()(const algebra::vec<n,C>& v) const; Index: mln/fun/stat/mahalanobis.hh --- mln/fun/stat/mahalanobis.hh (revision 3981) +++ mln/fun/stat/mahalanobis.hh (working copy) @@ -30,7 +30,7 @@ /// \file mln/fun/stat/mahalanobis.hh /// -/// Define the FIXME +/// \brief Define the FIXME # include <cmath> # include <mln/core/concept/function.hh> @@ -55,8 +55,9 @@ enum { n = V::dim }; typedef float result; - mahalanobis(const algebra::mat<V::dim,V::dim,float>& var, - const algebra::vec<V::dim,float>& mean); + mahalanobis(const algebra::mat<n,n,float>& var, + const algebra::vec<n,float>& mean); + // Tech. note: using n (instead of V::dim) above helps g++-2.95. float operator()(const V& v) const; @@ -74,8 +75,8 @@ template <typename V> inline - mahalanobis<V>::mahalanobis(const algebra::mat<V::dim,V::dim,float>& var, - const algebra::vec<V::dim,float>& mean) + mahalanobis<V>::mahalanobis(const algebra::mat<n,n,float>& var, + const algebra::vec<n,float>& mean) { var_1_ = var._1(); mean_ = mean; Index: mln/morpho/attribute/card.hh --- mln/morpho/attribute/card.hh (revision 3981) +++ mln/morpho/attribute/card.hh (working copy) @@ -30,7 +30,7 @@ /// \file mln/morpho/attribute/card.hh /// -/// Define an accumulator that computes the cardinality of a +/// \brief Define an accumulator that computes the cardinality of a /// component. /// /// \todo Add a static check in the accumulator concept so that @@ -97,7 +97,6 @@ void take(const util::pix<I>& px); void take(const card<I>& other); - using super_::take_as_init; void take_as_init(); // Extra version. void take_as_init_(const util::pix<I>& px); // Overload. /// \} @@ -183,7 +182,7 @@ void card<I>::take_as_init_(const util::pix<I>&) { - take_as_init(); + this->take_as_init(); } template <typename I> Index: mln/io/pgm/load.hh --- mln/io/pgm/load.hh (revision 3981) +++ mln/io/pgm/load.hh (working copy) @@ -29,13 +29,12 @@ #ifndef MLN_IO_PGM_LOAD_HH # define MLN_IO_PGM_LOAD_HH -/*! - * \file mln/io/pgm/load.hh - * - * \brief Define a function which loads an image of kind pgm with - * given path. - * - */ +/// \file mln/io/pgm/load.hh +/// +/// \brief Define a function which loads an image of kind pgm with +/// +/// \todo Fabien: Move image3d loading elsewhere! for instance in +/// io/pgms/load (note the 's')... # include <iostream> # include <fstream> @@ -43,13 +42,11 @@ # include <mln/core/image/image2d.hh> # include <mln/core/image/image3d.hh> - # include <mln/value/int_u8.hh> - # include <mln/io/pnm/load.hh> - # include <mln/make/image3d.hh> + namespace mln { Index: mln/io/off/save.hh --- mln/io/off/save.hh (revision 3981) +++ mln/io/off/save.hh (working copy) @@ -258,15 +258,15 @@ be safely ignored.'' */ /* FIXME: This is too long. We shall be able to write - ima.domain().template nfaces<0>() + ima.domain().template nfaces_with_dim<0>() or even - ima.template nfaces<0>(). + ima.template nfaces_with_dim<0>(). */ - ostr << ima.domain().cplx().template nfaces<0>() << ' ' - << ima.domain().cplx().template nfaces<2>() << ' ' - << ima.domain().cplx().template nfaces<1>() << std::endl; + ostr << ima.domain().cplx().template nfaces_with_dim<0>() << ' ' + << ima.domain().cplx().template nfaces_with_dim<2>() << ' ' + << ima.domain().cplx().template nfaces_with_dim<1>() << std::endl; /*-------. | Data. | Index: mln/canvas/browsing/internal/graph_first_search.hh --- mln/canvas/browsing/internal/graph_first_search.hh (revision 3981) +++ mln/canvas/browsing/internal/graph_first_search.hh (working copy) @@ -70,11 +70,13 @@ # include <deque> # include <queue> # include <stack> + # include <mln/core/concept/iterator.hh> # include <mln/core/concept/browsing.hh> # include <mln/core/concept/graph.hh> # include <mln/util/vertex.hh> + namespace mln { @@ -90,11 +92,11 @@ /// Search algorithm for graph. /// Browse over all vertices for each component. template <typename E, - template <typename T, typename Sequence = std::deque<T> > - class C> + template <typename T, typename Seq> class C > class graph_first_search_t : public Browsing< E > { - typedef C<util::vertex_id_t> container_t; + typedef util::vertex_id_t T_; + typedef C< T_, std::deque<T_> > container_t; public: template <typename G, typename F> void operator()(const Graph<G>&, F& f) const; @@ -138,8 +140,7 @@ template <typename E, - template <typename T, typename Sequence = std::deque<T> > - class C> + template <typename T, typename Seq> class C> template <typename G, typename F> inline void @@ -156,19 +157,19 @@ for_all(v) if (f.to_be_treated(v.id())) // <--- to_be_treated { - container_t queue; - queue.push(v.id()); + container_t q; + q.push(v.id()); f.new_component_from_vertex(v.id()); // <--- new_component_from_vertex - while (!queue.empty()) + while (! q.empty()) { - util::vertex<G> current_v = g.vertex(next(queue)); + util::vertex<G> current_v = g.vertex(next(q)); f.process_vertex(current_v.id()); // <--- process_vertex - queue.pop(); + q.pop(); for (unsigned nv = 0; nv < current_v.nmax_nbh_vertices(); ++nv) if (f.to_be_queued(current_v.ith_nbh_vertex(nv))) // <--- to_be_queued { f.added_to_queue(current_v.ith_nbh_vertex(nv)); // <--- added_to_queue - queue.push(current_v.ith_nbh_vertex(nv)); + q.push(current_v.ith_nbh_vertex(nv)); } } f.next_component(); // <-- next_component Index: tests/topo/complex.cc --- tests/topo/complex.cc (revision 3981) +++ tests/topo/complex.cc (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 @@ -26,6 +27,7 @@ // Public License. /// \file tests/topo/complex.cc +/// /// \brief Test of mln::complex. #include <algorithm> @@ -99,9 +101,9 @@ std::cout << "Using ``static'' manipulators." << std::endl - << " number of 0-faces: c.nfaces<0>() = " << c.nfaces<0>() << std::endl - << " number of 1-faces: c.nfaces<1>() = " << c.nfaces<1>() << std::endl - << " number of 2-faces: c.nfaces<2>() = " << c.nfaces<2>() << std::endl + << " number of 0-faces: c.nfaces_with_dim<0>() = " << c.nfaces_with_dim<0>() << std::endl + << " number of 1-faces: c.nfaces_with_dim<1>() = " << c.nfaces_with_dim<1>() << std::endl + << " number of 2-faces: c.nfaces_with_dim<2>() = " << c.nfaces_with_dim<2>() << std::endl << " total number of faces: c.nfaces() = " << c.nfaces() << std::endl << std::endl; Index: tests/morpho/complex_image_wst.cc --- tests/morpho/complex_image_wst.cc (revision 3981) +++ tests/morpho/complex_image_wst.cc (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 @@ -27,7 +28,8 @@ /// \file tests/morpho/complex_image_wst.cc /// -/// Testing Meyer's Watershed Transform on mln::complex_image. +/// \brief Testing the Watershed transform by flooding on +/// mln::complex_image. #include <iostream> #include <fstream> @@ -52,7 +54,7 @@ #include <mln/norm/l2.hh> #include <mln/morpho/closing/area.hh> -#include <mln/morpho/meyer_wst.hh> +#include <mln/morpho/watershed/flooding.hh> #include <mln/convert/to.hh> @@ -207,7 +209,7 @@ typedef unsigned wst_val_t; wst_val_t nbasins; typedef complex_image<D, G, wst_val_t> wst_ima_t; - wst_ima_t wshed = morpho::meyer_wst(closed_dist_ima, nbh, nbasins); + wst_ima_t wshed = morpho::watershed::flooding(closed_dist_ima, nbh, nbasins); /* Note that since the image is based not only on the 1-faces but also on the 0-faces of the complex, and given the above neighborhood, the domain seen by the WST is not connected! It is @@ -234,7 +236,7 @@ We definitely need a complex_image that can accept a subset of a complex as domain (or at least a p_face<N, D, P>. */ - wst_val_t actual_nbasins = nbasins - c.nfaces<0>(); + wst_val_t actual_nbasins = nbasins - c.nfaces_with_dim<0>(); std::cout << "nbasins = " << actual_nbasins << std::endl; Index: apps/statues/save_bin_alt.hh --- apps/statues/save_bin_alt.hh (revision 3981) +++ apps/statues/save_bin_alt.hh (working copy) @@ -107,15 +107,15 @@ be safely ignored.'' */ /* FIXME: This is too long. We shall be able to write - ima.domain().template nfaces<0>() + ima.domain().template nfaces_with_dim<0>() or even - ima.template nfaces<0>(). + ima.template nfaces_with_dim<0>(). */ - ostr << ima.domain().cplx().template nfaces<0>() << ' ' + ostr << ima.domain().cplx().template nfaces_with_dim<0>() << ' ' << n2faces << ' ' - << ima.domain().cplx().template nfaces<1>() << std::endl; + << ima.domain().cplx().template nfaces_with_dim<1>() << std::endl; /*-------. | Data. |