Improved rename script to avoid "undirected digraph".
4 * This file is a part of LEMON, a generic C++ optimization library
6 * Copyright (C) 2003-2007
7 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
8 * (Egervary Research Group on Combinatorial Optimization, EGRES).
10 * Permission to use, modify and distribute this software is granted
11 * provided that this copyright notice appears in all copies. For
12 * precise terms see the accompanying LICENSE file.
14 * This software is provided "AS IS" with no warranty of any kind,
15 * express or implied, and with no claim as to its suitability for any
20 #ifndef LEMON_BITS_TRAITS_H
21 #define LEMON_BITS_TRAITS_H
23 #include <lemon/bits/utility.h>
26 ///\brief Traits for graphs and maps
30 template <typename _Graph, typename _Item>
31 class ItemSetTraits {};
34 template <typename Graph, typename Enable = void>
35 struct NodeNotifierIndicator {
36 typedef InvalidType Type;
38 template <typename Graph>
39 struct NodeNotifierIndicator<
41 typename enable_if<typename Graph::NodeNotifier::Notifier, void>::type
43 typedef typename Graph::NodeNotifier Type;
46 template <typename _Graph>
47 class ItemSetTraits<_Graph, typename _Graph::Node> {
52 typedef typename Graph::Node Item;
53 typedef typename Graph::NodeIt ItemIt;
55 typedef typename NodeNotifierIndicator<Graph>::Type ItemNotifier;
57 template <typename _Value>
58 class Map : public Graph::template NodeMap<_Value> {
60 typedef typename Graph::template NodeMap<_Value> Parent;
61 typedef typename Graph::template NodeMap<_Value> Type;
62 typedef typename Parent::Value Value;
64 Map(const Graph& _graph) : Parent(_graph) {}
65 Map(const Graph& _graph, const Value& _value)
66 : Parent(_graph, _value) {}
72 template <typename Graph, typename Enable = void>
73 struct EdgeNotifierIndicator {
74 typedef InvalidType Type;
76 template <typename Graph>
77 struct EdgeNotifierIndicator<
79 typename enable_if<typename Graph::EdgeNotifier::Notifier, void>::type
81 typedef typename Graph::EdgeNotifier Type;
84 template <typename _Graph>
85 class ItemSetTraits<_Graph, typename _Graph::Edge> {
90 typedef typename Graph::Edge Item;
91 typedef typename Graph::EdgeIt ItemIt;
93 typedef typename EdgeNotifierIndicator<Graph>::Type ItemNotifier;
95 template <typename _Value>
96 class Map : public Graph::template EdgeMap<_Value> {
98 typedef typename Graph::template EdgeMap<_Value> Parent;
99 typedef typename Graph::template EdgeMap<_Value> Type;
100 typedef typename Parent::Value Value;
102 Map(const Graph& _graph) : Parent(_graph) {}
103 Map(const Graph& _graph, const Value& _value)
104 : Parent(_graph, _value) {}
109 template <typename Graph, typename Enable = void>
110 struct UEdgeNotifierIndicator {
111 typedef InvalidType Type;
113 template <typename Graph>
114 struct UEdgeNotifierIndicator<
116 typename enable_if<typename Graph::UEdgeNotifier::Notifier, void>::type
118 typedef typename Graph::UEdgeNotifier Type;
121 template <typename _Graph>
122 class ItemSetTraits<_Graph, typename _Graph::UEdge> {
125 typedef _Graph Graph;
127 typedef typename Graph::UEdge Item;
128 typedef typename Graph::UEdgeIt ItemIt;
130 typedef typename UEdgeNotifierIndicator<Graph>::Type ItemNotifier;
132 template <typename _Value>
133 class Map : public Graph::template UEdgeMap<_Value> {
135 typedef typename Graph::template UEdgeMap<_Value> Parent;
136 typedef typename Graph::template UEdgeMap<_Value> Type;
137 typedef typename Parent::Value Value;
139 Map(const Graph& _graph) : Parent(_graph) {}
140 Map(const Graph& _graph, const Value& _value)
141 : Parent(_graph, _value) {}
146 template <typename Graph, typename Enable = void>
147 struct ANodeNotifierIndicator {
148 typedef InvalidType Type;
150 template <typename Graph>
151 struct ANodeNotifierIndicator<
153 typename enable_if<typename Graph::ANodeNotifier::Notifier, void>::type
155 typedef typename Graph::ANodeNotifier Type;
158 template <typename _Graph>
159 class ItemSetTraits<_Graph, typename _Graph::ANode> {
162 typedef _Graph Graph;
164 typedef typename Graph::ANode Item;
165 typedef typename Graph::ANodeIt ItemIt;
167 typedef typename ANodeNotifierIndicator<Graph>::Type ItemNotifier;
169 template <typename _Value>
170 class Map : public Graph::template ANodeMap<_Value> {
172 typedef typename Graph::template ANodeMap<_Value> Parent;
173 typedef typename Graph::template ANodeMap<_Value> Type;
174 typedef typename Parent::Value Value;
176 Map(const Graph& _graph) : Parent(_graph) {}
177 Map(const Graph& _graph, const Value& _value)
178 : Parent(_graph, _value) {}
183 template <typename Graph, typename Enable = void>
184 struct BNodeNotifierIndicator {
185 typedef InvalidType Type;
187 template <typename Graph>
188 struct BNodeNotifierIndicator<
190 typename enable_if<typename Graph::BNodeNotifier::Notifier, void>::type
192 typedef typename Graph::BNodeNotifier Type;
195 template <typename _Graph>
196 class ItemSetTraits<_Graph, typename _Graph::BNode> {
199 typedef _Graph Graph;
201 typedef typename Graph::BNode Item;
202 typedef typename Graph::BNodeIt ItemIt;
204 typedef typename BNodeNotifierIndicator<Graph>::Type ItemNotifier;
206 template <typename _Value>
207 class Map : public Graph::template BNodeMap<_Value> {
209 typedef typename Graph::template BNodeMap<_Value> Parent;
210 typedef typename Graph::template BNodeMap<_Value> Type;
211 typedef typename Parent::Value Value;
213 Map(const Graph& _graph) : Parent(_graph) {}
214 Map(const Graph& _graph, const Value& _value)
215 : Parent(_graph, _value) {}
221 template <typename Map, typename Enable = void>
223 typedef False ReferenceMapTag;
225 typedef typename Map::Key Key;
226 typedef typename Map::Value Value;
228 typedef const Value ConstReturnValue;
229 typedef const Value ReturnValue;
232 template <typename Map>
234 Map, typename enable_if<typename Map::ReferenceMapTag, void>::type >
236 typedef True ReferenceMapTag;
238 typedef typename Map::Key Key;
239 typedef typename Map::Value Value;
241 typedef typename Map::ConstReference ConstReturnValue;
242 typedef typename Map::Reference ReturnValue;
244 typedef typename Map::ConstReference ConstReference;
245 typedef typename Map::Reference Reference;
248 template <typename MatrixMap, typename Enable = void>
249 struct MatrixMapTraits {
250 typedef False ReferenceMapTag;
252 typedef typename MatrixMap::FirstKey FirstKey;
253 typedef typename MatrixMap::SecondKey SecondKey;
254 typedef typename MatrixMap::Value Value;
256 typedef const Value ConstReturnValue;
257 typedef const Value ReturnValue;
260 template <typename MatrixMap>
261 struct MatrixMapTraits<
262 MatrixMap, typename enable_if<typename MatrixMap::ReferenceMapTag,
265 typedef True ReferenceMapTag;
267 typedef typename MatrixMap::FirstKey FirstKey;
268 typedef typename MatrixMap::SecondKey SecondKey;
269 typedef typename MatrixMap::Value Value;
271 typedef typename MatrixMap::ConstReference ConstReturnValue;
272 typedef typename MatrixMap::Reference ReturnValue;
274 typedef typename MatrixMap::ConstReference ConstReference;
275 typedef typename MatrixMap::Reference Reference;
278 // Indicators for the tags
280 template <typename Graph, typename Enable = void>
281 struct NodeNumTagIndicator {
282 static const bool value = false;
285 template <typename Graph>
286 struct NodeNumTagIndicator<
288 typename enable_if<typename Graph::NodeNumTag, void>::type
290 static const bool value = true;
293 template <typename Graph, typename Enable = void>
294 struct EdgeNumTagIndicator {
295 static const bool value = false;
298 template <typename Graph>
299 struct EdgeNumTagIndicator<
301 typename enable_if<typename Graph::EdgeNumTag, void>::type
303 static const bool value = true;
306 template <typename Graph, typename Enable = void>
307 struct FindEdgeTagIndicator {
308 static const bool value = false;
311 template <typename Graph>
312 struct FindEdgeTagIndicator<
314 typename enable_if<typename Graph::FindEdgeTag, void>::type
316 static const bool value = true;
319 template <typename Graph, typename Enable = void>
320 struct UndirectedTagIndicator {
321 static const bool value = false;
324 template <typename Graph>
325 struct UndirectedTagIndicator<
327 typename enable_if<typename Graph::UndirectedTag, void>::type
329 static const bool value = true;
332 template <typename Graph, typename Enable = void>
333 struct BuildTagIndicator {
334 static const bool value = false;
337 template <typename Graph>
338 struct BuildTagIndicator<
340 typename enable_if<typename Graph::BuildTag, void>::type
342 static const bool value = true;