File indexing completed on 2025-07-11 08:12:58
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_GRAPH_MUTABILITY_TRAITS_HPP
0008 #define BOOST_GRAPH_MUTABILITY_TRAITS_HPP
0009
0010 #include <boost/config.hpp>
0011 #include <boost/mpl/if.hpp>
0012 #include <boost/mpl/and.hpp>
0013 #include <boost/mpl/bool.hpp>
0014 #include <boost/type_traits/is_convertible.hpp>
0015 #include <boost/type_traits/is_same.hpp>
0016
0017 namespace boost
0018 {
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 struct add_vertex_tag
0029 {
0030 };
0031 struct add_vertex_property_tag : virtual add_vertex_tag
0032 {
0033 };
0034 struct add_edge_tag
0035 {
0036 };
0037 struct add_edge_property_tag : virtual add_edge_tag
0038 {
0039 };
0040 struct remove_vertex_tag
0041 {
0042 };
0043 struct remove_edge_tag
0044 {
0045 };
0046
0047 struct mutable_vertex_graph_tag : virtual add_vertex_tag,
0048 virtual remove_vertex_tag
0049 {
0050 };
0051 struct mutable_vertex_property_graph_tag : virtual add_vertex_property_tag,
0052 virtual remove_vertex_tag
0053 {
0054 };
0055
0056 struct mutable_edge_graph_tag : virtual add_edge_tag, virtual remove_edge_tag
0057 {
0058 };
0059 struct mutable_edge_property_graph_tag : virtual add_edge_property_tag,
0060 virtual remove_edge_tag
0061 {
0062 };
0063
0064 struct mutable_graph_tag : virtual mutable_vertex_graph_tag,
0065 virtual mutable_edge_graph_tag
0066 {
0067 };
0068 struct mutable_property_graph_tag : virtual mutable_vertex_property_graph_tag,
0069 virtual mutable_edge_property_graph_tag
0070 {
0071 };
0072
0073
0074
0075
0076 struct add_only_property_graph_tag : virtual add_vertex_property_tag,
0077 virtual mutable_edge_property_graph_tag
0078 {
0079 };
0080
0081
0082
0083
0084
0085
0086 template < typename Graph > struct graph_mutability_traits
0087 {
0088 typedef typename Graph::mutability_category category;
0089 };
0090
0091 template < typename Graph >
0092 struct graph_has_add_vertex
0093 : mpl::bool_<
0094 is_convertible< typename graph_mutability_traits< Graph >::category,
0095 add_vertex_tag >::value >
0096 {
0097 };
0098
0099 template < typename Graph >
0100 struct graph_has_add_vertex_with_property
0101 : mpl::bool_<
0102 is_convertible< typename graph_mutability_traits< Graph >::category,
0103 add_vertex_property_tag >::value >
0104 {
0105 };
0106
0107 template < typename Graph >
0108 struct graph_has_remove_vertex
0109 : mpl::bool_<
0110 is_convertible< typename graph_mutability_traits< Graph >::category,
0111 remove_vertex_tag >::value >
0112 {
0113 };
0114
0115 template < typename Graph >
0116 struct graph_has_add_edge
0117 : mpl::bool_<
0118 is_convertible< typename graph_mutability_traits< Graph >::category,
0119 add_edge_tag >::value >
0120 {
0121 };
0122
0123 template < typename Graph >
0124 struct graph_has_add_edge_with_property
0125 : mpl::bool_<
0126 is_convertible< typename graph_mutability_traits< Graph >::category,
0127 add_edge_property_tag >::value >
0128 {
0129 };
0130
0131 template < typename Graph >
0132 struct graph_has_remove_edge
0133 : mpl::bool_<
0134 is_convertible< typename graph_mutability_traits< Graph >::category,
0135 remove_edge_tag >::value >
0136 {
0137 };
0138
0139 template < typename Graph >
0140 struct is_mutable_vertex_graph
0141 : mpl::and_< graph_has_add_vertex< Graph >, graph_has_remove_vertex< Graph > >
0142 {
0143 };
0144
0145 template < typename Graph >
0146 struct is_mutable_vertex_property_graph
0147 : mpl::and_< graph_has_add_vertex_with_property< Graph >,
0148 graph_has_remove_vertex< Graph > >
0149 {
0150 };
0151
0152 template < typename Graph >
0153 struct is_mutable_edge_graph
0154 : mpl::and_< graph_has_add_edge< Graph >, graph_has_remove_edge< Graph > >
0155 {
0156 };
0157
0158 template < typename Graph >
0159 struct is_mutable_edge_property_graph
0160 : mpl::and_< graph_has_add_edge_with_property< Graph >,
0161 graph_has_remove_edge< Graph > >
0162 {
0163 };
0164
0165 template < typename Graph >
0166 struct is_mutable_graph
0167 : mpl::and_< is_mutable_vertex_graph< Graph >, is_mutable_edge_graph< Graph > >
0168 {
0169 };
0170
0171 template < typename Graph >
0172 struct is_mutable_property_graph
0173 : mpl::and_< is_mutable_vertex_property_graph< Graph >,
0174 is_mutable_edge_property_graph< Graph > >
0175 {
0176 };
0177
0178 template < typename Graph >
0179 struct is_add_only_property_graph
0180 : mpl::bool_<
0181 is_convertible< typename graph_mutability_traits< Graph >::category,
0182 add_only_property_graph_tag >::value >
0183 {
0184 };
0185
0186
0187
0188
0189
0190
0191 }
0192
0193 #endif