00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef LEMON_TRAITS_H
00020 #define LEMON_TRAITS_H
00021
00022 #include <lemon/utility.h>
00023
00027
00028 namespace lemon {
00029 template <typename _Graph, typename _Item>
00030 class ItemSetTraits {};
00031
00032 template <typename _Graph>
00033 class ItemSetTraits<_Graph, typename _Graph::Node> {
00034 public:
00035
00036 typedef _Graph Graph;
00037
00038 typedef typename Graph::Node Item;
00039 typedef typename Graph::NodeIt ItemIt;
00040
00041 template <typename _Value>
00042 class Map : public Graph::template NodeMap<_Value> {
00043 public:
00044 typedef typename Graph::template NodeMap<_Value> Parent;
00045 typedef typename Parent::Value Value;
00046
00047 Map(const Graph& _graph) : Parent(_graph) {}
00048 Map(const Graph& _graph, const Value& _value)
00049 : Parent(_graph, _value) {}
00050 };
00051
00052 };
00053
00054 template <typename _Graph>
00055 class ItemSetTraits<_Graph, typename _Graph::Edge> {
00056 public:
00057
00058 typedef _Graph Graph;
00059
00060 typedef typename Graph::Edge Item;
00061 typedef typename Graph::EdgeIt ItemIt;
00062
00063 template <typename _Value>
00064 class Map : public Graph::template EdgeMap<_Value> {
00065 public:
00066 typedef typename Graph::template EdgeMap<_Value> Parent;
00067 typedef typename Parent::Value Value;
00068
00069 Map(const Graph& _graph) : Parent(_graph) {}
00070 Map(const Graph& _graph, const Value& _value)
00071 : Parent(_graph, _value) {}
00072 };
00073
00074 };
00075
00076 template <typename _Graph>
00077 class ItemSetTraits<_Graph, typename _Graph::UEdge> {
00078 public:
00079
00080 typedef _Graph Graph;
00081
00082 typedef typename Graph::UEdge Item;
00083 typedef typename Graph::UEdgeIt ItemIt;
00084
00085 template <typename _Value>
00086 class Map : public Graph::template UEdgeMap<_Value> {
00087 public:
00088 typedef typename Graph::template UEdgeMap<_Value> Parent;
00089 typedef typename Parent::Value Value;
00090
00091 Map(const Graph& _graph) : Parent(_graph) {}
00092 Map(const Graph& _graph, const Value& _value)
00093 : Parent(_graph, _value) {}
00094 };
00095
00096 };
00097
00098
00099 template <typename _Graph>
00100 class ItemSetTraits<_Graph, typename _Graph::ANode> {
00101 public:
00102
00103 typedef _Graph Graph;
00104
00105 typedef typename Graph::ANode Item;
00106 typedef typename Graph::ANodeIt ItemIt;
00107
00108 template <typename _Value>
00109 class Map : public Graph::template ANodeMap<_Value> {
00110 public:
00111 typedef typename Graph::template ANodeMap<_Value> Parent;
00112 typedef typename Parent::Value Value;
00113
00114 Map(const Graph& _graph) : Parent(_graph) {}
00115 Map(const Graph& _graph, const Value& _value)
00116 : Parent(_graph, _value) {}
00117 };
00118
00119 };
00120
00121 template <typename _Graph>
00122 class ItemSetTraits<_Graph, typename _Graph::BNode> {
00123 public:
00124
00125 typedef _Graph Graph;
00126
00127 typedef typename Graph::BNode Item;
00128 typedef typename Graph::BNodeIt ItemIt;
00129
00130 template <typename _Value>
00131 class Map : public Graph::template BNodeMap<_Value> {
00132 public:
00133 typedef typename Graph::template BNodeMap<_Value> Parent;
00134 typedef typename Parent::Value Value;
00135
00136 Map(const Graph& _graph) : Parent(_graph) {}
00137 Map(const Graph& _graph, const Value& _value)
00138 : Parent(_graph, _value) {}
00139 };
00140
00141 };
00142
00143
00144 template <typename Map, typename Enable = void>
00145 struct MapTraits {
00146 typedef False ReferenceMapTag;
00147
00148 typedef typename Map::Key Key;
00149 typedef typename Map::Value Value;
00150
00151 typedef const Value ConstReturnValue;
00152 typedef const Value ReturnValue;
00153 };
00154
00155 template <typename Map>
00156 struct MapTraits<
00157 Map, typename enable_if<typename Map::ReferenceMapTag, void>::type >
00158 {
00159 typedef True ReferenceMapTag;
00160
00161 typedef typename Map::Key Key;
00162 typedef typename Map::Value Value;
00163
00164 typedef typename Map::ConstReference ConstReturnValue;
00165 typedef typename Map::Reference ReturnValue;
00166
00167 typedef typename Map::ConstReference ConstReference;
00168 typedef typename Map::Reference Reference;
00169 };
00170
00171
00172
00173 template <typename Graph, typename Enable = void>
00174 struct NodeNumTagIndicator {
00175 static const bool value = false;
00176 };
00177
00178 template <typename Graph>
00179 struct NodeNumTagIndicator<
00180 Graph,
00181 typename enable_if<typename Graph::NodeNumTag, void>::type
00182 > {
00183 static const bool value = true;
00184 };
00185
00186 template <typename Graph, typename Enable = void>
00187 struct EdgeNumTagIndicator {
00188 static const bool value = false;
00189 };
00190
00191 template <typename Graph>
00192 struct EdgeNumTagIndicator<
00193 Graph,
00194 typename enable_if<typename Graph::EdgeNumTag, void>::type
00195 > {
00196 static const bool value = true;
00197 };
00198
00199 template <typename Graph, typename Enable = void>
00200 struct FindEdgeTagIndicator {
00201 static const bool value = false;
00202 };
00203
00204 template <typename Graph>
00205 struct FindEdgeTagIndicator<
00206 Graph,
00207 typename enable_if<typename Graph::FindEdgeTag, void>::type
00208 > {
00209 static const bool value = true;
00210 };
00211
00212
00213
00214 }
00215
00216 #endif // LEMON_MAPS_H