Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/graph/detail/edge.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
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 // Order edges according to the address of their property object | |
69 template <class D, class V> | |
70 inline bool | |
71 operator<(const detail::edge_desc_impl<D,V>& a, | |
72 const detail::edge_desc_impl<D,V>& b) | |
73 { | |
74 return a.get_property() < b.get_property(); | |
75 } | |
76 template <class D, class V> | |
77 inline bool | |
78 operator<=(const detail::edge_desc_impl<D,V>& a, | |
79 const detail::edge_desc_impl<D,V>& b) | |
80 { | |
81 return a.get_property() <= b.get_property(); | |
82 } | |
83 template <class D, class V> | |
84 inline bool | |
85 operator>(const detail::edge_desc_impl<D,V>& a, | |
86 const detail::edge_desc_impl<D,V>& b) | |
87 { | |
88 return a.get_property() > b.get_property(); | |
89 } | |
90 template <class D, class V> | |
91 inline bool | |
92 operator>=(const detail::edge_desc_impl<D,V>& a, | |
93 const detail::edge_desc_impl<D,V>& b) | |
94 { | |
95 return a.get_property() >= b.get_property(); | |
96 } | |
97 | |
98 } //namespace detail | |
99 | |
100 } // namespace boost | |
101 | |
102 namespace std { | |
103 | |
104 #if __GNUC__ < 3 | |
105 template <class D, class V> | |
106 std::ostream& | |
107 operator<<(std::ostream& os, const boost::detail::edge_desc_impl<D,V>& e) | |
108 { | |
109 return os << "(" << e.m_source << "," << e.m_target << ")"; | |
110 } | |
111 #else | |
112 template <class Char, class Traits, class D, class V> | |
113 std::basic_ostream<Char, Traits>& | |
114 operator<<(std::basic_ostream<Char, Traits>& os, | |
115 const boost::detail::edge_desc_impl<D,V>& e) | |
116 { | |
117 return os << "(" << e.m_source << "," << e.m_target << ")"; | |
118 } | |
119 #endif | |
120 | |
121 } | |
122 | |
123 | |
124 #endif // BOOST_GRAPH_DETAIL_DETAIL_EDGE_HPP |