Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
2 //=======================================================================
3 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
4 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
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 //=======================================================================
11 #ifndef BOOST_GRAPH_CONCEPTS_HPP
12 #define BOOST_GRAPH_CONCEPTS_HPP
14 #include <boost/config.hpp>
15 #include <boost/graph/graph_traits.hpp>
16 #include <boost/property_map.hpp>
17 #include <boost/graph/properties.hpp>
18 #include <boost/concept_check.hpp>
19 #include <boost/detail/workaround.hpp>
24 struct MultiPassInputIteratorConcept {
26 function_requires< InputIteratorConcept<T> >();
33 typedef typename graph_traits<G>::vertex_descriptor vertex_descriptor;
34 typedef typename graph_traits<G>::directed_category directed_category;
35 typedef typename graph_traits<G>::edge_parallel_category
36 edge_parallel_category;
37 typedef typename graph_traits<G>::traversal_category
40 function_requires< DefaultConstructibleConcept<vertex_descriptor> >();
41 function_requires< EqualityComparableConcept<vertex_descriptor> >();
42 function_requires< AssignableConcept<vertex_descriptor> >();
48 struct IncidenceGraphConcept
50 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
51 typedef typename graph_traits<G>::out_edge_iterator
53 typedef typename graph_traits<G>::traversal_category
56 function_requires< GraphConcept<G> >();
57 function_requires< MultiPassInputIteratorConcept<out_edge_iterator> >();
58 function_requires< DefaultConstructibleConcept<edge_descriptor> >();
59 function_requires< EqualityComparableConcept<edge_descriptor> >();
60 function_requires< AssignableConcept<edge_descriptor> >();
61 function_requires< ConvertibleConcept<traversal_category,
62 incidence_graph_tag> >();
71 void const_constraints(const G& cg) {
73 n = out_degree(u, cg);
78 std::pair<out_edge_iterator, out_edge_iterator> p;
79 typename graph_traits<G>::vertex_descriptor u, v;
80 typename graph_traits<G>::edge_descriptor e;
81 typename graph_traits<G>::degree_size_type n;
86 struct BidirectionalGraphConcept
88 typedef typename graph_traits<G>::in_edge_iterator
90 typedef typename graph_traits<G>::traversal_category
93 function_requires< IncidenceGraphConcept<G> >();
94 function_requires< MultiPassInputIteratorConcept<in_edge_iterator> >();
95 function_requires< ConvertibleConcept<traversal_category,
96 bidirectional_graph_tag> >();
101 const_constraints(g);
103 void const_constraints(const G& cg) {
105 n = in_degree(v, cg);
108 std::pair<in_edge_iterator, in_edge_iterator> p;
109 typename graph_traits<G>::vertex_descriptor v;
110 typename graph_traits<G>::edge_descriptor e;
111 typename graph_traits<G>::degree_size_type n;
116 struct AdjacencyGraphConcept
118 typedef typename graph_traits<G>::adjacency_iterator
120 typedef typename graph_traits<G>::traversal_category
123 function_requires< GraphConcept<G> >();
124 function_requires< MultiPassInputIteratorConcept<adjacency_iterator> >();
125 function_requires< ConvertibleConcept<traversal_category,
126 adjacency_graph_tag> >();
128 p = adjacent_vertices(v, g);
130 const_constraints(g);
132 void const_constraints(const G& cg) {
133 p = adjacent_vertices(v, cg);
135 std::pair<adjacency_iterator,adjacency_iterator> p;
136 typename graph_traits<G>::vertex_descriptor v;
140 // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
141 // you want to use vector_as_graph, it is! I'm sure the graph
142 // library leaves these out all over the place. Probably a
143 // redesign involving specializing a template with a static
144 // member function is in order :(
146 // It is needed in order to allow us to write using boost::vertices as
147 // needed for ADL when using vector_as_graph below.
148 #if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) \
149 && !BOOST_WORKAROUND(__GNUC__, <= 2) \
150 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
151 # define BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
154 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
156 typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
160 struct VertexListGraphConcept
162 typedef typename graph_traits<G>::vertex_iterator vertex_iterator;
163 typedef typename graph_traits<G>::vertices_size_type vertices_size_type;
164 typedef typename graph_traits<G>::traversal_category
167 function_requires< GraphConcept<G> >();
168 function_requires< MultiPassInputIteratorConcept<vertex_iterator> >();
169 function_requires< ConvertibleConcept<traversal_category,
170 vertex_list_graph_tag> >();
172 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
173 // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
174 // you want to use vector_as_graph, it is! I'm sure the graph
175 // library leaves these out all over the place. Probably a
176 // redesign involving specializing a template with a static
177 // member function is in order :(
178 using boost::vertices;
182 const_constraints(g);
184 void const_constraints(const G& cg) {
185 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
186 // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
187 // you want to use vector_as_graph, it is! I'm sure the graph
188 // library leaves these out all over the place. Probably a
189 // redesign involving specializing a template with a static
190 // member function is in order :(
191 using boost::vertices;
196 V = num_vertices(cg);
198 std::pair<vertex_iterator,vertex_iterator> p;
199 typename graph_traits<G>::vertex_descriptor v;
201 vertices_size_type V;
205 struct EdgeListGraphConcept
207 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
208 typedef typename graph_traits<G>::edge_iterator edge_iterator;
209 typedef typename graph_traits<G>::edges_size_type edges_size_type;
210 typedef typename graph_traits<G>::traversal_category
213 function_requires< GraphConcept<G> >();
214 function_requires< MultiPassInputIteratorConcept<edge_iterator> >();
215 function_requires< DefaultConstructibleConcept<edge_descriptor> >();
216 function_requires< EqualityComparableConcept<edge_descriptor> >();
217 function_requires< AssignableConcept<edge_descriptor> >();
218 function_requires< ConvertibleConcept<traversal_category,
219 edge_list_graph_tag> >();
225 const_constraints(g);
227 void const_constraints(const G& cg) {
234 std::pair<edge_iterator,edge_iterator> p;
235 typename graph_traits<G>::vertex_descriptor u, v;
236 typename graph_traits<G>::edge_descriptor e;
242 struct VertexAndEdgeListGraphConcept
245 function_requires< VertexListGraphConcept<G> >();
246 function_requires< EdgeListGraphConcept<G> >();
250 // Where to put the requirement for this constructor?
252 // Not in mutable graph, then LEDA graph's can't be models of
256 struct EdgeMutableGraphConcept
258 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
260 p = add_edge(u, v, g);
261 remove_edge(u, v, g);
267 std::pair<edge_descriptor, bool> p;
268 typename graph_traits<G>::vertex_descriptor u, v;
272 struct VertexMutableGraphConcept
279 typename graph_traits<G>::vertex_descriptor u, v;
283 struct MutableGraphConcept
286 function_requires< EdgeMutableGraphConcept<G> >();
287 function_requires< VertexMutableGraphConcept<G> >();
291 template <class edge_descriptor>
292 struct dummy_edge_predicate {
293 bool operator()(const edge_descriptor&) const {
299 struct MutableIncidenceGraphConcept
302 function_requires< MutableGraphConcept<G> >();
303 remove_edge(iter, g);
304 remove_out_edge_if(u, p, g);
307 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
308 dummy_edge_predicate<edge_descriptor> p;
309 typename boost::graph_traits<G>::vertex_descriptor u;
310 typename boost::graph_traits<G>::out_edge_iterator iter;
314 struct MutableBidirectionalGraphConcept
317 function_requires< MutableIncidenceGraphConcept<G> >();
318 remove_in_edge_if(u, p, g);
321 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
322 dummy_edge_predicate<edge_descriptor> p;
323 typename boost::graph_traits<G>::vertex_descriptor u;
327 struct MutableEdgeListGraphConcept
330 function_requires< EdgeMutableGraphConcept<G> >();
331 remove_edge_if(p, g);
334 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
335 dummy_edge_predicate<edge_descriptor> p;
339 struct VertexMutablePropertyGraphConcept
342 function_requires< VertexMutableGraphConcept<G> >();
343 v = add_vertex(vp, g);
346 typename graph_traits<G>::vertex_descriptor v;
347 typename vertex_property<G>::type vp;
351 struct EdgeMutablePropertyGraphConcept
353 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
355 function_requires< EdgeMutableGraphConcept<G> >();
356 p = add_edge(u, v, ep, g);
359 std::pair<edge_descriptor, bool> p;
360 typename graph_traits<G>::vertex_descriptor u, v;
361 typename edge_property<G>::type ep;
365 struct AdjacencyMatrixConcept
367 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
369 function_requires< GraphConcept<G> >();
372 const_constraints(g);
374 void const_constraints(const G& cg) {
377 typename graph_traits<G>::vertex_descriptor u, v;
378 std::pair<edge_descriptor, bool> p;
382 template <class G, class X, class Property>
383 struct ReadablePropertyGraphConcept
385 typedef typename property_map<G, Property>::const_type const_Map;
387 function_requires< GraphConcept<G> >();
388 function_requires< ReadablePropertyMapConcept<const_Map, X> >();
390 const_constraints(g);
392 void const_constraints(const G& cg) {
393 const_Map pmap = get(Property(), cg);
394 pval = get(Property(), cg, x);
395 ignore_unused_variable_warning(pmap);
399 typename property_traits<const_Map>::value_type pval;
402 template <class G, class X, class Property>
403 struct PropertyGraphConcept
405 typedef typename property_map<G, Property>::type Map;
407 function_requires< ReadablePropertyGraphConcept<G, X, Property> >();
408 function_requires< ReadWritePropertyMapConcept<Map, X> >();
410 Map pmap = get(Property(), g);
411 pval = get(Property(), g, x);
412 put(Property(), g, x, pval);
413 ignore_unused_variable_warning(pmap);
417 typename property_traits<Map>::value_type pval;
420 template <class G, class X, class Property>
421 struct LvaluePropertyGraphConcept
423 typedef typename property_map<G, Property>::type Map;
424 typedef typename property_map<G, Property>::const_type const_Map;
426 function_requires< ReadablePropertyGraphConcept<G, X, Property> >();
427 function_requires< LvaluePropertyMapConcept<const_Map, X> >();
429 pval = get(Property(), g, x);
430 put(Property(), g, x, pval);
434 typename property_traits<Map>::value_type pval;
437 // This needs to move out of the graph library
444 typename B::value_type& v = b.top();
445 const_constraints(b);
446 ignore_unused_variable_warning(v);
448 void const_constraints(const B& cb) {
449 const typename B::value_type& v = cb.top();
452 ignore_unused_variable_warning(v);
453 ignore_unused_variable_warning(e);
455 typename B::size_type n;
456 typename B::value_type t;
461 struct ColorValueConcept
464 function_requires< EqualityComparableConcept<C> >();
465 function_requires< DefaultConstructibleConcept<C> >();
467 c = color_traits<C>::white();
468 c = color_traits<C>::gray();
469 c = color_traits<C>::black();
474 template <class M, class I, class V>
475 struct BasicMatrixConcept
479 const_constraints(A);
480 ignore_unused_variable_warning(elt);
482 void const_constraints(const M& cA) {
483 const V& elt = cA[i][j];
484 ignore_unused_variable_warning(elt);
492 #endif /* BOOST_GRAPH_CONCEPTS_H */