Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 // Copyright 2005 The Trustees of Indiana University.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 // Authors: Jeremiah Willcock
11 // Indexed properties -- used for CSR and CSR-like graphs
13 #ifndef BOOST_GRAPH_INDEXED_PROPERTIES_HPP
14 #define BOOST_GRAPH_INDEXED_PROPERTIES_HPP
21 #include <boost/graph/graph_traits.hpp>
22 #include <boost/graph/properties.hpp>
23 #include <boost/iterator/counting_iterator.hpp>
24 #include <boost/integer.hpp>
25 #include <boost/iterator/iterator_facade.hpp>
26 #include <boost/mpl/if.hpp>
31 template<typename Derived, typename Property, typename Descriptor>
32 class indexed_vertex_properties
35 typedef no_property vertex_property_type;
36 typedef Property vertex_bundled;
38 // Directly access a vertex or edge bundle
39 Property& operator[](Descriptor v)
40 { return m_vertex_properties[get(vertex_index, derived(), v)]; }
42 const Property& operator[](Descriptor v) const
43 { return m_vertex_properties[get(vertex_index, derived(), v)]; }
46 // Default-construct with no property values
47 indexed_vertex_properties() {}
49 // Initialize with n default-constructed property values
50 indexed_vertex_properties(std::size_t n) : m_vertex_properties(n) { }
52 // Resize the properties vector
53 void resize(std::size_t n)
55 m_vertex_properties.resize(n);
58 // Reserve space in the vector of properties
59 void reserve(std::size_t n)
61 m_vertex_properties.reserve(n);
64 // Add a new property value to the back
65 void push_back(const Property& prop)
67 m_vertex_properties.push_back(prop);
70 // Access to the derived object
71 Derived& derived() { return *static_cast<Derived*>(this); }
73 const Derived& derived() const
74 { return *static_cast<const Derived*>(this); }
76 public: // should be private, but friend templates not portable
77 std::vector<Property> m_vertex_properties;
80 template<typename Derived, typename Descriptor>
81 class indexed_vertex_properties<Derived, void, Descriptor>
86 typedef no_property vertex_property_type;
87 typedef void vertex_bundled;
89 secret operator[](secret) { return secret(); }
92 // All operations do nothing.
93 indexed_vertex_properties() { }
94 indexed_vertex_properties(std::size_t) { }
95 void resize(std::size_t) { }
96 void reserve(std::size_t) { }
99 template<typename Derived, typename Property, typename Descriptor>
100 class indexed_edge_properties
103 typedef no_property edge_property_type;
104 typedef Property edge_bundled;
105 typedef Property edge_push_back_type;
107 // Directly access a edge or edge bundle
108 Property& operator[](Descriptor v)
109 { return m_edge_properties[get(edge_index, derived(), v)]; }
111 const Property& operator[](Descriptor v) const
112 { return m_edge_properties[get(edge_index, derived(), v)]; }
115 // Default-construct with no property values
116 indexed_edge_properties() {}
118 // Initialize with n default-constructed property values
119 indexed_edge_properties(std::size_t n) : m_edge_properties(n) { }
121 // Resize the properties vector
122 void resize(std::size_t n)
124 m_edge_properties.resize(n);
127 // Reserve space in the vector of properties
128 void reserve(std::size_t n)
130 m_edge_properties.reserve(n);
134 // Add a new property value to the back
135 void push_back(const Property& prop)
137 m_edge_properties.push_back(prop);
141 // Access to the derived object
142 Derived& derived() { return *static_cast<Derived*>(this); }
144 const Derived& derived() const
145 { return *static_cast<const Derived*>(this); }
147 public: // should be private, but friend templates not portable
148 std::vector<Property> m_edge_properties;
151 template<typename Derived, typename Descriptor>
152 class indexed_edge_properties<Derived, void, Descriptor>
157 typedef no_property edge_property_type;
158 typedef void edge_bundled;
159 typedef void* edge_push_back_type;
161 secret operator[](secret) { return secret(); }
164 // All operations do nothing.
165 indexed_edge_properties() { }
166 indexed_edge_properties(std::size_t) { }
167 void resize(std::size_t) { }
168 void reserve(std::size_t) { }
171 void push_back(const edge_push_back_type&) { }
177 #endif // BOOST_GRAPH_INDEXED_PROPERTIES_HPP