1 | //
|
---|
2 | //=======================================================================
|
---|
3 | // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
|
---|
4 | // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
|
---|
5 | //
|
---|
6 | // Distributed under the Boost Software License, Version 1.0. (See
|
---|
7 | // accompanying file LICENSE_1_0.txt or copy at
|
---|
8 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
9 | //=======================================================================
|
---|
10 |
|
---|
11 | #ifndef BOOST_GRAPH_DETAIL_EDGE_HPP
|
---|
12 | #define BOOST_GRAPH_DETAIL_EDGE_HPP
|
---|
13 |
|
---|
14 | #if __GNUC__ < 3
|
---|
15 | #include <iostream>
|
---|
16 | #else
|
---|
17 | #include <iosfwd>
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | namespace boost {
|
---|
21 |
|
---|
22 | namespace detail {
|
---|
23 |
|
---|
24 | template <typename Directed, typename Vertex>
|
---|
25 | struct edge_base
|
---|
26 | {
|
---|
27 | inline edge_base() {}
|
---|
28 | inline edge_base(Vertex s, Vertex d)
|
---|
29 | : m_source(s), m_target(d) { }
|
---|
30 | Vertex m_source;
|
---|
31 | Vertex m_target;
|
---|
32 | };
|
---|
33 |
|
---|
34 | template <typename Directed, typename Vertex>
|
---|
35 | class edge_desc_impl : public edge_base<Directed,Vertex> {
|
---|
36 | typedef edge_desc_impl self;
|
---|
37 | typedef edge_base<Directed,Vertex> Base;
|
---|
38 | public:
|
---|
39 | typedef void property_type;
|
---|
40 |
|
---|
41 | inline edge_desc_impl() : m_eproperty(0) {}
|
---|
42 |
|
---|
43 | inline edge_desc_impl(Vertex s, Vertex d, const property_type* eplug)
|
---|
44 | : Base(s,d), m_eproperty(const_cast<property_type*>(eplug)) { }
|
---|
45 |
|
---|
46 | property_type* get_property() { return m_eproperty; }
|
---|
47 | const property_type* get_property() const { return m_eproperty; }
|
---|
48 |
|
---|
49 | // protected:
|
---|
50 | property_type* m_eproperty;
|
---|
51 | };
|
---|
52 |
|
---|
53 | template <class D, class V>
|
---|
54 | inline bool
|
---|
55 | operator==(const detail::edge_desc_impl<D,V>& a,
|
---|
56 | const detail::edge_desc_impl<D,V>& b)
|
---|
57 | {
|
---|
58 | return a.get_property() == b.get_property();
|
---|
59 | }
|
---|
60 | template <class D, class V>
|
---|
61 | inline bool
|
---|
62 | operator!=(const detail::edge_desc_impl<D,V>& a,
|
---|
63 | const detail::edge_desc_impl<D,V>& b)
|
---|
64 | {
|
---|
65 | return ! (a.get_property() == b.get_property());
|
---|
66 | }
|
---|
67 |
|
---|
68 | } //namespace detail
|
---|
69 |
|
---|
70 | } // namespace boost
|
---|
71 |
|
---|
72 | namespace std {
|
---|
73 |
|
---|
74 | #if __GNUC__ < 3
|
---|
75 | template <class D, class V>
|
---|
76 | std::ostream&
|
---|
77 | operator<<(std::ostream& os, const boost::detail::edge_desc_impl<D,V>& e)
|
---|
78 | {
|
---|
79 | return os << "(" << e.m_source << "," << e.m_target << ")";
|
---|
80 | }
|
---|
81 | #else
|
---|
82 | template <class Char, class Traits, class D, class V>
|
---|
83 | std::basic_ostream<Char, Traits>&
|
---|
84 | operator<<(std::basic_ostream<Char, Traits>& os,
|
---|
85 | const boost::detail::edge_desc_impl<D,V>& e)
|
---|
86 | {
|
---|
87 | return os << "(" << e.m_source << "," << e.m_target << ")";
|
---|
88 | }
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | }
|
---|
92 |
|
---|
93 |
|
---|
94 | #endif // BOOST_GRAPH_DETAIL_DETAIL_EDGE_HPP
|
---|