... | ... |
@@ -3174,67 +3174,67 @@ |
3174 | 3174 |
}; |
3175 | 3175 |
|
3176 | 3176 |
template <typename V> |
3177 | 3177 |
class ArcMapBase |
3178 | 3178 |
: public MapTraits<typename Parent::template ArcMap<V> > { |
3179 | 3179 |
typedef typename Parent::template ArcMap<V> ArcImpl; |
3180 | 3180 |
typedef typename Parent::template NodeMap<V> NodeImpl; |
3181 | 3181 |
public: |
3182 | 3182 |
typedef Arc Key; |
3183 | 3183 |
typedef V Value; |
3184 | 3184 |
typedef typename MapTraits<ArcImpl>::ReferenceMapTag ReferenceMapTag; |
3185 | 3185 |
typedef typename MapTraits<ArcImpl>::ReturnValue ReturnValue; |
3186 | 3186 |
typedef typename MapTraits<ArcImpl>::ConstReturnValue ConstReturnValue; |
3187 | 3187 |
typedef typename MapTraits<ArcImpl>::ReturnValue Reference; |
3188 | 3188 |
typedef typename MapTraits<ArcImpl>::ConstReturnValue ConstReference; |
3189 | 3189 |
|
3190 | 3190 |
ArcMapBase(const SplitNodesBase<DGR>& adaptor) |
3191 | 3191 |
: _arc_map(*adaptor._digraph), _node_map(*adaptor._digraph) {} |
3192 | 3192 |
ArcMapBase(const SplitNodesBase<DGR>& adaptor, const V& value) |
3193 | 3193 |
: _arc_map(*adaptor._digraph, value), |
3194 | 3194 |
_node_map(*adaptor._digraph, value) {} |
3195 | 3195 |
|
3196 | 3196 |
void set(const Arc& key, const V& val) { |
3197 | 3197 |
if (SplitNodesBase<DGR>::origArc(key)) { |
3198 |
_arc_map.set( |
|
3198 |
_arc_map.set(static_cast<const DigraphArc&>(key), val); |
|
3199 | 3199 |
} else { |
3200 |
_node_map.set( |
|
3200 |
_node_map.set(static_cast<const DigraphNode&>(key), val); |
|
3201 | 3201 |
} |
3202 | 3202 |
} |
3203 | 3203 |
|
3204 | 3204 |
ReturnValue operator[](const Arc& key) { |
3205 | 3205 |
if (SplitNodesBase<DGR>::origArc(key)) { |
3206 |
return _arc_map[ |
|
3206 |
return _arc_map[static_cast<const DigraphArc&>(key)]; |
|
3207 | 3207 |
} else { |
3208 |
return _node_map[ |
|
3208 |
return _node_map[static_cast<const DigraphNode&>(key)]; |
|
3209 | 3209 |
} |
3210 | 3210 |
} |
3211 | 3211 |
|
3212 | 3212 |
ConstReturnValue operator[](const Arc& key) const { |
3213 | 3213 |
if (SplitNodesBase<DGR>::origArc(key)) { |
3214 |
return _arc_map[ |
|
3214 |
return _arc_map[static_cast<const DigraphArc&>(key)]; |
|
3215 | 3215 |
} else { |
3216 |
return _node_map[ |
|
3216 |
return _node_map[static_cast<const DigraphNode&>(key)]; |
|
3217 | 3217 |
} |
3218 | 3218 |
} |
3219 | 3219 |
|
3220 | 3220 |
private: |
3221 | 3221 |
ArcImpl _arc_map; |
3222 | 3222 |
NodeImpl _node_map; |
3223 | 3223 |
}; |
3224 | 3224 |
|
3225 | 3225 |
public: |
3226 | 3226 |
|
3227 | 3227 |
template <typename V> |
3228 | 3228 |
class NodeMap |
3229 | 3229 |
: public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > |
3230 | 3230 |
{ |
3231 | 3231 |
public: |
3232 | 3232 |
typedef V Value; |
3233 | 3233 |
typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<Value> > Parent; |
3234 | 3234 |
|
3235 | 3235 |
NodeMap(const SplitNodesBase<DGR>& adaptor) |
3236 | 3236 |
: Parent(adaptor) {} |
3237 | 3237 |
|
3238 | 3238 |
NodeMap(const SplitNodesBase<DGR>& adaptor, const V& value) |
3239 | 3239 |
: Parent(adaptor, value) {} |
3240 | 3240 |
|
0 comments (0 inline)