|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49857 - sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es
From: asutton_at_[hidden]
Date: 2008-11-21 08:31:36
Author: asutton
Date: 2008-11-21 08:31:35 EST (Fri, 21 Nov 2008)
New Revision: 49857
URL: http://svn.boost.org/trac/boost/changeset/49857
Log:
Renaming edge implementation files
Added:
sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/assoc_edge.hpp (contents, props changed)
- copied, changed from r49849, /sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/association.hpp
sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/seq_edge.hpp (contents, props changed)
- copied, changed from r49849, /sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/sequence.hpp
Removed:
sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/association.hpp
sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/sequence.hpp
Text files modified:
sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/assoc_edge.hpp | 29 ++++++++++++++++++++++++++++-
sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/seq_edge.hpp | 23 ++++++++++++++++++++++-
2 files changed, 50 insertions(+), 2 deletions(-)
Copied: sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/assoc_edge.hpp (from r49849, /sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/association.hpp)
==============================================================================
--- /sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/association.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/assoc_edge.hpp 2008-11-21 08:31:35 EST (Fri, 21 Nov 2008)
@@ -4,6 +4,11 @@
namespace boost { namespace graphs {
+// NOTE: The code in this module is identical to that in sequence.hpp except
+// for the fact that the edge pair is const. Is there a graceful way to get
+// around this? Probably, but it might involve pushing more code through traits
+// classes.
+
// Specializations to support labels for undirected edges for edge vectors,
// and lists.
@@ -30,9 +35,31 @@
template <typename VertexDesc, typename EdgeLabel>
struct edge_traits<std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel>>
{
- typedef std::pair<VertexDesc, VertexDesc> end_pair;
+ typedef VertexDesc vertex_descriptor;
+ typedef std::pair<VertexDesc, VertexDesc> edge_ends;
};
+template <typename VertexDesc, typename EdgeLabel>
+inline std::pair<VertexDesc, VertexDesc>
+ends(std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel> const& edge)
+{ return edge.first; }
+
+template <typename VertexDesc, typename EdgeLabel>
+inline VertexDesc
+first(std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel> const& edge)
+{ return edge.first.first; }
+
+template <typename VertexDesc, typename EdgeLabel>
+inline VertexDesc
+second(std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel> const& edge)
+{ return edge.first.second; }
+
+template <typename VertexDesc, typename EdgeLabel>
+inline VertexDesc
+oppposite(std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel> const& edge, VertexDesc which)
+{ return which == first(edge) ? second(edge) : first(edge); }
+
+
} } /* namespace boost::graphs */
#endif
Deleted: sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/association.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/association.hpp 2008-11-21 08:31:35 EST (Fri, 21 Nov 2008)
+++ (empty file)
@@ -1,38 +0,0 @@
-
-#ifndef BOOST_GRAPHS_ADJLIST_ES_ASSOCIATION_HPP
-#define BOOST_GRAPHS_ADJLIST_ES_ASSOCIATION_HPP
-
-namespace boost { namespace graphs {
-
-// Specializations to support labels for undirected edges for edge vectors,
-// and lists.
-
-template <typename VertexDesc, typename EdgeLabel>
-struct label_traits<std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel>>
-{
- typedef EdgeLabel label_type;
-};
-
-template <typename VertexDesc, typename EdgeLabel>
-inline EdgeLabel&
-label(std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel>& edge)
-{ return edge.second; }
-
-template <typename VertexDesc, typename EdgeLabel>
-inline EdgeLabel const&
-label(std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel> const& edge)
-{ return edge.second; }
-
-// Specializations of the edge interface for edge sequences (vectors and lists).
-
-// NOTE: I'm un-consting the key type for an associative container. Will this
-// cause problems later? Possibly.
-template <typename VertexDesc, typename EdgeLabel>
-struct edge_traits<std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel>>
-{
- typedef std::pair<VertexDesc, VertexDesc> end_pair;
-};
-
-} } /* namespace boost::graphs */
-
-#endif
Copied: sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/seq_edge.hpp (from r49849, /sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/sequence.hpp)
==============================================================================
--- /sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/sequence.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/seq_edge.hpp 2008-11-21 08:31:35 EST (Fri, 21 Nov 2008)
@@ -33,9 +33,30 @@
template <typename VertexDesc, typename EdgeLabel>
struct edge_traits<std::pair<std::pair<VertexDesc, VertexDesc>, EdgeLabel>>
{
- typedef std::pair<VertexDesc, VertexDesc> end_pair;
+ typedef VertexDesc vertex_descriptor;
+ typedef std::pair<VertexDesc, VertexDesc> edge_ends;
};
} } /* namespace boost::graphs */
+template <typename VertexDesc, typename EdgeLabel>
+inline EdgeLabel const&
+ends(std::pair<std::pair<VertexDesc, VertexDesc>, EdgeLabel> const& edge)
+{ return edge.first; }
+
+template <typename VertexDesc, typename EdgeLabel>
+inline VertexDesc
+first(std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel> const& edge)
+{ return edge.first.first; }
+
+template <typename VertexDesc, typename EdgeLabel>
+inline VertexDesc
+second(std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel> const& edge)
+{ return edge.first.second; }
+
+template <typename VertexDesc, typename EdgeLabel>
+inline VertexDesc
+oppposite(std::pair<std::pair<VertexDesc, VertexDesc> const, EdgeLabel> const& edge, VertexDesc which)
+{ return which == first(edge) ? second(edge) : first(edge); }
+
#endif
Deleted: sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/sequence.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/libs/graphs/include/boost/graphs/adjacency_list/es/sequence.hpp 2008-11-21 08:31:35 EST (Fri, 21 Nov 2008)
+++ (empty file)
@@ -1,41 +0,0 @@
-
-#ifndef BOOST_GRAPHS_ADJLIST_ES_SEQUENCE_HPP
-#define BOOST_GRAPHS_ADJLIST_ES_SEQUENCE_HPP
-
-namespace boost { namespace graphs {
-
-// Specializations to support labels for undirected edges for edge vectors,
-// and lists.
-
-// TODO: I'm a little worried about the possibility of type collisions with
-// directed graphs. It would be nice if I could specialize on an extra piece
-// of information here. Also, the difference between this and associative
-// specializations is the const-ness of the ends.
-
-template <typename VertexDesc, typename EdgeLabel>
-struct label_traits<std::pair<std::pair<VertexDesc, VertexDesc>, EdgeLabel>>
-{
- typedef EdgeLabel label_type;
-};
-
-template <typename VertexDesc, typename EdgeLabel>
-inline EdgeLabel&
-label(std::pair<std::pair<VertexDesc, VertexDesc>, EdgeLabel>& edge)
-{ return edge.second; }
-
-template <typename VertexDesc, typename EdgeLabel>
-inline EdgeLabel const&
-label(std::pair<std::pair<VertexDesc, VertexDesc>, EdgeLabel> const& edge)
-{ return edge.second; }
-
-// Specializations of the edge interface for edge sequences (vectors and lists).
-
-template <typename VertexDesc, typename EdgeLabel>
-struct edge_traits<std::pair<std::pair<VertexDesc, VertexDesc>, EdgeLabel>>
-{
- typedef std::pair<VertexDesc, VertexDesc> end_pair;
-};
-
-} } /* namespace boost::graphs */
-
-#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk