cleanup-2008 2889: Rename some graph-related files and classes.

https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Rename some graph-related files and classes. * mln/util/internal/graph_edge.hh: Rename as... * mln/util/edge.hh: ...this. * mln/util/internal/graph_vertex.hh: Rename as... * mln/util/vertex.hh: ...this. * mln/util/all.hh: Update. * mln/util/internal/graph_psite_base.hh: Rename as... * mln/core/internal/graph_psite_base.hh: ...this. * mln/util/internal/graph_vertex_psite.hh: Rename as... * mln/core/site_set/p_vertices_psite.hh: ...this. (internal::graph_vertex_psite): Rename as... (p_vertices_psite): ...this. * mln/util/internal/graph_edge_psite.hh: Rename as... * mln/core/site_set/p_edges_psite.hh: ...this. (internal::graph_edge_psite): Rename as... (p_edges_psite): ...this. * mln/util/internal/graph_iter.hh, * mln/util/internal/graph_base.hh, * mln/util/internal/graph_iter_base.hh, * mln/core/site_set/p_vertices.hh, * mln/core/site_set/p_edges.hh, * mln/core/image/line_graph_neighborhood_piter.hh, * mln/core/image/line_graph_window_piter.hh, * mln/core/image/line_graph_elt_window.hh, * mln/core/image/line_graph_elt_neighborhood.hh, * mln/core/image/graph_window_piter.hh, * mln/core/image/graph_neighborhood_piter.hh, * mln/core/image/graph_elt_neighborhood.hh, * mln/core/image/graph_elt_window.hh: Update. core/image/graph_elt_neighborhood.hh | 6 - core/image/graph_elt_window.hh | 6 - core/image/graph_neighborhood_piter.hh | 4 - core/image/graph_window_piter.hh | 4 - core/image/line_graph_elt_neighborhood.hh | 7 +- core/image/line_graph_elt_window.hh | 7 +- core/image/line_graph_neighborhood_piter.hh | 4 - core/image/line_graph_window_piter.hh | 4 - core/internal/graph_psite_base.hh | 24 ++----- core/site_set/p_edges.hh | 7 +- core/site_set/p_edges_psite.hh | 41 +++++-------- core/site_set/p_vertices.hh | 10 +-- core/site_set/p_vertices_psite.hh | 41 +++++-------- util/all.hh | 10 +-- util/edge.hh | 29 ++++++--- util/internal/graph_base.hh | 9 +- util/internal/graph_iter.hh | 24 ++++++- util/internal/graph_iter_base.hh | 1 util/vertex.hh | 88 +++++++++++++++++----------- 19 files changed, 177 insertions(+), 149 deletions(-) Index: mln/core/site_set/p_vertices.hh --- mln/core/site_set/p_vertices.hh (revision 2888) +++ mln/core/site_set/p_vertices.hh (working copy) @@ -34,13 +34,9 @@ # include <mln/core/internal/site_set_base.hh> # include <mln/core/site_set/p_graph_piter.hh> -# include <mln/util/internal/graph_vertex_psite.hh> +# include <mln/core/site_set/p_vertices_psite.hh> # include <mln/util/graph.hh> - //# include <mln/util/tracked_ptr.hh> - - //# include <mln/core/image/graph_psite.hh> - //# include <mln/core/site_set/p_vertices_piter.hh> namespace mln @@ -52,6 +48,7 @@ namespace trait { + template <typename G, typename F> struct site_set_< p_vertices<G, F> > { @@ -61,6 +58,7 @@ typedef trait::site_set::contents::fixed contents; typedef trait::site_set::arity::unique arity; }; + } // end of namespace mln::trait @@ -104,7 +102,7 @@ typedef mln_site(super_) element; /// Point_Site associated type. - typedef internal::vertex_psite<G, F> psite; + typedef p_vertices_psite<G,F> psite; /// Forward Site_Iterator associated type. typedef p_graph_piter< self_, mln_vertex_fwd_iter(G) > fwd_piter; Index: mln/core/site_set/p_edges.hh --- mln/core/site_set/p_edges.hh (revision 2888) +++ mln/core/site_set/p_edges.hh (working copy) @@ -29,11 +29,12 @@ # define MLN_CORE_SITE_SET_P_EDGES_HH /// \file mln/core/site_set/p_edges.hh - /// \brief Definition of a site set based on graph edges. +/// +/// Definition of a site set based on graph edges. # include <mln/core/internal/site_set_base.hh> # include <mln/core/site_set/p_graph_piter.hh> -# include <mln/util/internal/graph_edge_psite.hh> +# include <mln/core/site_set/p_edges_psite.hh> # include <mln/util/graph.hh> @@ -90,7 +91,7 @@ typedef mln_site(super_) element; /// Point_Site associated type. - typedef internal::edge_psite<G, F> psite; + typedef p_edges_psite<G, F> psite; /// Forward Site_Iterator associated type. typedef p_graph_piter< self_, mln_edge_fwd_iter(G) > fwd_piter; Index: mln/core/site_set/p_vertices_psite.hh --- mln/core/site_set/p_vertices_psite.hh (revision 2888) +++ mln/core/site_set/p_vertices_psite.hh (working copy) @@ -25,16 +25,16 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_UTIL_INTERNAL_GRAPH_VERTEX_PSITE_HH -# define MLN_UTIL_INTERNAL_GRAPH_VERTEX_PSITE_HH +#ifndef MLN_CORE_SITE_SET_P_VERTICES_PSITE_HH +# define MLN_CORE_SITE_SET_P_VERTICES_PSITE_HH -/// \file mln/util/internal/graph_vertex_psite.hh +/// \file mln/core/site_set/p_vertices_psite.hh /// /// Implementation of p_vertices psite. # include <mln/core/concept/pseudo_site.hh> -# include <mln/util/internal/graph_psite_base.hh> -# include <mln/util/internal/graph_vertex.hh> +# include <mln/core/internal/graph_psite_base.hh> +# include <mln/util/vertex.hh> namespace mln @@ -44,23 +44,20 @@ template <typename G, typename F> class p_vertices; - namespace internal - { - template <typename G, typename F> - class vertex_psite : - public graph_psite_base< p_vertices<G,F>, - vertex_psite<G,F> > + class p_vertices_psite : + + public internal::graph_psite_base< p_vertices<G,F>, p_vertices_psite<G,F> > { - typedef vertex_psite<G,F> self_; - typedef graph_psite_base<p_vertices<G,F>, self_> super_; + typedef p_vertices_psite<G,F> self_; + typedef internal::graph_psite_base<p_vertices<G,F>, self_> super_; public: - vertex_psite(); - vertex_psite(const p_vertices<G,F>& s); - vertex_psite(const p_vertices<G,F>& s, unsigned id); + p_vertices_psite(); + p_vertices_psite(const p_vertices<G,F>& s); + p_vertices_psite(const p_vertices<G,F>& s, unsigned id); const util::vertex<G>& v() const; }; @@ -71,20 +68,20 @@ template <typename G, typename F> inline - vertex_psite<G, F>::vertex_psite() + p_vertices_psite<G, F>::p_vertices_psite() { } template <typename G, typename F> inline - vertex_psite<G, F>::vertex_psite(const p_vertices<G,F>& s) + p_vertices_psite<G, F>::p_vertices_psite(const p_vertices<G,F>& s) : super_(s) { } template <typename G, typename F> inline - vertex_psite<G, F>::vertex_psite(const p_vertices<G,F>& s, unsigned i) + p_vertices_psite<G, F>::p_vertices_psite(const p_vertices<G,F>& s, unsigned i) : super_(s, i) { } @@ -92,17 +89,15 @@ template <typename G, typename F> inline const util::vertex<G>& - vertex_psite<G, F>::v() const + p_vertices_psite<G, F>::v() const { return this->elt_; } # endif // ! MLN_INCLUDE_ONLY -} // end of namespace internal - } // end of namespace mln -#endif // !MLN_UTIL_INTERNAL_GRAPH_VERTEX_PSITE_HH +#endif // ! MLN_CORE_SITE_SET_P_VERTICES_PSITE_HH Property changes on: mln/core/site_set/p_vertices_psite.hh ___________________________________________________________________ Added: svn:mergeinfo Index: mln/core/site_set/p_edges_psite.hh --- mln/core/site_set/p_edges_psite.hh (revision 2888) +++ mln/core/site_set/p_edges_psite.hh (working copy) @@ -25,15 +25,15 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_UTIL_INTERNAL_GRAPH_EDGE_PSITE_HH -# define MLN_UTIL_INTERNAL_GRAPH_EDGE_PSITE_HH +#ifndef MLN_CORE_SITE_SET_P_EDGES_PSITE_HH +# define MLN_CORE_SITE_SET_P_EDGES_PSITE_HH -/// \file mln/util/internal/graph_edge_psite.hh +/// \file mln/core/site_set/p_edges_psite.hh /// /// Implementation of p_edges psite. -# include <mln/util/internal/graph_psite_base.hh> -# include <mln/util/internal/graph_edge.hh> +# include <mln/core/internal/graph_psite_base.hh> +# include <mln/util/edge.hh> namespace mln @@ -43,25 +43,20 @@ template <typename G, typename F> class p_edges; - namespace internal - { - - template <typename G, typename F> - class edge_psite : - public graph_psite_base< p_edges<G,F>, - edge_psite<G,F> > + class p_edges_psite : + public internal::graph_psite_base< p_edges<G,F>, p_edges_psite<G,F> > { - typedef edge_psite<G,F> self_; - typedef graph_psite_base<p_edges<G,F>, self_> super_; + typedef p_edges_psite<G,F> self_; + typedef internal::graph_psite_base<p_edges<G,F>, self_> super_; public: /// Constructors /// \{ - edge_psite(); - edge_psite(const p_edges<G,F>& s); - edge_psite(const p_edges<G,F>& s, unsigned); + p_edges_psite(); + p_edges_psite(const p_edges<G,F>& s); + p_edges_psite(const p_edges<G,F>& s, unsigned); /// \} /// Accessors @@ -78,20 +73,20 @@ template <typename G, typename F> inline - edge_psite<G, F>::edge_psite() + p_edges_psite<G, F>::p_edges_psite() { } template <typename G, typename F> inline - edge_psite<G, F>::edge_psite(const p_edges<G,F>& s) + p_edges_psite<G, F>::p_edges_psite(const p_edges<G,F>& s) : super_(s) { } template <typename G, typename F> inline - edge_psite<G, F>::edge_psite(const p_edges<G,F>& s, unsigned id) + p_edges_psite<G, F>::p_edges_psite(const p_edges<G,F>& s, unsigned id) : super_(s, id) { } @@ -99,17 +94,15 @@ template <typename G, typename F> inline const util::edge<G>& - edge_psite<G, F>::e() const + p_edges_psite<G, F>::e() const { return this->elt_; } # endif // ! MLN_INCLUDE_ONLY -} // end of namespace internal - } // end of namespace mln -#endif // ! MLN_UTIL_INTERNAL_GRAPH_EDGE_PSITE_HH +#endif // ! MLN_CORE_SITE_SET_P_EDGES_PSITE_HH Property changes on: mln/core/site_set/p_edges_psite.hh ___________________________________________________________________ Added: svn:mergeinfo Index: mln/core/image/line_graph_neighborhood_piter.hh --- mln/core/image/line_graph_neighborhood_piter.hh (revision 2888) +++ mln/core/image/line_graph_neighborhood_piter.hh (working copy) @@ -194,7 +194,7 @@ mln_psite(N) line_graph_neighborhood_fwd_piter<G, F, N>::compute_p_() const { - return internal::edge_psite<G, F>(this->center().site_set(), *i_); + return p_edges_psite<G, F>(this->center().site_set(), *i_); } @@ -256,7 +256,7 @@ mln_psite(N) line_graph_neighborhood_bkd_piter<G, F, N>::compute_p_() const { - return internal::edge_psite<G, F>(this->center().site_set(), *i_); + return p_edges_psite<G, F>(this->center().site_set(), *i_); } # endif // ! MLN_INCLUDE_ONLY Index: mln/core/image/line_graph_window_piter.hh --- mln/core/image/line_graph_window_piter.hh (revision 2888) +++ mln/core/image/line_graph_window_piter.hh (working copy) @@ -193,7 +193,7 @@ mln_psite(W) line_graph_window_fwd_piter<G, F, W>::compute_p_() const { - return internal::edge_psite<G, F>(this->center().site_set(), *i_); + return p_edges_psite<G, F>(this->center().site_set(), *i_); } @@ -255,7 +255,7 @@ mln_psite(W) line_graph_window_bkd_piter<G, F, W>::compute_p_() const { - return internal::edge_psite<G, F>(this->center().site_set(), *i_); + return p_edges_psite<G, F>(this->center().site_set(), *i_); } # endif // ! MLN_INCLUDE_ONLY Index: mln/core/image/line_graph_elt_window.hh --- mln/core/image/line_graph_elt_window.hh (revision 2888) +++ mln/core/image/line_graph_elt_window.hh (working copy) @@ -30,11 +30,12 @@ # define MLN_CORE_IMAGE_LINE_GRAPH_ELT_WINDOW_HH /// \file mln/core/image/line_graph_elt_window.hh +/// /// Definition of the elementary ``window'' on a line graph. # include <mln/core/concept/window.hh> # include <mln/core/internal/graph_window_base.hh> -# include <mln/util/internal/graph_edge_psite.hh> +# include <mln/core/site_set/p_edges_psite.hh> # include <mln/core/image/line_graph_window_piter.hh> @@ -64,7 +65,7 @@ class line_graph_elt_window : public graph_window_base< G, F, - internal::edge_psite<G, F>, + p_edges_psite<G, F>, line_graph_elt_window<G, F> > { typedef line_graph_elt_window<G, F> self_; @@ -73,7 +74,7 @@ /// Associated types. /// \{ /// The type of psite corresponding to the window. - typedef internal::edge_psite<G, F> psite; + typedef p_edges_psite<G, F> psite; /// Site_Iterator type to browse the psites of the window /// w.r.t. the ordering of edges. Index: mln/core/image/line_graph_elt_neighborhood.hh --- mln/core/image/line_graph_elt_neighborhood.hh (revision 2888) +++ mln/core/image/line_graph_elt_neighborhood.hh (working copy) @@ -30,13 +30,14 @@ # define MLN_CORE_IMAGE_LINE_GRAPH_ELT_NEIGHBORHOOD_HH /// \file mln/core/image/line_graph_elt_neighborhood.hh +/// /// Definition of the elementary ``neighborhood'' on a line graph. # include <set> # include <mln/core/concept/neighborhood.hh> # include <mln/core/internal/graph_neighborhood_base.hh> -# include <mln/util/internal/graph_edge_psite.hh> +# include <mln/core/site_set/p_edges_psite.hh> # include <mln/core/image/line_graph_neighborhood_piter.hh> # include <mln/core/image/line_graph_elt_window.hh> @@ -50,7 +51,7 @@ class line_graph_elt_neighborhood : public graph_neighborhood_base<G, F, - internal::edge_psite<G, F>, + p_edges_psite<G, F>, line_graph_elt_neighborhood<G, F> > { typedef line_graph_elt_neighborhood<G, F> self_; @@ -59,7 +60,7 @@ /// Associated types. /// \{ /// The type of psite corresponding to the neighborhood. - typedef internal::edge_psite<G, F> psite; + typedef p_edges_psite<G, F> psite; /// Site_Iterator type to browse the psites of the /// neighborhood w.r.t. the ordering of edges. Index: mln/core/image/graph_window_piter.hh --- mln/core/image/graph_window_piter.hh (revision 2888) +++ mln/core/image/graph_window_piter.hh (working copy) @@ -190,7 +190,7 @@ mln_psite(W) graph_window_fwd_piter<G, F, W>::compute_p_() const { - return internal::vertex_psite<G, F>(this->center().site_set(), *i_); + return p_vertices_psite<G, F>(this->center().site_set(), *i_); } @@ -252,7 +252,7 @@ mln_psite(W) graph_window_bkd_piter<G, F, W>::compute_p_() const { - return internal::vertex_psite<G, F>(this->center().site_set(), *i_); + return p_vertices_psite<G, F>(this->center().site_set(), *i_); } # endif // ! MLN_INCLUDE_ONLY Index: mln/core/image/graph_neighborhood_piter.hh --- mln/core/image/graph_neighborhood_piter.hh (revision 2888) +++ mln/core/image/graph_neighborhood_piter.hh (working copy) @@ -194,7 +194,7 @@ mln_psite(N) graph_neighborhood_fwd_piter<G, F, N>::compute_p_() const { - return internal::vertex_psite<G, F>(this->center().site_set(), *i_); + return p_vertices_psite<G, F>(this->center().site_set(), *i_); } @@ -256,7 +256,7 @@ mln_psite(N) graph_neighborhood_bkd_piter<G, F, N>::compute_p_() const { - return internal::vertex_psite<G, F>(this->center().site_set(), *i_); + return p_vertices_psite<G, F>(this->center().site_set(), *i_); } Index: mln/core/image/graph_elt_neighborhood.hh --- mln/core/image/graph_elt_neighborhood.hh (revision 2888) +++ mln/core/image/graph_elt_neighborhood.hh (working copy) @@ -36,7 +36,7 @@ # include <mln/core/concept/neighborhood.hh> # include <mln/core/internal/graph_neighborhood_base.hh> -# include <mln/util/internal/graph_vertex_psite.hh> +# include <mln/core/site_set/p_vertices_psite.hh> # include <mln/core/image/graph_neighborhood_piter.hh> # include <mln/core/image/graph_elt_window.hh> @@ -54,7 +54,7 @@ class graph_elt_neighborhood : public graph_neighborhood_base<G, F, - internal::vertex_psite<G, F>, + p_vertices_psite<G, F>, graph_elt_neighborhood<G, F> > { typedef graph_elt_neighborhood<G, F> self_; @@ -63,7 +63,7 @@ /// Associated types. /// \{ /// The type of psite corresponding to the neighborhood. - typedef internal::vertex_psite<G, F> psite; + typedef p_vertices_psite<G, F> psite; /// Site_Iterator type to browse the psites of the /// neighborhood w.r.t. the ordering of vertices. Index: mln/core/image/graph_elt_window.hh --- mln/core/image/graph_elt_window.hh (revision 2888) +++ mln/core/image/graph_elt_window.hh (working copy) @@ -34,7 +34,7 @@ # include <mln/core/concept/window.hh> # include <mln/core/internal/graph_window_base.hh> -# include <mln/util/internal/graph_vertex_psite.hh> +# include <mln/core/site_set/p_vertices_psite.hh> # include <mln/core/image/graph_window_piter.hh> @@ -64,7 +64,7 @@ class graph_elt_window : public graph_window_base< G, F, - internal::vertex_psite<G, F>, + p_vertices_psite<G, F>, graph_elt_window<G, F> > { @@ -74,7 +74,7 @@ /// Associated types. /// \{ /// The type of psite corresponding to the window. - typedef internal::vertex_psite<G, F> psite; + typedef p_vertices_psite<G, F> psite; /// \brief Site_Iterator type to browse the psites of the window /// w.r.t. the ordering of vertices. Index: mln/core/internal/graph_psite_base.hh --- mln/core/internal/graph_psite_base.hh (revision 2888) +++ mln/core/internal/graph_psite_base.hh (working copy) @@ -25,10 +25,10 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_UTIL_INTERNAL_GRAPH_PSITE_BASE_HH -# define MLN_UTIL_INTERNAL_GRAPH_PSITE_BASE_HH +#ifndef MLN_CORE_INTERNAL_GRAPH_PSITE_BASE_HH +# define MLN_CORE_INTERNAL_GRAPH_PSITE_BASE_HH -/// \file mln/util/internal/graph_psite_base.hh +/// \file mln/core/internal/graph_psite_base.hh /// /// Base implementation for graph based psites. @@ -113,11 +113,11 @@ }; - /// Comparison of two mln::graph_psite_base<S,E> instances. - /// \{ /* FIXME: Shouldn't those comparisons be part of a much general mechanism? */ + /// Comparison of two mln::graph_psite_base<S,E> instances. + /// \{ /// \brief Is \a lhs equal to \a rhs? /// /// \pre Arguments \a lhs and \a rhs must belong to the same @@ -145,19 +145,10 @@ operator< (const graph_psite_base<S,E>& lhs, const graph_psite_base<S,E>& rhs); /// \} -} // end of namespace internal - - } // end of namespace mln - # ifndef MLN_INCLUDE_ONLY -namespace mln -{ - - namespace internal - { template <typename S, typename E> inline @@ -295,11 +286,12 @@ return lhs.id() < rhs.id(); } +# endif // ! MLN_INCLUDE_ONLY + } // end of namespace internal } // end of namespace mln -# endif // !MLN_INCLUDE_ONLY -#endif // !MLN_UTIL_INTERNAL_GRAPH_PSITE_BASE_HH +#endif // ! MLN_CORE_INTERNAL_GRAPH_PSITE_BASE_HH Property changes on: mln/core/internal/graph_psite_base.hh ___________________________________________________________________ Added: svn:mergeinfo Index: mln/util/all.hh --- mln/util/all.hh (revision 2888) +++ mln/util/all.hh (working copy) @@ -1,4 +1,5 @@ // Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -28,10 +29,9 @@ #ifndef MLN_UTIL_ALL_HH # define MLN_UTIL_ALL_HH -/*! \file mln/util/all.hh - * - * \brief File that includes all util-related routines. - */ +/// \file mln/util/all.hh +/// +/// File that includes all util-related routines. namespace mln @@ -52,6 +52,7 @@ # include <mln/util/branch_iter_ind.hh> # include <mln/util/dindex.hh> # include <mln/util/eat.hh> +# include <mln/util/edge.hh> # include <mln/util/graph.hh> # include <mln/util/greater_point.hh> # include <mln/util/greater_psite.hh> @@ -73,6 +74,7 @@ # include <mln/util/tree_fast_to_image.hh> # include <mln/util/tree_to_fast.hh> //# include <mln/util/tree_to_image.hh> +# include <mln/util/vertex.hh> # include <mln/util/yes.hh> #endif // ! MLN_UTIL_ALL_HH Index: mln/util/internal/graph_iter.hh --- mln/util/internal/graph_iter.hh (revision 2888) +++ mln/util/internal/graph_iter.hh (working copy) @@ -28,13 +28,15 @@ #ifndef MLN_UTIL_INTERNAL_GRAPH_ITER_HH # define MLN_UTIL_INTERNAL_GRAPH_ITER_HH -# include <mln/core/concept/iterator.hh> -# include <mln/util/internal/graph_vertex.hh> -# include <mln/util/internal/graph_edge.hh> +/// \file mln/util/internal/graph_iter.hh +/// +/// Implementation for graph iterators. + # include <mln/util/internal/graph_iter_base.hh> +# include <mln/util/vertex.hh> +# include <mln/util/edge.hh> + -/// \file mln/util/internal/graph_iter.hh -/// \brief Implementation for graph iterators. namespace mln { @@ -42,6 +44,8 @@ namespace internal { + /// Forward vertex iterator. + template<typename G> class vertex_fwd_iterator : public graph_iter_base<G, util::vertex<G>, vertex_fwd_iterator<G> > @@ -69,6 +73,8 @@ }; + /// Backward vertex iterator. + template<typename G> class vertex_bkd_iterator : public graph_iter_base<G, util::vertex<G>, vertex_bkd_iterator<G> > @@ -95,7 +101,9 @@ friend class graph_iter_base<G, util::vertex<G>, vertex_bkd_iterator<G> >; }; + /// Forward edge iterator. + template <typename G> class edge_fwd_iterator : public graph_iter_base<G, util::edge<G>, edge_fwd_iterator<G> > @@ -122,6 +130,9 @@ friend class graph_iter_base<G, util::edge<G>, edge_fwd_iterator<G> >; }; + + /// Backward edge iterator. + template <typename G> class edge_bkd_iterator : public graph_iter_base<G, util::edge<G>, edge_bkd_iterator<G> > @@ -150,8 +161,10 @@ + # ifndef MLN_INCLUDE_ONLY + /*--------------------` | vertex_fwd_iterator | \--------------------*/ @@ -296,5 +309,6 @@ } // end of namespace mln + #endif // ! MLN_UTIL_INTERNAL_GRAPH_ITER_HH Index: mln/util/internal/graph_base.hh --- mln/util/internal/graph_base.hh (revision 2888) +++ mln/util/internal/graph_base.hh (working copy) @@ -30,12 +30,11 @@ # define MLN_UTIL_INTERNAL_GRAPH_BASE_HH /// \file mln/util/internal/graph_base.hh -/// \brief Factored implementation of undirected graphs. +/// +/// Factored implementation of undirected graphs. # include <cstddef> - # include <algorithm> - # include <vector> # include <set> # include <ostream> @@ -45,8 +44,8 @@ # include <mln/core/concept/proxy.hh> # include <mln/core/internal/data.hh> -# include <mln/util/internal/graph_edge.hh> -# include <mln/util/internal/graph_vertex.hh> +# include <mln/util/edge.hh> +# include <mln/util/vertex.hh> # include <mln/util/ord_pair.hh> # include <mln/util/tracked_ptr.hh> Index: mln/util/internal/graph_iter_base.hh --- mln/util/internal/graph_iter_base.hh (revision 2888) +++ mln/util/internal/graph_iter_base.hh (working copy) @@ -37,7 +37,6 @@ # include <mln/core/concept/iterator.hh> # include <mln/core/concept/proxy.hh> -# include <mln/util/internal/graph_edge.hh> namespace mln Index: mln/util/edge.hh --- mln/util/edge.hh (revision 2888) +++ mln/util/edge.hh (working copy) @@ -25,10 +25,10 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_UTIL_INTERNAL_GRAPH_EDGE_HH -# define MLN_UTIL_INTERNAL_GRAPH_EDGE_HH +#ifndef MLN_UTIL_EDGE_HH +# define MLN_UTIL_EDGE_HH -/// \file mln/util/internal/graph_edge.hh +/// \file mln/util/edge.hh /// /// Definition of a graph edge. @@ -110,6 +110,7 @@ unsigned id_; }; + template <typename G> std::ostream& operator<<(std::ostream& ostr, const edge<G>& p); @@ -122,14 +123,16 @@ bool operator< (const edge<G>& lhs, const edge<G>& rhs); - } // End of namespace mln::util + } // end of namespace mln::util + - /// subject_impl specialization (Proxy) - /// \{ namespace internal { + /// subject_impl specialization (Proxy) + /// \{ + template <typename G, typename E> struct subject_impl< const util::edge<G>, E > { @@ -159,9 +162,11 @@ E& exact_(); }; - } // end of namespace mln::internal /// \} + } // end of namespace mln::internal + + # ifndef MLN_INCLUDE_ONLY @@ -290,6 +295,7 @@ } template <typename G> + inline std::ostream& operator<<(std::ostream& ostr, const edge<G>& p) { @@ -314,6 +320,8 @@ } // end of namespace mln::util + + namespace internal { @@ -422,11 +430,12 @@ return exact_().get_subject().invalidate(); } - } // End of namespace mln::internal + } // end of namespace mln::internal # endif // !MLN_INCLUDE_ONLY -} // End of namespace mln +} // end of namespace mln + -#endif // !MLN_UTIL_INTERNAL_GRAPH_EDGE_HH +#endif // ! MLN_UTIL_EDGE_HH Property changes on: mln/util/edge.hh ___________________________________________________________________ Added: svn:mergeinfo Index: mln/util/vertex.hh --- mln/util/vertex.hh (revision 2888) +++ mln/util/vertex.hh (working copy) @@ -25,12 +25,12 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_UTIL_INTERNAL_GRAPH_VERTEX_HH -# define MLN_UTIL_INTERNAL_GRAPH_VERTEX_HH +#ifndef MLN_UTIL_VERTEX_HH +# define MLN_UTIL_VERTEX_HH # include <mln/util/internal/graph_vertex_impl.hh> -/// \file mln/util/internal/graph_vertex.hh +/// \file mln/util/vertex.hh /// /// Implementation of a graph vertex. @@ -43,6 +43,7 @@ { /// Vertex of a graph \p G. + template<typename G> class vertex : public internal::vertex_impl_<G> { @@ -96,23 +97,35 @@ unsigned id_; }; - /// Comparison operator. Test whether two vertices have the same id. + + /// Push the vertex \p v in the output stream \p ostr. + template <typename G> + std::ostream& + operator<<(std::ostream& ostr, const vertex<G>& v); + + /// Equality operator. Test whether two vertices have the same + /// id. template<typename G> bool - operator==(const util::vertex<G>& v1, const util::vertex<G>& v2); + operator==(const vertex<G>& v1, const vertex<G>& v2); - /// Inferior operator. Test whether lhs.id() < rhs.id(). + + /// Less operator. Test whether lhs.id() < rhs.id(). template<typename G> bool - operator<(const util::vertex<G>& lhs, const util::vertex<G>& rhs); + operator<(const vertex<G>& lhs, const vertex<G>& rhs); + + + } // end of namespace mln::util - } // End of namespace mln::util -/// subject_impl specialization (Proxy) -/// \{ namespace internal { + + /// \{ + /// subject_impl specialization (Proxy) + template <typename G, typename E> struct subject_impl< const util::vertex<G>, E > { @@ -142,10 +155,13 @@ E& exact_(); }; + /// \} + } // end of namespace mln::internal -} // End of namespace mln -/// \} +} // end of namespace mln + + # ifndef MLN_INCLUDE_ONLY @@ -158,24 +174,6 @@ template<typename G> inline - bool - operator==(const util::vertex<G>& v1, const util::vertex<G>& v2) - { - return v1.id() == v2.id(); - } - - template<typename G> - inline - bool - operator<(const util::vertex<G>& lhs, const util::vertex<G>& rhs) - { - return lhs.id() < rhs.id(); - } - - - - template <typename G> - inline vertex<G>::vertex() { invalidate(); @@ -293,8 +291,34 @@ return id_; } + + template <typename G> + inline + std::ostream& + operator<<(std::ostream& ostr, const vertex<G>& v) + { + return ostr << v.id(); + } + + template<typename G> + inline + bool + operator==(const vertex<G>& v1, const vertex<G>& v2) + { + return v1.id() == v2.id(); + } + + template<typename G> + inline + bool + operator<(const vertex<G>& lhs, const vertex<G>& rhs) + { + return lhs.id() < rhs.id(); + } + } // end of namespace mln::util + namespace internal { @@ -406,10 +430,10 @@ } // end of namespace mln::internal -} // End of namespace mln +} // end of namespace mln # endif // !MLN_INCLUDE_ONLY -#endif // !MLN_UTIL_INTERNAL_GRAPH_VERTEX_HH +#endif // ! MLN_UTIL_VERTEX_HH Property changes on: mln/util/vertex.hh ___________________________________________________________________ Added: svn:mergeinfo
participants (1)
-
Thierry Geraud