annotate DEPENDENCIES/generic/include/boost/graph/detail/labeled_graph_traits.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright (C) 2009 Andrew Sutton
Chris@16 2
Chris@16 3 // Use, modification and distribution is subject to the Boost Software
Chris@16 4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 5 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6
Chris@16 7 #ifndef BOOST_GRAPH_LABELED_GRAPH_TRAITS_HPP
Chris@16 8 #define BOOST_GRAPH_LABELED_GRAPH_TRAITS_HPP
Chris@16 9
Chris@16 10 #include <boost/graph/graph_mutability_traits.hpp>
Chris@16 11
Chris@16 12 namespace boost {
Chris@16 13
Chris@16 14 // Extend the graph mutability traits (and metafunctions) to include options
Chris@16 15 // for labeled graphs.
Chris@16 16
Chris@16 17 // NOTE: the label_vertex tag denotes the fact that you can basically assign
Chris@16 18 // arbitrary labels to vertices without modifying the actual graph.
Chris@16 19
Chris@16 20 // TODO: We might also overlay the uniqueness/multiplicity of labels in this
Chris@16 21 // hierarchy also. For now, we just assumed that labels are unique.
Chris@16 22
Chris@16 23 struct label_vertex_tag { };
Chris@16 24 struct labeled_add_vertex_tag : virtual label_vertex_tag { };
Chris@16 25 struct labeled_add_vertex_property_tag : virtual labeled_add_vertex_tag { };
Chris@16 26 struct labeled_remove_vertex_tag { };
Chris@16 27 struct labeled_add_edge_tag : virtual label_vertex_tag { };
Chris@16 28 struct labeled_add_edge_property_tag : virtual labeled_add_edge_tag{ };
Chris@16 29 struct labeled_remove_edge_tag { };
Chris@16 30
Chris@16 31 struct labeled_mutable_vertex_graph_tag
Chris@16 32 : virtual labeled_add_vertex_tag, virtual labeled_remove_vertex_tag
Chris@16 33 { };
Chris@16 34 struct labeled_mutable_vertex_property_graph_tag
Chris@16 35 : virtual labeled_add_vertex_property_tag, virtual labeled_remove_vertex_tag
Chris@16 36 { };
Chris@16 37 struct labeled_mutable_edge_graph_tag
Chris@16 38 : virtual labeled_add_edge_tag, virtual labeled_remove_edge_tag
Chris@16 39 { };
Chris@16 40 struct labeled_mutable_edge_property_graph_tag
Chris@16 41 : virtual labeled_add_edge_property_tag, virtual labeled_remove_edge_tag
Chris@16 42 { };
Chris@16 43
Chris@16 44 struct labeled_graph_tag
Chris@16 45 : virtual label_vertex_tag
Chris@16 46 { };
Chris@16 47 struct labeled_mutable_graph_tag
Chris@16 48 : virtual labeled_mutable_vertex_graph_tag
Chris@16 49 , virtual labeled_mutable_edge_graph_tag
Chris@16 50 { };
Chris@16 51 struct labeled_mutable_property_graph_tag
Chris@16 52 : virtual labeled_mutable_vertex_property_graph_tag
Chris@16 53 , virtual labeled_mutable_edge_property_graph_tag
Chris@16 54 { };
Chris@16 55 struct labeled_add_only_property_graph_tag
Chris@16 56 : virtual labeled_add_vertex_property_tag
Chris@16 57 , virtual labeled_mutable_edge_property_graph_tag
Chris@16 58 { };
Chris@16 59
Chris@16 60 // Metafunctions
Chris@16 61
Chris@16 62 template <typename Graph>
Chris@16 63 struct graph_has_add_vertex_by_label
Chris@16 64 : mpl::bool_<
Chris@16 65 is_convertible<
Chris@16 66 typename graph_mutability_traits<Graph>::category,
Chris@16 67 labeled_add_vertex_tag
Chris@16 68 >::value
Chris@16 69 >
Chris@16 70 { };
Chris@16 71
Chris@16 72 template <typename Graph>
Chris@16 73 struct graph_has_add_vertex_by_label_with_property
Chris@16 74 : mpl::bool_<
Chris@16 75 is_convertible<
Chris@16 76 typename graph_mutability_traits<Graph>::category,
Chris@16 77 labeled_add_vertex_property_tag
Chris@16 78 >::value
Chris@16 79 >
Chris@16 80 { };
Chris@16 81
Chris@16 82 template <typename Graph>
Chris@16 83 struct graph_has_remove_vertex_by_label
Chris@16 84 : mpl::bool_<
Chris@16 85 is_convertible<
Chris@16 86 typename graph_mutability_traits<Graph>::category,
Chris@16 87 labeled_remove_vertex_tag
Chris@16 88 >::value
Chris@16 89 >
Chris@16 90 { };
Chris@16 91
Chris@16 92 template <typename Graph>
Chris@16 93 struct graph_has_add_edge_by_label
Chris@16 94 : mpl::bool_<
Chris@16 95 is_convertible<
Chris@16 96 typename graph_mutability_traits<Graph>::category,
Chris@16 97 labeled_add_edge_tag
Chris@16 98 >::value
Chris@16 99 >
Chris@16 100 { };
Chris@16 101
Chris@16 102 template <typename Graph>
Chris@16 103 struct graph_has_add_edge_by_label_with_property
Chris@16 104 : mpl::bool_<
Chris@16 105 is_convertible<
Chris@16 106 typename graph_mutability_traits<Graph>::category,
Chris@16 107 labeled_add_edge_property_tag
Chris@16 108 >::value
Chris@16 109 >
Chris@16 110 { };
Chris@16 111
Chris@16 112 template <typename Graph>
Chris@16 113 struct graph_has_remove_edge_by_label
Chris@16 114 : mpl::bool_<
Chris@16 115 is_convertible<
Chris@16 116 typename graph_mutability_traits<Graph>::category,
Chris@16 117 labeled_remove_edge_tag
Chris@16 118 >::value
Chris@16 119 >
Chris@16 120 { };
Chris@16 121
Chris@16 122 template <typename Graph>
Chris@16 123 struct is_labeled_mutable_vertex_graph
Chris@16 124 : mpl::and_<
Chris@16 125 graph_has_add_vertex_by_label<Graph>,
Chris@16 126 graph_has_remove_vertex_by_label<Graph>
Chris@16 127 >
Chris@16 128 { };
Chris@16 129
Chris@16 130 template <typename Graph>
Chris@16 131 struct is_labeled_mutable_vertex_property_graph
Chris@16 132 : mpl::and_<
Chris@16 133 graph_has_add_vertex_by_label<Graph>,
Chris@16 134 graph_has_remove_vertex_by_label<Graph>
Chris@16 135 >
Chris@16 136 { };
Chris@16 137
Chris@16 138 template <typename Graph>
Chris@16 139 struct is_labeled_mutable_edge_graph
Chris@16 140 : mpl::and_<
Chris@16 141 graph_has_add_edge_by_label<Graph>,
Chris@16 142 graph_has_remove_edge_by_label<Graph>
Chris@16 143 >
Chris@16 144 { };
Chris@16 145
Chris@16 146 template <typename Graph>
Chris@16 147 struct is_labeled_mutable_edge_property_graph
Chris@16 148 : mpl::and_<
Chris@16 149 graph_has_add_edge_by_label<Graph>,
Chris@16 150 graph_has_remove_edge_by_label<Graph>
Chris@16 151 >
Chris@16 152 { };
Chris@16 153
Chris@16 154 template <typename Graph>
Chris@16 155 struct is_labeled_mutable_graph
Chris@16 156 : mpl::and_<
Chris@16 157 is_labeled_mutable_vertex_graph<Graph>,
Chris@16 158 is_labeled_mutable_edge_graph<Graph>
Chris@16 159 >
Chris@16 160 { };
Chris@16 161
Chris@16 162 template <typename Graph>
Chris@16 163 struct is_labeled_mutable_property_graph
Chris@16 164 : mpl::and_<
Chris@16 165 is_labeled_mutable_vertex_property_graph<Graph>,
Chris@16 166 is_labeled_mutable_edge_property_graph<Graph>
Chris@16 167 >
Chris@16 168 { };
Chris@16 169
Chris@16 170 template <typename Graph>
Chris@16 171 struct is_labeled_add_only_property_graph
Chris@16 172 : mpl::bool_<
Chris@16 173 is_convertible<
Chris@16 174 typename graph_mutability_traits<Graph>::category,
Chris@16 175 labeled_add_only_property_graph_tag
Chris@16 176 >::value
Chris@16 177 >
Chris@16 178 { };
Chris@16 179
Chris@16 180 template <typename Graph>
Chris@16 181 struct is_labeled_graph
Chris@16 182 : mpl::bool_<
Chris@16 183 is_convertible<
Chris@16 184 typename graph_mutability_traits<Graph>::category,
Chris@16 185 label_vertex_tag
Chris@16 186 >::value
Chris@16 187 >
Chris@16 188 { };
Chris@16 189
Chris@16 190 template <typename> struct graph_mutability_traits;
Chris@16 191
Chris@16 192 namespace graph_detail {
Chris@16 193 // The determine mutability metafunction computes a labeled mutability tag
Chris@16 194 // based on the mutability of the given graph type. This is used by the
Chris@16 195 // graph_mutability_traits specialization below.
Chris@16 196 template <typename Graph>
Chris@16 197 struct determine_mutability {
Chris@16 198 typedef typename mpl::if_<
Chris@16 199 is_add_only_property_graph<Graph>,
Chris@16 200 labeled_add_only_property_graph_tag,
Chris@16 201 typename mpl::if_<
Chris@16 202 is_mutable_property_graph<Graph>,
Chris@16 203 labeled_mutable_property_graph_tag,
Chris@16 204 typename mpl::if_<
Chris@16 205 is_mutable_graph<Graph>,
Chris@16 206 labeled_mutable_graph_tag,
Chris@16 207 typename mpl::if_<
Chris@16 208 is_mutable_edge_graph<Graph>,
Chris@16 209 labeled_graph_tag,
Chris@16 210 typename graph_mutability_traits<Graph>::category
Chris@16 211 >::type
Chris@16 212 >::type
Chris@16 213 >::type
Chris@16 214 >::type type;
Chris@16 215 };
Chris@16 216 } // namespace graph_detail
Chris@16 217
Chris@16 218 #define LABELED_GRAPH_PARAMS typename G, typename L, typename S
Chris@16 219 #define LABELED_GRAPH labeled_graph<G,L,S>
Chris@16 220
Chris@16 221 // Specialize mutability traits for the labeled graph.
Chris@16 222 // This specialization depends on the mutability of the underlying graph type.
Chris@16 223 // If the underlying graph is fully mutable, this is also fully mutable.
Chris@16 224 // Otherwise, it's different.
Chris@16 225 template <LABELED_GRAPH_PARAMS>
Chris@16 226 struct graph_mutability_traits< LABELED_GRAPH > {
Chris@16 227 typedef typename graph_detail::determine_mutability<
Chris@16 228 typename LABELED_GRAPH::graph_type
Chris@16 229 >::type category;
Chris@16 230 };
Chris@16 231
Chris@16 232 #undef LABELED_GRAPH_PARAMS
Chris@16 233 #undef LABELED_GRAPH
Chris@16 234
Chris@16 235 } // namespace boost
Chris@16 236
Chris@16 237 #endif