// (C) Copyright 2007-2009 Andrew Sutton // // Use, modification and distribution are subject to the // Boost Software License, Version 1.0 (See accompanying file // LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GRAPH_DETAIL_INDEX_HPP #define BOOST_GRAPH_DETAIL_INDEX_HPP #include // The structures in this module are responsible for selecting and defining // types for accessing a builting index map. Note that the selection of these // types requires the Graph parameter to model either VertexIndexGraph or // EdgeIndexGraph. namespace boost { namespace detail { template struct vertex_indexer { typedef vertex_index_t index_type; typedef typename property_map::type map_type; typedef typename property_map::const_type const_map_type; typedef typename property_traits::value_type value_type; typedef typename graph_traits::vertex_descriptor key_type; static const_map_type index_map(const Graph& g) { return get(vertex_index, g); } static map_type index_map(Graph& g) { return get(vertex_index, g); } static value_type index(key_type k, const Graph& g) { return get(vertex_index, g, k); } }; template struct edge_indexer { typedef edge_index_t index_type; typedef typename property_map::type map_type; typedef typename property_map::const_type const_map_type; typedef typename property_traits::value_type value_type; typedef typename graph_traits::edge_descriptor key_type; static const_map_type index_map(const Graph& g) { return get(edge_index, g); } static map_type index_map(Graph& g) { return get(edge_index, g); } static value_type index(key_type k, const Graph& g) { return get(edge_index, g, k); } }; // NOTE: The Graph parameter MUST be a model of VertexIndexGraph or // VertexEdgeGraph - whichever type Key is selecting. template struct choose_indexer { typedef typename mpl::if_< is_same::vertex_descriptor>, vertex_indexer, edge_indexer >::type indexer_type; typedef typename indexer_type::index_type index_type; }; } } #endif