]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/msm/include/boost/msm/mpl_graph/detail/incidence_list_graph.ipp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / msm / include / boost / msm / mpl_graph / detail / incidence_list_graph.ipp
CommitLineData
7c673cae
FG
1// Copyright 2008-2010 Gordon Woodhull
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5#ifndef BOOST_MSM_MPL_GRAPH_DETAIL_INCIDENCE_LIST_GRAPH_IPP_INCLUDED
6
7#define BOOST_MSM_MPL_GRAPH_DETAIL_INCIDENCE_LIST_GRAPH_IPP_INCLUDED
8
9// these metafunctions provide the metadata structures needed by the public interface
10// in mpl_graph.hpp
11
12#include <boost/mpl/map.hpp>
13#include <boost/mpl/vector.hpp>
14#include <boost/mpl/copy.hpp>
15#include <boost/mpl/vector.hpp>
16#include <boost/mpl/next.hpp>
17#include <boost/mpl/front.hpp>
18#include <boost/mpl/back.hpp>
19#include <boost/mpl/deref.hpp>
20#include <boost/mpl/if.hpp>
21#include <boost/mpl/size.hpp>
22#include <boost/mpl/void.hpp>
23#include <boost/mpl/erase_key.hpp>
24#include <boost/mpl/has_key.hpp>
25#include <boost/mpl/inserter.hpp>
26#include <boost/mpl/back_inserter.hpp>
27#include <boost/mpl/set.hpp>
28#include <boost/mpl/insert.hpp>
29#include <boost/mpl/transform.hpp>
30#include <boost/mpl/pair.hpp>
31#include <boost/mpl/size.hpp>
32#include <boost/mpl/fold.hpp>
33#include <boost/mpl/transform.hpp>
34#include <boost/mpl/at.hpp>
35#include <boost/mpl/push_back.hpp>
36#include <boost/mpl/filter_view.hpp>
37#include <boost/mpl/transform_view.hpp>
38#include <boost/mpl/equal.hpp>
39#include <boost/type_traits.hpp>
40
41
42namespace boost {
43namespace msm {
44namespace mpl_graph {
45namespace detail {
46
47// tag to identify this graph implementation (not defined)
48struct incidence_list_tag;
49
50// clarifiers
51template<typename EST> struct fetch_edge :
52 mpl::front<EST> {};
53template<typename EST> struct fetch_source :
54 mpl::deref<typename mpl::next<typename mpl::begin<EST>::type>::type> {};
55template<typename EST> struct fetch_target :
56 mpl::back<EST> {};
57
58// Edge->Target map for an Source for out_*, adjacent_vertices
59template<typename Source, typename ESTSequence>
60struct produce_out_map<incidence_list_tag, Source, ESTSequence> :
61 mpl::fold<typename mpl::filter_view<ESTSequence, boost::is_same<fetch_source<mpl::_1>,Source> >::type,
62 mpl::map<>,
63 mpl::insert<mpl::_1,mpl::pair<fetch_edge<mpl::_2>,fetch_target<mpl::_2> > > >
64{};
65
66// Edge->Source map for a Target for in_*, degree
67template<typename Target, typename ESTSequence>
68struct produce_in_map<incidence_list_tag, Target, ESTSequence> :
69 mpl::fold<typename mpl::filter_view<ESTSequence,
70 boost::is_same<fetch_target<mpl::_1>,Target> >::type,
71 mpl::map<>,
72 mpl::insert<mpl::_1,mpl::pair<fetch_edge<mpl::_2>,fetch_source<mpl::_2> > > >
73
74{};
75// Edge->pair<Source,Target> map for source, target
76template<typename ESTSequence>
77struct produce_edge_st_map<incidence_list_tag, ESTSequence> :
78 mpl::fold<ESTSequence,
79 mpl::map<>,
80 mpl::insert<mpl::_1,mpl::pair<fetch_edge<mpl::_2>,
81 mpl::pair<fetch_source<mpl::_2>,
82 fetch_target<mpl::_2> > > > >
83{};
84// Vertex set for VertexListGraph
85template<typename ESTSequence>
86struct produce_vertex_set<incidence_list_tag, ESTSequence> :
87 mpl::fold<ESTSequence,
88 typename mpl::fold<ESTSequence,
89 mpl::set<>,
90 mpl::insert<mpl::_1,fetch_target<mpl::_2> >
91 >::type,
92 mpl::insert<mpl::_1, fetch_source<mpl::_2> > >
93{};
94// Edge set for EdgeListGraph
95template<typename ESTSequence>
96struct produce_edge_set<incidence_list_tag, ESTSequence> :
97 mpl::fold<ESTSequence,
98 mpl::set<>,
99 mpl::insert<mpl::_1,fetch_edge<mpl::_2> > >
100{};
101}
102}
103}
104}
105
106#endif // BOOST_MSM_MPL_GRAPH_DETAIL_INCIDENCE_LIST_GRAPH_IPP_INCLUDED