Added boost header
This commit is contained in:
128
test/external/boost/msm/mpl_graph/detail/adjacency_list_graph.ipp
vendored
Normal file
128
test/external/boost/msm/mpl_graph/detail/adjacency_list_graph.ipp
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
// Copyright 2008-2010 Gordon Woodhull
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MSM_MPL_GRAPH_DETAIL_ADJACENCY_LIST_GRAPH_IPP_INCLUDED
|
||||
#define BOOST_MSM_MPL_GRAPH_DETAIL_ADJACENCY_LIST_GRAPH_IPP_INCLUDED
|
||||
|
||||
// implementation of a graph declared in adjacency list format
|
||||
// sequence< pair< source_vertex, sequence< pair<edge, target_vertex> > > >
|
||||
|
||||
#include <boost/msm/mpl_graph/mpl_utils.hpp>
|
||||
#include <boost/msm/mpl_graph/detail/incidence_list_graph.ipp>
|
||||
|
||||
#include <boost/mpl/copy.hpp>
|
||||
#include <boost/mpl/inserter.hpp>
|
||||
#include <boost/mpl/map.hpp>
|
||||
#include <boost/mpl/insert.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/push_back.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace msm {
|
||||
namespace mpl_graph {
|
||||
namespace detail {
|
||||
|
||||
// tag identifying graph implementation as adjacency list (not defined)
|
||||
struct adjacency_list_tag;
|
||||
|
||||
// outs map is really just the same data with the sequences turned into maps
|
||||
// it might make sense to make another adjacency_map implementation for that case
|
||||
template<typename AdjacencyList>
|
||||
struct produce_al_outs_map :
|
||||
mpl::reverse_fold<AdjacencyList,
|
||||
mpl::map<>,
|
||||
mpl::insert<mpl::_1,
|
||||
mpl::pair<mpl::first<mpl::_2>, mpl_utils::as_map<mpl::second<mpl::_2> > > > >
|
||||
{};
|
||||
|
||||
// Edge->Target map for a Source for out_*, degree
|
||||
template<typename Source, typename GraphData>
|
||||
struct produce_out_map<adjacency_list_tag, Source, GraphData> :
|
||||
mpl::at<typename produce_al_outs_map<GraphData>::type, Source>
|
||||
{};
|
||||
|
||||
template<typename InsMap, typename Source, typename Adjacencies>
|
||||
struct produce_in_adjacencies :
|
||||
mpl::reverse_fold<Adjacencies,
|
||||
InsMap,
|
||||
mpl::insert<mpl::_1,
|
||||
mpl::pair<mpl::second<mpl::_2>,
|
||||
mpl::insert<mpl_utils::at_or_default<mpl::_1, mpl::second<mpl::_2>, mpl::map<> >,
|
||||
mpl::pair<mpl::first<mpl::_2>, Source> > > > >
|
||||
{};
|
||||
|
||||
template<typename AdjacencyList>
|
||||
struct produce_al_ins_map :
|
||||
mpl::reverse_fold<AdjacencyList,
|
||||
mpl::map<>,
|
||||
produce_in_adjacencies<mpl::_1, mpl::first<mpl::_2>, mpl::second<mpl::_2> > >
|
||||
{};
|
||||
|
||||
// Edge->Source map for a Target for in_*, degree
|
||||
template<typename Target, typename GraphData>
|
||||
struct produce_in_map<adjacency_list_tag, Target, GraphData> :
|
||||
mpl::at<typename produce_al_ins_map<GraphData>::type, Target>
|
||||
{};
|
||||
|
||||
// for everything else to do with edges,
|
||||
// just produce an incidence list and forward to that graph implementation
|
||||
// (produce_out_map could, and produce_in_map probably should, be implemented this way too)
|
||||
template<typename Incidences, typename Source, typename Adjacencies>
|
||||
struct produce_adjacencies_incidences : // adjacencies'
|
||||
mpl::reverse_fold<Adjacencies,
|
||||
Incidences,
|
||||
mpl::push_back<mpl::_1,
|
||||
mpl::vector3<mpl::first<mpl::_2>, Source, mpl::second<mpl::_2> > > >
|
||||
{};
|
||||
|
||||
template<typename AdjacencyList>
|
||||
struct produce_incidence_list_from_adjacency_list :
|
||||
mpl::reverse_fold<AdjacencyList,
|
||||
mpl::vector<>,
|
||||
produce_adjacencies_incidences<mpl::_1, mpl::first<mpl::_2>, mpl::second<mpl::_2> > >
|
||||
{};
|
||||
|
||||
|
||||
// Edge->pair<Source,Target> map for source, target
|
||||
template<typename GraphData>
|
||||
struct produce_edge_st_map<adjacency_list_tag, GraphData> :
|
||||
produce_edge_st_map<incidence_list_tag,
|
||||
typename produce_incidence_list_from_adjacency_list<GraphData>::type>
|
||||
{};
|
||||
|
||||
|
||||
// adjacency list supports zero-degree vertices, which incidence list does not
|
||||
template<typename VertexSet, typename Adjacencies>
|
||||
struct insert_adjacencies_targets : // adjacencies'
|
||||
mpl::reverse_fold<Adjacencies,
|
||||
VertexSet,
|
||||
mpl::insert<mpl::_1, mpl::second<mpl::_2> > >
|
||||
{};
|
||||
|
||||
template<typename GraphData>
|
||||
struct produce_vertex_set<adjacency_list_tag, GraphData> :
|
||||
mpl::reverse_fold<GraphData,
|
||||
mpl::set<>,
|
||||
insert_adjacencies_targets<mpl::insert<mpl::_1, mpl::first<mpl::_2> >,
|
||||
mpl::second<mpl::_2> > >
|
||||
{};
|
||||
|
||||
|
||||
// Edge set for EdgeListGraph
|
||||
template<typename GraphData>
|
||||
struct produce_edge_set<adjacency_list_tag, GraphData> :
|
||||
produce_edge_set<incidence_list_tag,
|
||||
typename produce_incidence_list_from_adjacency_list<GraphData>::type>
|
||||
{};
|
||||
|
||||
|
||||
} // namespaces
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_MSM_MPL_GRAPH_DETAIL_ADJACENCY_LIST_GRAPH_IPP_INCLUDED
|
||||
|
||||
42
test/external/boost/msm/mpl_graph/detail/graph_implementation_interface.ipp
vendored
Normal file
42
test/external/boost/msm/mpl_graph/detail/graph_implementation_interface.ipp
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright 2008-2010 Gordon Woodhull
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MSM_MPL_GRAPH_DETAIL_GRAPH_IMPLEMENTATION_INTERFACE_IPP_INCLUDED
|
||||
#define BOOST_MSM_MPL_GRAPH_DETAIL_GRAPH_IMPLEMENTATION_INTERFACE_IPP_INCLUDED
|
||||
|
||||
// forward definitions of the producer metafunctions that need to be specialized for
|
||||
// each graph representation
|
||||
|
||||
namespace boost {
|
||||
namespace msm {
|
||||
namespace mpl_graph {
|
||||
namespace detail {
|
||||
|
||||
// Edge->Target map for a Source for out_*, degree
|
||||
template<typename RepresentationTag, typename Source, typename GraphData>
|
||||
struct produce_out_map;
|
||||
|
||||
// Edge->Source map for a Target for in_*, degree
|
||||
template<typename RepresentationTag, typename Target, typename GraphData>
|
||||
struct produce_in_map;
|
||||
|
||||
// Edge->pair<Source,Target> map for source, target
|
||||
template<typename RepresentationTag, typename GraphData>
|
||||
struct produce_edge_st_map;
|
||||
|
||||
// Vertex set for VertexListGraph
|
||||
template<typename RepresentationTag, typename GraphData>
|
||||
struct produce_vertex_set;
|
||||
|
||||
// Edge set for EdgeListGraph
|
||||
template<typename RepresentationTag, typename GraphData>
|
||||
struct produce_edge_set;
|
||||
|
||||
} // namespaces
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_MSM_MPL_GRAPH_DETAIL_GRAPH_IMPLEMENTATION_INTERFACE_IPP_INCLUDED
|
||||
|
||||
106
test/external/boost/msm/mpl_graph/detail/incidence_list_graph.ipp
vendored
Normal file
106
test/external/boost/msm/mpl_graph/detail/incidence_list_graph.ipp
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
// Copyright 2008-2010 Gordon Woodhull
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_MSM_MPL_GRAPH_DETAIL_INCIDENCE_LIST_GRAPH_IPP_INCLUDED
|
||||
|
||||
#define BOOST_MSM_MPL_GRAPH_DETAIL_INCIDENCE_LIST_GRAPH_IPP_INCLUDED
|
||||
|
||||
// these metafunctions provide the metadata structures needed by the public interface
|
||||
// in mpl_graph.hpp
|
||||
|
||||
#include <boost/mpl/map.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/copy.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/next.hpp>
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/back.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mpl/void.hpp>
|
||||
#include <boost/mpl/erase_key.hpp>
|
||||
#include <boost/mpl/has_key.hpp>
|
||||
#include <boost/mpl/inserter.hpp>
|
||||
#include <boost/mpl/back_inserter.hpp>
|
||||
#include <boost/mpl/set.hpp>
|
||||
#include <boost/mpl/insert.hpp>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
#include <boost/mpl/pair.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/push_back.hpp>
|
||||
#include <boost/mpl/filter_view.hpp>
|
||||
#include <boost/mpl/transform_view.hpp>
|
||||
#include <boost/mpl/equal.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace msm {
|
||||
namespace mpl_graph {
|
||||
namespace detail {
|
||||
|
||||
// tag to identify this graph implementation (not defined)
|
||||
struct incidence_list_tag;
|
||||
|
||||
// clarifiers
|
||||
template<typename EST> struct fetch_edge :
|
||||
mpl::front<EST> {};
|
||||
template<typename EST> struct fetch_source :
|
||||
mpl::deref<typename mpl::next<typename mpl::begin<EST>::type>::type> {};
|
||||
template<typename EST> struct fetch_target :
|
||||
mpl::back<EST> {};
|
||||
|
||||
// Edge->Target map for an Source for out_*, adjacent_vertices
|
||||
template<typename Source, typename ESTSequence>
|
||||
struct produce_out_map<incidence_list_tag, Source, ESTSequence> :
|
||||
mpl::fold<typename mpl::filter_view<ESTSequence, boost::is_same<fetch_source<mpl::_1>,Source> >::type,
|
||||
mpl::map<>,
|
||||
mpl::insert<mpl::_1,mpl::pair<fetch_edge<mpl::_2>,fetch_target<mpl::_2> > > >
|
||||
{};
|
||||
|
||||
// Edge->Source map for a Target for in_*, degree
|
||||
template<typename Target, typename ESTSequence>
|
||||
struct produce_in_map<incidence_list_tag, Target, ESTSequence> :
|
||||
mpl::fold<typename mpl::filter_view<ESTSequence,
|
||||
boost::is_same<fetch_target<mpl::_1>,Target> >::type,
|
||||
mpl::map<>,
|
||||
mpl::insert<mpl::_1,mpl::pair<fetch_edge<mpl::_2>,fetch_source<mpl::_2> > > >
|
||||
|
||||
{};
|
||||
// Edge->pair<Source,Target> map for source, target
|
||||
template<typename ESTSequence>
|
||||
struct produce_edge_st_map<incidence_list_tag, ESTSequence> :
|
||||
mpl::fold<ESTSequence,
|
||||
mpl::map<>,
|
||||
mpl::insert<mpl::_1,mpl::pair<fetch_edge<mpl::_2>,
|
||||
mpl::pair<fetch_source<mpl::_2>,
|
||||
fetch_target<mpl::_2> > > > >
|
||||
{};
|
||||
// Vertex set for VertexListGraph
|
||||
template<typename ESTSequence>
|
||||
struct produce_vertex_set<incidence_list_tag, ESTSequence> :
|
||||
mpl::fold<ESTSequence,
|
||||
typename mpl::fold<ESTSequence,
|
||||
mpl::set<>,
|
||||
mpl::insert<mpl::_1,fetch_target<mpl::_2> >
|
||||
>::type,
|
||||
mpl::insert<mpl::_1, fetch_source<mpl::_2> > >
|
||||
{};
|
||||
// Edge set for EdgeListGraph
|
||||
template<typename ESTSequence>
|
||||
struct produce_edge_set<incidence_list_tag, ESTSequence> :
|
||||
mpl::fold<ESTSequence,
|
||||
mpl::set<>,
|
||||
mpl::insert<mpl::_1,fetch_edge<mpl::_2> > >
|
||||
{};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_MSM_MPL_GRAPH_DETAIL_INCIDENCE_LIST_GRAPH_IPP_INCLUDED
|
||||
Reference in New Issue
Block a user