If default value of a new map is constant, the newly created elements will get that value as well. Documentation is added to BrokenEdge, MapStorage and GraphDisplazCanvas classes.
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::UndirEdge> {
80 typedef typename Graph::UndirEdge Item;
81 typedef typename Graph::UndirEdgeIt ItemIt;
83 template <typename _Value>
84 class Map : public Graph::template UndirEdgeMap<_Value> {
86 typedef typename Graph::template UndirEdgeMap<_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) {}
96 template <typename Map, typename Enable = void>
98 typedef False ReferenceMapTag;
100 typedef typename Map::Key Key;
101 typedef typename Map::Value Value;
103 typedef const Value ConstReturnValue;
104 typedef const Value ReturnValue;
107 template <typename Map>
109 Map, typename enable_if<typename Map::ReferenceMapTag, void>::type >
111 typedef True ReferenceMapTag;
113 typedef typename Map::Key Key;
114 typedef typename Map::Value Value;
116 typedef typename Map::ConstReference ConstReturnValue;
117 typedef typename Map::Reference ReturnValue;
119 typedef typename Map::ConstReference ConstReference;
120 typedef typename Map::Reference Reference;
123 // Indicators for the tags
125 template <typename Graph, typename Enable = void>
126 struct NodeNumTagIndicator {
127 static const bool value = false;
130 template <typename Graph>
131 struct NodeNumTagIndicator<
133 typename enable_if<typename Graph::NodeNumTag, void>::type
135 static const bool value = true;
138 template <typename Graph, typename Enable = void>
139 struct EdgeNumTagIndicator {
140 static const bool value = false;
143 template <typename Graph>
144 struct EdgeNumTagIndicator<
146 typename enable_if<typename Graph::EdgeNumTag, void>::type
148 static const bool value = true;
151 template <typename Graph, typename Enable = void>
152 struct FindEdgeTagIndicator {
153 static const bool value = false;
156 template <typename Graph>
157 struct FindEdgeTagIndicator<
159 typename enable_if<typename Graph::FindEdgeTag, void>::type
161 static const bool value = true;
168 #endif // LEMON_MAPS_H