1//=======================================================================
2// Copyright 2007 Aaron Windsor
3//
4// Distributed under the Boost Software License, Version 1.0. (See
5// accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//=======================================================================
8#ifndef __ADD_EDGE_VISITORS_HPP__
9#define __ADD_EDGE_VISITORS_HPP__
10
11#include <boost/property_map/property_map.hpp>
12
13namespace boost
14{
15
16 struct default_add_edge_visitor
17 {
18
19 template <typename Graph, typename Vertex>
20 void visit_vertex_pair(Vertex u, Vertex v, Graph& g)
21 {
22 add_edge(u,v,g);
23 }
24
25 };
26
27 template<typename EdgeIndexMap>
28 struct edge_index_update_visitor
29 {
30
31 typedef typename
32 property_traits<EdgeIndexMap>::value_type edge_index_value_t;
33
34 edge_index_update_visitor(EdgeIndexMap em,
35 edge_index_value_t next_index_available
36 ) :
37 m_em(em),
38 m_next_index(next_index_available)
39 {}
40
41 template <typename Graph, typename Vertex>
42 void visit_vertex_pair(Vertex u, Vertex v, Graph& g)
43 {
44 typedef typename graph_traits<Graph>::edge_descriptor edge_t;
45 std::pair<edge_t, bool> return_value = add_edge(u,v,g);
46 if (return_value.second)
47 put( m_em, return_value.first, m_next_index++);
48 }
49
50 private:
51
52 EdgeIndexMap m_em;
53 edge_index_value_t m_next_index;
54
55 };
56
57} // namespace boost
58
59#endif //__ADD_EDGE_VISITORS_HPP__
60

source code of boost/boost/graph/planar_detail/add_edge_visitors.hpp