36 * supports this feature it should be fixed. |
36 * supports this feature it should be fixed. |
37 */ |
37 */ |
38 #define CREATE_NODE_MAP(DynMap) \ |
38 #define CREATE_NODE_MAP(DynMap) \ |
39 template <typename Value> \ |
39 template <typename Value> \ |
40 class NodeMap : public DynMap<NodeMapRegistry, Value> { \ |
40 class NodeMap : public DynMap<NodeMapRegistry, Value> { \ |
41 typedef DynMap<NodeMapRegistry, Value> MapImpl; \ |
41 public: \ |
42 public: \ |
42 typedef DynMap<NodeMapRegistry, Value> Parent; \ |
43 NodeMap() {} \ |
43 NodeMap() {} \ |
44 NodeMap(const typename MapImpl::Graph& g) \ |
44 NodeMap(const typename Parent::Graph& g) \ |
45 : MapImpl(g, g.node_maps) {} \ |
45 : Parent(g, g.node_maps) {} \ |
46 NodeMap(const typename MapImpl::Graph& g, const Value& v) \ |
46 NodeMap(const typename Parent::Graph& g, const Value& v) \ |
47 : MapImpl(g, g.node_maps, v) {} \ |
47 : Parent(g, g.node_maps, v) {} \ |
48 NodeMap(const NodeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \ |
48 NodeMap(const NodeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \ |
49 template <typename CMap> NodeMap(const CMap& copy) : MapImpl(copy) {} \ |
49 template <typename TT> \ |
|
50 NodeMap(const NodeMap<TT>& copy) \ |
|
51 : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \ |
50 NodeMap& operator=(const NodeMap& copy) { \ |
52 NodeMap& operator=(const NodeMap& copy) { \ |
51 MapImpl::operator=(static_cast<const MapImpl&>(copy));\ |
53 Parent::operator=(static_cast<const Parent&>(copy));\ |
52 return *this; \ |
54 return *this; \ |
53 } \ |
55 } \ |
54 template <typename CMap> NodeMap& operator=(const CMap& copy) { \ |
56 template <typename TT> \ |
55 MapImpl::operator=(copy);\ |
57 NodeMap& operator=(const NodeMap<TT>& copy) { \ |
|
58 Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\ |
56 return *this; \ |
59 return *this; \ |
57 } \ |
60 } \ |
58 }; |
61 }; |
59 |
62 |
60 /** Creates a map from a template map. The import method is |
63 /** Creates a map from a template map. The import method is |
64 * supports this feature it should be fixed. |
67 * supports this feature it should be fixed. |
65 */ |
68 */ |
66 #define CREATE_EDGE_MAP(DynMap) \ |
69 #define CREATE_EDGE_MAP(DynMap) \ |
67 template <typename Value> \ |
70 template <typename Value> \ |
68 class EdgeMap : public DynMap<EdgeMapRegistry, Value> { \ |
71 class EdgeMap : public DynMap<EdgeMapRegistry, Value> { \ |
69 typedef DynMap<EdgeMapRegistry, Value> MapImpl; \ |
72 public: \ |
70 public: \ |
73 typedef DynMap<EdgeMapRegistry, Value> Parent; \ |
|
74 \ |
71 EdgeMap() {} \ |
75 EdgeMap() {} \ |
72 EdgeMap(const typename MapImpl::Graph& g) \ |
76 EdgeMap(const typename Parent::Graph& g) \ |
73 : MapImpl(g, g.edge_maps) {} \ |
77 : Parent(g, g.edge_maps) {} \ |
74 EdgeMap(const typename MapImpl::Graph& g, const Value& v) \ |
78 EdgeMap(const typename Parent::Graph& g, const Value& v) \ |
75 : MapImpl(g, g.edge_maps, v) {} \ |
79 : Parent(g, g.edge_maps, v) {} \ |
76 EdgeMap(const EdgeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \ |
80 EdgeMap(const EdgeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \ |
77 template <typename CMap> EdgeMap(const CMap& copy) : MapImpl(copy) {} \ |
81 template <typename TT> \ |
|
82 EdgeMap(const EdgeMap<TT>& copy) \ |
|
83 : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \ |
78 EdgeMap& operator=(const EdgeMap& copy) { \ |
84 EdgeMap& operator=(const EdgeMap& copy) { \ |
79 MapImpl::operator=(static_cast<const MapImpl&>(copy));\ |
85 Parent::operator=(static_cast<const Parent&>(copy));\ |
80 return *this; \ |
86 return *this; \ |
81 } \ |
87 } \ |
82 template <typename CMap> EdgeMap& operator=(const CMap& copy) { \ |
88 template <typename TT> \ |
83 MapImpl::operator=(copy);\ |
89 EdgeMap& operator=(const EdgeMap<TT>& copy) { \ |
|
90 Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\ |
84 return *this; \ |
91 return *this; \ |
85 } \ |
92 } \ |
86 }; |
93 }; |
87 |
94 |
88 /** This macro creates both maps. |
95 /** This macro creates both maps. |
106 * supports this feature it should be fixed. |
113 * supports this feature it should be fixed. |
107 */ |
114 */ |
108 #define CREATE_SYM_EDGE_MAP(DynMap) \ |
115 #define CREATE_SYM_EDGE_MAP(DynMap) \ |
109 template <typename Value> \ |
116 template <typename Value> \ |
110 class SymEdgeMap : public SymMap<DynMap, SymEdgeMapRegistry, Value> { \ |
117 class SymEdgeMap : public SymMap<DynMap, SymEdgeMapRegistry, Value> { \ |
111 typedef SymMap<DynMap, SymEdgeMapRegistry, Value> MapImpl; \ |
118 public: \ |
112 public: \ |
119 typedef SymMap<DynMap, SymEdgeMapRegistry, Value> Parent; \ |
113 \ |
120 \ |
114 SymEdgeMap() {} \ |
121 SymEdgeMap() {} \ |
115 \ |
122 SymEdgeMap(const typename Parent::Graph& g) \ |
116 SymEdgeMap(const typename MapImpl::Graph& g) \ |
123 : Parent(g, g.sym_edge_maps) {} \ |
117 : MapImpl(g, g.sym_edge_maps) {} \ |
124 SymEdgeMap(const typename Parent::Graph& g, const Value& v) \ |
118 \ |
125 : Parent(g, g.sym_edge_maps, v) {} \ |
119 SymEdgeMap(const typename MapImpl::Graph& g, const Value& v) \ |
126 SymEdgeMap(const SymEdgeMap& copy) \ |
120 : MapImpl(g, g.sym_edge_maps, v) {} \ |
127 : Parent(static_cast<const Parent&>(copy)) {} \ |
121 \ |
128 template <typename TT> \ |
122 SymEdgeMap(const SymEdgeMap& copy) \ |
129 SymEdgeMap(const NodeMap<TT>& copy) \ |
123 : MapImpl(static_cast<const MapImpl&>(copy)) {} \ |
130 : Parent(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy)) {} \ |
124 \ |
131 SymEdgeMap& operator=(const SymEdgeMap& copy) { \ |
125 template <typename CMap> SymEdgeMap(const CMap& copy) : MapImpl(copy) {} \ |
132 Parent::operator=(static_cast<const Parent&>(copy));\ |
126 SymEdgeMap& operator=(const SymEdgeMap& copy) { \ |
133 return *this; \ |
127 MapImpl::operator=(static_cast<const MapImpl&>(copy));\ |
134 } \ |
128 return *this; \ |
135 template <typename TT> \ |
129 } \ |
136 SymEdgeMap& operator=(const SymEdgeMap<TT>& copy) { \ |
130 \ |
137 Parent::operator=(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy));\ |
131 template <typename CMap> SymEdgeMap& operator=(const CMap& copy) { \ |
138 return *this; \ |
132 MapImpl::operator=(copy);\ |
139 } \ |
133 return *this; \ |
140 }; |
134 } \ |
|
135 }; |
|
136 |
|
137 |
141 |
138 /** This is a macro to import an node map into a graph class. |
142 /** This is a macro to import an node map into a graph class. |
139 */ |
143 */ |
140 #define IMPORT_NODE_MAP(From, from, To, to) \ |
144 #define IMPORT_NODE_MAP(From, from, To, to) \ |
141 template <typename Value> \ |
145 template <typename Value> \ |
142 class NodeMap \ |
146 class NodeMap : public From::template NodeMap<Value> { \ |
143 : public From::template NodeMap<Value> { \ |
147 \ |
144 typedef typename From::template NodeMap<Value> MapImpl; \ |
148 public: \ |
145 public: \ |
149 typedef typename From::template NodeMap<Value> Parent; \ |
146 NodeMap() : MapImpl() {} \ |
150 \ |
147 \ |
151 NodeMap() : Parent() {} \ |
148 NodeMap(const To& to) \ |
152 NodeMap(const To& to) \ |
149 : MapImpl(static_cast<const From&>(from)) { } \ |
153 : Parent(static_cast<const From&>(from)) { } \ |
150 \ |
154 NodeMap(const To& to, const Value& value) \ |
151 NodeMap(const To& to, const Value& value) \ |
155 : Parent(static_cast<const From&>(from), value) { } \ |
152 : MapImpl(static_cast<const From&>(from), value) { } \ |
156 NodeMap(const NodeMap& copy) \ |
153 \ |
157 : Parent(static_cast<const Parent&>(copy)) {} \ |
154 NodeMap(const NodeMap& copy) \ |
158 template <typename TT> \ |
155 : MapImpl(static_cast<const MapImpl&>(copy)) {} \ |
159 NodeMap(const NodeMap<TT>& copy) \ |
156 \ |
160 : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \ |
157 template<typename CMap> \ |
161 NodeMap& operator=(const NodeMap& copy) { \ |
158 NodeMap(const CMap& copy) \ |
162 Parent::operator=(static_cast<const Parent&>(copy)); \ |
159 : MapImpl(copy) {} \ |
163 return *this; \ |
160 \ |
164 } \ |
161 NodeMap& operator=(const NodeMap& copy) { \ |
165 template <typename TT> \ |
162 MapImpl::operator=(static_cast<const MapImpl&>(copy)); \ |
166 NodeMap& operator=(const NodeMap<TT>& copy) { \ |
163 return *this; \ |
167 Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\ |
164 } \ |
168 return *this; \ |
165 \ |
169 } \ |
166 template <typename CMap> \ |
|
167 NodeMap& operator=(const CMap& copy) { \ |
|
168 MapImpl::operator=(copy); \ |
|
169 return *this; \ |
|
170 } \ |
|
171 }; |
170 }; |
172 |
171 |
173 /** This is a macro to import an edge map into a graph class. |
172 /** This is a macro to import an edge map into a graph class. |
174 */ |
173 */ |
175 #define IMPORT_EDGE_MAP(From, from, To, to) \ |
174 #define IMPORT_EDGE_MAP(From, from, To, to) \ |
176 template <typename Value> \ |
175 template <typename Value> \ |
177 class EdgeMap \ |
176 class EdgeMap : public From::template EdgeMap<Value> { \ |
178 : public From::template EdgeMap<Value> { \ |
177 \ |
179 typedef typename From::template EdgeMap<Value> MapImpl; \ |
178 public: \ |
180 public: \ |
179 typedef typename From::template EdgeMap<Value> Parent; \ |
181 EdgeMap() : MapImpl() {} \ |
180 \ |
182 \ |
181 EdgeMap() : Parent() {} \ |
183 EdgeMap(const To& to) \ |
182 EdgeMap(const To& to) \ |
184 : MapImpl(static_cast<const From&>(from)) { } \ |
183 : Parent(static_cast<const From&>(from)) { } \ |
185 \ |
184 EdgeMap(const To& to, const Value& value) \ |
186 EdgeMap(const To& to, const Value& value) \ |
185 : Parent(static_cast<const From&>(from), value) { } \ |
187 : MapImpl(static_cast<const From&>(from), value) { } \ |
186 EdgeMap(const EdgeMap& copy) \ |
188 \ |
187 : Parent(static_cast<const Parent&>(copy)) {} \ |
189 EdgeMap(const EdgeMap& copy) \ |
188 template <typename TT> \ |
190 : MapImpl(static_cast<const MapImpl&>(copy)) {} \ |
189 EdgeMap(const EdgeMap<TT>& copy) \ |
191 \ |
190 : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \ |
192 template<typename CMap> \ |
191 EdgeMap& operator=(const EdgeMap& copy) { \ |
193 EdgeMap(const CMap& copy) \ |
192 Parent::operator=(static_cast<const Parent&>(copy)); \ |
194 : MapImpl(copy) {} \ |
193 return *this; \ |
195 \ |
194 } \ |
196 EdgeMap& operator=(const EdgeMap& copy) { \ |
195 template <typename TT> \ |
197 MapImpl::operator=(static_cast<const MapImpl&>(copy)); \ |
196 EdgeMap& operator=(const EdgeMap<TT>& copy) { \ |
198 return *this; \ |
197 Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\ |
199 } \ |
198 return *this; \ |
200 \ |
199 } \ |
201 template <typename CMap> \ |
|
202 EdgeMap& operator=(const CMap& copy) { \ |
|
203 MapImpl::operator=(copy); \ |
|
204 return *this; \ |
|
205 } \ |
|
206 }; |
200 }; |
207 |
201 |
208 #define KEEP_EDGE_MAP(From, To) \ |
202 #define KEEP_EDGE_MAP(From, To) \ |
209 IMPORT_EDGE_MAP(From, graph, To, graph) |
203 IMPORT_EDGE_MAP(From, graph, To, graph) |
210 |
204 |