Chris@16: // Copyright 2008-2010 Gordon Woodhull Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // mpl_graph - defines a metadata implementation of the BGL immutable graph concepts Chris@16: Chris@16: // (c) 2008 Gordon Woodhull Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSEmpl::_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSEmpl::_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_MSM_MPL_GRAPH_MPL_GRAPH_HPP_INCLUDED Chris@16: #define BOOST_MSM_MPL_GRAPH_MPL_GRAPH_HPP_INCLUDED Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace msm { Chris@16: namespace mpl_graph { Chris@16: Chris@16: // Boost Graph concepts, MPL style Chris@16: Chris@16: // The metafunctions of the public interface rely Chris@16: // metafunctions in the graph implementation to transform the input Chris@16: // into the maps which are required to deliver results. Since the Chris@16: // maps are produced lazily and are memoized, all of the graph Chris@16: // concepts can be supported with no cost until they are actually Chris@16: // used. Chris@16: Chris@16: // Each of these dispatch to the correct producer metafunctions based Chris@16: // on the representation inner type tag Chris@16: Chris@16: Chris@16: Chris@16: // IncidenceGraph Chris@16: template Chris@16: struct source : Chris@16: mpl::first::type,Edge>::type> Chris@16: {}; Chris@16: template Chris@16: struct target : Chris@16: mpl::second::type,Edge>::type> Chris@16: {}; Chris@16: template Chris@16: struct out_edges : Chris@16: mpl::fold::type, Chris@16: mpl::vector<>, Chris@16: mpl::push_back > > Chris@16: {}; Chris@16: template Chris@16: struct out_degree : Chris@16: mpl::size::type> Chris@16: {}; Chris@16: Chris@16: // BidirectionalGraph Chris@16: template Chris@16: struct in_edges : Chris@16: mpl::fold::type, Chris@16: mpl::vector<>, Chris@16: mpl::push_back > > Chris@16: {}; Chris@16: template Chris@16: struct in_degree : Chris@16: mpl::size::type> Chris@16: {}; Chris@16: template Chris@16: struct degree : Chris@16: mpl::plus::type,typename in_degree::type> Chris@16: {}; Chris@16: Chris@16: // AdjacencyGraph Chris@16: template Chris@16: struct adjacent_vertices : Chris@16: mpl::transform::type, Chris@16: mpl::second, Chris@16: mpl::back_inserter > > Chris@16: {}; Chris@16: Chris@16: // VertexListGraph Chris@16: template Chris@16: struct vertices : Chris@16: detail::produce_vertex_set Chris@16: {}; Chris@16: template Chris@16: struct num_vertices : Chris@16: mpl::size::type> Chris@16: {}; Chris@16: Chris@16: // EdgeListGraph Chris@16: template Chris@16: struct edges : Chris@16: detail::produce_edge_set Chris@16: {}; Chris@16: template Chris@16: struct num_edges : Chris@16: mpl::size::type> Chris@16: {}; Chris@16: // source and target are defined in IncidenceGraph Chris@16: Chris@16: } // mpl_graph Chris@16: } // msm Chris@16: } // boost Chris@16: Chris@16: #endif // BOOST_MSM_MPL_GRAPH_MPL_GRAPH_HPP_INCLUDED