Fix crash when an arrow is clicked with the delete tool.
2 * lemon/traits.h - Part of LEMON, a generic C++ optimization library
4 * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Research Group on Combinatorial Optimization, EGRES).
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
17 #ifndef LEMON_TRAITS_H
18 #define LEMON_TRAITS_H
20 #include <lemon/utility.h>
23 ///\brief Traits for graphs and maps
27 template <typename _Graph, typename _Item>
28 class ItemSetTraits {};
30 template <typename _Graph>
31 class ItemSetTraits<_Graph, typename _Graph::Node> {
36 typedef typename Graph::Node Item;
37 typedef typename Graph::NodeIt ItemIt;
39 template <typename _Value>
40 class Map : public Graph::template NodeMap<_Value> {
42 typedef typename Graph::template NodeMap<_Value> Parent;
43 typedef typename Parent::Value Value;
45 Map(const Graph& _graph) : Parent(_graph) {}
46 Map(const Graph& _graph, const Value& _value)
47 : Parent(_graph, _value) {}
52 template <typename _Graph>
53 class ItemSetTraits<_Graph, typename _Graph::Edge> {
58 typedef typename Graph::Edge Item;
59 typedef typename Graph::EdgeIt ItemIt;
61 template <typename _Value>
62 class Map : public Graph::template EdgeMap<_Value> {
64 typedef typename Graph::template EdgeMap<_Value> Parent;
65 typedef typename Parent::Value Value;
67 Map(const Graph& _graph) : Parent(_graph) {}
68 Map(const Graph& _graph, const Value& _value)
69 : Parent(_graph, _value) {}
74 template <typename _Graph>
75 class ItemSetTraits<_Graph, typename _Graph::UEdge> {
80 typedef typename Graph::UEdge Item;
81 typedef typename Graph::UEdgeIt ItemIt;
83 template <typename _Value>
84 class Map : public Graph::template UEdgeMap<_Value> {
86 typedef typename Graph::template UEdgeMap<_Value> Parent;
87 typedef typename Parent::Value Value;
89 Map(const Graph& _graph) : Parent(_graph) {}
90 Map(const Graph& _graph, const Value& _value)
91 : Parent(_graph, _value) {}
97 template <typename _Graph>
98 class ItemSetTraits<_Graph, typename _Graph::ANode> {
101 typedef _Graph Graph;
103 typedef typename Graph::ANode Item;
104 typedef typename Graph::ANodeIt ItemIt;
106 template <typename _Value>
107 class Map : public Graph::template ANodeMap<_Value> {
109 typedef typename Graph::template ANodeMap<_Value> Parent;
110 typedef typename Parent::Value Value;
112 Map(const Graph& _graph) : Parent(_graph) {}
113 Map(const Graph& _graph, const Value& _value)
114 : Parent(_graph, _value) {}
119 template <typename _Graph>
120 class ItemSetTraits<_Graph, typename _Graph::BNode> {
123 typedef _Graph Graph;
125 typedef typename Graph::BNode Item;
126 typedef typename Graph::BNodeIt ItemIt;
128 template <typename _Value>
129 class Map : public Graph::template BNodeMap<_Value> {
131 typedef typename Graph::template BNodeMap<_Value> Parent;
132 typedef typename Parent::Value Value;
134 Map(const Graph& _graph) : Parent(_graph) {}
135 Map(const Graph& _graph, const Value& _value)
136 : Parent(_graph, _value) {}
142 template <typename Map, typename Enable = void>
144 typedef False ReferenceMapTag;
146 typedef typename Map::Key Key;
147 typedef typename Map::Value Value;
149 typedef const Value ConstReturnValue;
150 typedef const Value ReturnValue;
153 template <typename Map>
155 Map, typename enable_if<typename Map::ReferenceMapTag, void>::type >
157 typedef True ReferenceMapTag;
159 typedef typename Map::Key Key;
160 typedef typename Map::Value Value;
162 typedef typename Map::ConstReference ConstReturnValue;
163 typedef typename Map::Reference ReturnValue;
165 typedef typename Map::ConstReference ConstReference;
166 typedef typename Map::Reference Reference;
169 // Indicators for the tags
171 template <typename Graph, typename Enable = void>
172 struct NodeNumTagIndicator {
173 static const bool value = false;
176 template <typename Graph>
177 struct NodeNumTagIndicator<
179 typename enable_if<typename Graph::NodeNumTag, void>::type
181 static const bool value = true;
184 template <typename Graph, typename Enable = void>
185 struct EdgeNumTagIndicator {
186 static const bool value = false;
189 template <typename Graph>
190 struct EdgeNumTagIndicator<
192 typename enable_if<typename Graph::EdgeNumTag, void>::type
194 static const bool value = true;
197 template <typename Graph, typename Enable = void>
198 struct FindEdgeTagIndicator {
199 static const bool value = false;
202 template <typename Graph>
203 struct FindEdgeTagIndicator<
205 typename enable_if<typename Graph::FindEdgeTag, void>::type
207 static const bool value = true;
214 #endif // LEMON_MAPS_H