Changeset 559:c5fd2d996909 in lemon1.2 for lemon/adaptors.h
 Timestamp:
 03/29/09 23:08:20 (11 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/adaptors.h
r519 r559 2255 2255 /// This map adaptor class adapts two arc maps of the underlying 2256 2256 /// digraph to get an arc map of the undirected graph. 2257 /// Its value type is inherited from the first arc map type 2258 /// (\c %ForwardMap). 2259 template <typename ForwardMap, typename BackwardMap> 2257 /// Its value type is inherited from the first arc map type (\c FW). 2258 /// \tparam FW The type of the "foward" arc map. 2259 /// \tparam BK The type of the "backward" arc map. 2260 template <typename FW, typename BK> 2260 2261 class CombinedArcMap { 2261 2262 public: … … 2264 2265 typedef typename Parent::Arc Key; 2265 2266 /// The value type of the map 2266 typedef typename F orwardMap::Value Value;2267 2268 typedef typename MapTraits<F orwardMap>::ReferenceMapTag ReferenceMapTag;2269 2270 typedef typename MapTraits<F orwardMap>::ReturnValue ReturnValue;2271 typedef typename MapTraits<F orwardMap>::ConstReturnValue ConstReturnValue;2272 typedef typename MapTraits<F orwardMap>::ReturnValue Reference;2273 typedef typename MapTraits<F orwardMap>::ConstReturnValue ConstReference;2267 typedef typename FW::Value Value; 2268 2269 typedef typename MapTraits<FW>::ReferenceMapTag ReferenceMapTag; 2270 2271 typedef typename MapTraits<FW>::ReturnValue ReturnValue; 2272 typedef typename MapTraits<FW>::ConstReturnValue ConstReturnValue; 2273 typedef typename MapTraits<FW>::ReturnValue Reference; 2274 typedef typename MapTraits<FW>::ConstReturnValue ConstReference; 2274 2275 2275 2276 /// Constructor 2276 CombinedArcMap(F orwardMap& forward, BackwardMap& backward)2277 CombinedArcMap(FW& forward, BK& backward) 2277 2278 : _forward(&forward), _backward(&backward) {} 2278 2279 … … 2306 2307 protected: 2307 2308 2308 F orwardMap* _forward;2309 B ackwardMap* _backward;2309 FW* _forward; 2310 BK* _backward; 2310 2311 2311 2312 }; … … 2314 2315 /// 2315 2316 /// This function just returns a combined arc map. 2316 template <typename ForwardMap, typename BackwardMap> 2317 static CombinedArcMap<ForwardMap, BackwardMap> 2318 combinedArcMap(ForwardMap& forward, BackwardMap& backward) { 2319 return CombinedArcMap<ForwardMap, BackwardMap>(forward, backward); 2320 } 2321 2322 template <typename ForwardMap, typename BackwardMap> 2323 static CombinedArcMap<const ForwardMap, BackwardMap> 2324 combinedArcMap(const ForwardMap& forward, BackwardMap& backward) { 2325 return CombinedArcMap<const ForwardMap, 2326 BackwardMap>(forward, backward); 2327 } 2328 2329 template <typename ForwardMap, typename BackwardMap> 2330 static CombinedArcMap<ForwardMap, const BackwardMap> 2331 combinedArcMap(ForwardMap& forward, const BackwardMap& backward) { 2332 return CombinedArcMap<ForwardMap, 2333 const BackwardMap>(forward, backward); 2334 } 2335 2336 template <typename ForwardMap, typename BackwardMap> 2337 static CombinedArcMap<const ForwardMap, const BackwardMap> 2338 combinedArcMap(const ForwardMap& forward, const BackwardMap& backward) { 2339 return CombinedArcMap<const ForwardMap, 2340 const BackwardMap>(forward, backward); 2317 template <typename FW, typename BK> 2318 static CombinedArcMap<FW, BK> 2319 combinedArcMap(FW& forward, BK& backward) { 2320 return CombinedArcMap<FW, BK>(forward, backward); 2321 } 2322 2323 template <typename FW, typename BK> 2324 static CombinedArcMap<const FW, BK> 2325 combinedArcMap(const FW& forward, BK& backward) { 2326 return CombinedArcMap<const FW, BK>(forward, backward); 2327 } 2328 2329 template <typename FW, typename BK> 2330 static CombinedArcMap<FW, const BK> 2331 combinedArcMap(FW& forward, const BK& backward) { 2332 return CombinedArcMap<FW, const BK>(forward, backward); 2333 } 2334 2335 template <typename FW, typename BK> 2336 static CombinedArcMap<const FW, const BK> 2337 combinedArcMap(const FW& forward, const BK& backward) { 2338 return CombinedArcMap<const FW, const BK>(forward, backward); 2341 2339 } 2342 2340 … … 3407 3405 /// This map adaptor class adapts two node maps of the original digraph 3408 3406 /// to get a node map of the split digraph. 3409 /// Its value type is inherited from the first node map type 3410 /// (\c InNodeMap). 3411 template <typename InNodeMap, typename OutNodeMap> 3407 /// Its value type is inherited from the first node map type (\c IN). 3408 /// \tparam IN The type of the node map for the innodes. 3409 /// \tparam OUT The type of the node map for the outnodes. 3410 template <typename IN, typename OUT> 3412 3411 class CombinedNodeMap { 3413 3412 public: … … 3416 3415 typedef Node Key; 3417 3416 /// The value type of the map 3418 typedef typename I nNodeMap::Value Value;3419 3420 typedef typename MapTraits<I nNodeMap>::ReferenceMapTag ReferenceMapTag;3421 typedef typename MapTraits<I nNodeMap>::ReturnValue ReturnValue;3422 typedef typename MapTraits<I nNodeMap>::ConstReturnValue ConstReturnValue;3423 typedef typename MapTraits<I nNodeMap>::ReturnValue Reference;3424 typedef typename MapTraits<I nNodeMap>::ConstReturnValue ConstReference;3417 typedef typename IN::Value Value; 3418 3419 typedef typename MapTraits<IN>::ReferenceMapTag ReferenceMapTag; 3420 typedef typename MapTraits<IN>::ReturnValue ReturnValue; 3421 typedef typename MapTraits<IN>::ConstReturnValue ConstReturnValue; 3422 typedef typename MapTraits<IN>::ReturnValue Reference; 3423 typedef typename MapTraits<IN>::ConstReturnValue ConstReference; 3425 3424 3426 3425 /// Constructor 3427 CombinedNodeMap(I nNodeMap& in_map, OutNodeMap& out_map)3426 CombinedNodeMap(IN& in_map, OUT& out_map) 3428 3427 : _in_map(in_map), _out_map(out_map) {} 3429 3428 … … 3457 3456 private: 3458 3457 3459 I nNodeMap& _in_map;3460 O utNodeMap& _out_map;3458 IN& _in_map; 3459 OUT& _out_map; 3461 3460 3462 3461 }; … … 3466 3465 /// 3467 3466 /// This function just returns a combined node map. 3468 template <typename InNodeMap, typename OutNodeMap> 3469 static CombinedNodeMap<InNodeMap, OutNodeMap> 3470 combinedNodeMap(InNodeMap& in_map, OutNodeMap& out_map) { 3471 return CombinedNodeMap<InNodeMap, OutNodeMap>(in_map, out_map); 3472 } 3473 3474 template <typename InNodeMap, typename OutNodeMap> 3475 static CombinedNodeMap<const InNodeMap, OutNodeMap> 3476 combinedNodeMap(const InNodeMap& in_map, OutNodeMap& out_map) { 3477 return CombinedNodeMap<const InNodeMap, OutNodeMap>(in_map, out_map); 3478 } 3479 3480 template <typename InNodeMap, typename OutNodeMap> 3481 static CombinedNodeMap<InNodeMap, const OutNodeMap> 3482 combinedNodeMap(InNodeMap& in_map, const OutNodeMap& out_map) { 3483 return CombinedNodeMap<InNodeMap, const OutNodeMap>(in_map, out_map); 3484 } 3485 3486 template <typename InNodeMap, typename OutNodeMap> 3487 static CombinedNodeMap<const InNodeMap, const OutNodeMap> 3488 combinedNodeMap(const InNodeMap& in_map, const OutNodeMap& out_map) { 3489 return CombinedNodeMap<const InNodeMap, 3490 const OutNodeMap>(in_map, out_map); 3467 template <typename IN, typename OUT> 3468 static CombinedNodeMap<IN, OUT> 3469 combinedNodeMap(IN& in_map, OUT& out_map) { 3470 return CombinedNodeMap<IN, OUT>(in_map, out_map); 3471 } 3472 3473 template <typename IN, typename OUT> 3474 static CombinedNodeMap<const IN, OUT> 3475 combinedNodeMap(const IN& in_map, OUT& out_map) { 3476 return CombinedNodeMap<const IN, OUT>(in_map, out_map); 3477 } 3478 3479 template <typename IN, typename OUT> 3480 static CombinedNodeMap<IN, const OUT> 3481 combinedNodeMap(IN& in_map, const OUT& out_map) { 3482 return CombinedNodeMap<IN, const OUT>(in_map, out_map); 3483 } 3484 3485 template <typename IN, typename OUT> 3486 static CombinedNodeMap<const IN, const OUT> 3487 combinedNodeMap(const IN& in_map, const OUT& out_map) { 3488 return CombinedNodeMap<const IN, const OUT>(in_map, out_map); 3491 3489 } 3492 3490 … … 3496 3494 /// This map adaptor class adapts an arc map and a node map of the 3497 3495 /// original digraph to get an arc map of the split digraph. 3498 /// Its value type is inherited from the original arc map type 3499 /// (\c ArcMap). 3500 template <typename ArcMap, typename NodeMap> 3496 /// Its value type is inherited from the original arc map type (\c AM). 3497 /// \tparam AM The type of the arc map. 3498 /// \tparam NM the type of the node map. 3499 template <typename AM, typename NM> 3501 3500 class CombinedArcMap { 3502 3501 public: … … 3505 3504 typedef Arc Key; 3506 3505 /// The value type of the map 3507 typedef typename A rcMap::Value Value;3508 3509 typedef typename MapTraits<A rcMap>::ReferenceMapTag ReferenceMapTag;3510 typedef typename MapTraits<A rcMap>::ReturnValue ReturnValue;3511 typedef typename MapTraits<A rcMap>::ConstReturnValue ConstReturnValue;3512 typedef typename MapTraits<A rcMap>::ReturnValue Reference;3513 typedef typename MapTraits<A rcMap>::ConstReturnValue ConstReference;3506 typedef typename AM::Value Value; 3507 3508 typedef typename MapTraits<AM>::ReferenceMapTag ReferenceMapTag; 3509 typedef typename MapTraits<AM>::ReturnValue ReturnValue; 3510 typedef typename MapTraits<AM>::ConstReturnValue ConstReturnValue; 3511 typedef typename MapTraits<AM>::ReturnValue Reference; 3512 typedef typename MapTraits<AM>::ConstReturnValue ConstReference; 3514 3513 3515 3514 /// Constructor 3516 CombinedArcMap(A rcMap& arc_map, NodeMap& node_map)3515 CombinedArcMap(AM& arc_map, NM& node_map) 3517 3516 : _arc_map(arc_map), _node_map(node_map) {} 3518 3517 … … 3545 3544 3546 3545 private: 3547 ArcMap& _arc_map; 3548 NodeMap& _node_map; 3546 3547 AM& _arc_map; 3548 NM& _node_map; 3549 3549 3550 }; 3550 3551
Note: See TracChangeset
for help on using the changeset viewer.