annotate DEPENDENCIES/generic/include/boost/msm/mpl_graph/mpl_graph.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright 2008-2010 Gordon Woodhull
Chris@16 2 // Distributed under the Boost Software License, Version 1.0.
Chris@16 3 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 4
Chris@16 5 // mpl_graph - defines a metadata implementation of the BGL immutable graph concepts
Chris@16 6
Chris@16 7 // (c) 2008 Gordon Woodhull
Chris@16 8 // Distributed under the Boost Software License, Version 1.0.
Chris@16 9 // (See accompanying file LICENSEmpl::_1_0.txt or copy at
Chris@16 10 // http://www.boost.org/LICENSEmpl::_1_0.txt)
Chris@16 11
Chris@16 12 #ifndef BOOST_MSM_MPL_GRAPH_MPL_GRAPH_HPP_INCLUDED
Chris@16 13 #define BOOST_MSM_MPL_GRAPH_MPL_GRAPH_HPP_INCLUDED
Chris@16 14
Chris@16 15 #include <boost/msm/mpl_graph/detail/graph_implementation_interface.ipp>
Chris@16 16
Chris@16 17 #include <boost/mpl/vector.hpp>
Chris@16 18 #include <boost/mpl/pair.hpp>
Chris@16 19 #include <boost/mpl/fold.hpp>
Chris@16 20 #include <boost/mpl/push_back.hpp>
Chris@16 21 #include <boost/mpl/at.hpp>
Chris@16 22 #include <boost/mpl/size.hpp>
Chris@16 23 #include <boost/mpl/plus.hpp>
Chris@16 24 #include <boost/mpl/transform.hpp>
Chris@16 25 #include <boost/mpl/back_inserter.hpp>
Chris@16 26
Chris@16 27 namespace boost {
Chris@16 28 namespace msm {
Chris@16 29 namespace mpl_graph {
Chris@16 30
Chris@16 31 // Boost Graph concepts, MPL style
Chris@16 32
Chris@16 33 // The metafunctions of the public interface rely
Chris@16 34 // metafunctions in the graph implementation to transform the input
Chris@16 35 // into the maps which are required to deliver results. Since the
Chris@16 36 // maps are produced lazily and are memoized, all of the graph
Chris@16 37 // concepts can be supported with no cost until they are actually
Chris@16 38 // used.
Chris@16 39
Chris@16 40 // Each of these dispatch to the correct producer metafunctions based
Chris@16 41 // on the representation inner type tag
Chris@16 42
Chris@16 43
Chris@16 44
Chris@16 45 // IncidenceGraph
Chris@16 46 template<typename Edge, typename Graph>
Chris@16 47 struct source :
Chris@16 48 mpl::first<typename mpl::at<typename detail::produce_edge_st_map<typename Graph::representation, typename Graph::data>::type,Edge>::type>
Chris@16 49 {};
Chris@16 50 template<typename Edge, typename Graph>
Chris@16 51 struct target :
Chris@16 52 mpl::second<typename mpl::at<typename detail::produce_edge_st_map<typename Graph::representation, typename Graph::data>::type,Edge>::type>
Chris@16 53 {};
Chris@16 54 template<typename Vertex, typename Graph>
Chris@16 55 struct out_edges :
Chris@16 56 mpl::fold<typename detail::produce_out_map<typename Graph::representation, Vertex, typename Graph::data>::type,
Chris@16 57 mpl::vector<>,
Chris@16 58 mpl::push_back<mpl::_1, mpl::first<mpl::_2> > >
Chris@16 59 {};
Chris@16 60 template<typename Vertex, typename Graph>
Chris@16 61 struct out_degree :
Chris@16 62 mpl::size<typename out_edges<Vertex, Graph>::type>
Chris@16 63 {};
Chris@16 64
Chris@16 65 // BidirectionalGraph
Chris@16 66 template<typename Vertex, typename Graph>
Chris@16 67 struct in_edges :
Chris@16 68 mpl::fold<typename detail::produce_in_map<typename Graph::representation, Vertex, typename Graph::data>::type,
Chris@16 69 mpl::vector<>,
Chris@16 70 mpl::push_back<mpl::_1, mpl::first<mpl::_2> > >
Chris@16 71 {};
Chris@16 72 template<typename Vertex, typename Graph>
Chris@16 73 struct in_degree :
Chris@16 74 mpl::size<typename in_edges<Vertex, Graph>::type>
Chris@16 75 {};
Chris@16 76 template<typename Vertex, typename Graph>
Chris@16 77 struct degree :
Chris@16 78 mpl::plus<typename out_degree<Vertex, Graph>::type,typename in_degree<Vertex, Graph>::type>
Chris@16 79 {};
Chris@16 80
Chris@16 81 // AdjacencyGraph
Chris@16 82 template<typename Vertex, typename Graph>
Chris@16 83 struct adjacent_vertices :
Chris@16 84 mpl::transform<typename detail::produce_out_map<typename Graph::representation, Vertex, typename Graph::data>::type,
Chris@16 85 mpl::second<mpl::_1>,
Chris@16 86 mpl::back_inserter<mpl::vector<> > >
Chris@16 87 {};
Chris@16 88
Chris@16 89 // VertexListGraph
Chris@16 90 template<typename Graph>
Chris@16 91 struct vertices :
Chris@16 92 detail::produce_vertex_set<typename Graph::representation, typename Graph::data>
Chris@16 93 {};
Chris@16 94 template<typename Graph>
Chris@16 95 struct num_vertices :
Chris@16 96 mpl::size<typename vertices<Graph>::type>
Chris@16 97 {};
Chris@16 98
Chris@16 99 // EdgeListGraph
Chris@16 100 template<typename Graph>
Chris@16 101 struct edges :
Chris@16 102 detail::produce_edge_set<typename Graph::representation, typename Graph::data>
Chris@16 103 {};
Chris@16 104 template<typename Graph>
Chris@16 105 struct num_edges :
Chris@16 106 mpl::size<typename edges<Graph>::type>
Chris@16 107 {};
Chris@16 108 // source and target are defined in IncidenceGraph
Chris@16 109
Chris@16 110 } // mpl_graph
Chris@16 111 } // msm
Chris@16 112 } // boost
Chris@16 113
Chris@16 114 #endif // BOOST_MSM_MPL_GRAPH_MPL_GRAPH_HPP_INCLUDED