Changeset 664:4137ef9aacc6 in lemon for lemon/adaptors.h
 Timestamp:
 04/24/09 11:54:48 (11 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/adaptors.h
r626 r664 110 110 template <typename V> 111 111 class NodeMap : public DGR::template NodeMap<V> { 112 typedef typename DGR::template NodeMap<V> Parent; 113 112 114 public: 113 114 typedef typename DGR::template NodeMap<V> Parent;115 116 115 explicit NodeMap(const Adaptor& adaptor) 117 116 : Parent(*adaptor._digraph) {} 118 119 117 NodeMap(const Adaptor& adaptor, const V& value) 120 118 : Parent(*adaptor._digraph, value) { } … … 135 133 template <typename V> 136 134 class ArcMap : public DGR::template ArcMap<V> { 135 typedef typename DGR::template ArcMap<V> Parent; 136 137 137 public: 138 139 typedef typename DGR::template ArcMap<V> Parent;140 141 138 explicit ArcMap(const DigraphAdaptorBase<DGR>& adaptor) 142 139 : Parent(*adaptor._digraph) {} 143 144 140 ArcMap(const DigraphAdaptorBase<DGR>& adaptor, const V& value) 145 141 : Parent(*adaptor._digraph, value) {} … … 256 252 template <typename V> 257 253 class NodeMap : public GR::template NodeMap<V> { 254 typedef typename GR::template NodeMap<V> Parent; 255 258 256 public: 259 typedef typename GR::template NodeMap<V> Parent;260 257 explicit NodeMap(const GraphAdaptorBase<GR>& adapter) 261 258 : Parent(*adapter._graph) {} … … 278 275 template <typename V> 279 276 class ArcMap : public GR::template ArcMap<V> { 277 typedef typename GR::template ArcMap<V> Parent; 278 280 279 public: 281 typedef typename GR::template ArcMap<V> Parent;282 280 explicit ArcMap(const GraphAdaptorBase<GR>& adapter) 283 281 : Parent(*adapter._graph) {} … … 299 297 template <typename V> 300 298 class EdgeMap : public GR::template EdgeMap<V> { 299 typedef typename GR::template EdgeMap<V> Parent; 300 301 301 public: 302 typedef typename GR::template EdgeMap<V> Parent;303 302 explicit EdgeMap(const GraphAdaptorBase<GR>& adapter) 304 303 : Parent(*adapter._graph) {} … … 322 321 template <typename DGR> 323 322 class ReverseDigraphBase : public DigraphAdaptorBase<DGR> { 323 typedef DigraphAdaptorBase<DGR> Parent; 324 324 public: 325 325 typedef DGR Digraph; 326 typedef DigraphAdaptorBase<DGR> Parent;327 326 protected: 328 327 ReverseDigraphBase() : Parent() { } … … 375 374 public DigraphAdaptorExtender<ReverseDigraphBase<DGR> > { 376 375 #endif 376 typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent; 377 377 public: 378 378 /// The type of the adapted digraph. 379 379 typedef DGR Digraph; 380 typedef DigraphAdaptorExtender<ReverseDigraphBase<DGR> > Parent;381 380 protected: 382 381 ReverseDigraph() { } … … 404 403 template <typename DGR, typename NF, typename AF, bool ch = true> 405 404 class SubDigraphBase : public DigraphAdaptorBase<DGR> { 405 typedef DigraphAdaptorBase<DGR> Parent; 406 406 public: 407 407 typedef DGR Digraph; … … 410 410 411 411 typedef SubDigraphBase Adaptor; 412 typedef DigraphAdaptorBase<DGR> Parent;413 412 protected: 414 413 NF* _node_filter; … … 510 509 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 511 510 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 511 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 512 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 513 512 514 public: 513 515 typedef V Value; 514 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,515 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;516 516 517 517 NodeMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor) … … 536 536 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 537 537 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 538 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>, 539 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; 540 538 541 public: 539 542 typedef V Value; 540 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, ch>,541 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;542 543 543 544 ArcMap(const SubDigraphBase<DGR, NF, AF, ch>& adaptor) … … 563 564 class SubDigraphBase<DGR, NF, AF, false> 564 565 : public DigraphAdaptorBase<DGR> { 566 typedef DigraphAdaptorBase<DGR> Parent; 565 567 public: 566 568 typedef DGR Digraph; … … 569 571 570 572 typedef SubDigraphBase Adaptor; 571 typedef DigraphAdaptorBase<Digraph> Parent;572 573 protected: 573 574 NF* _node_filter; … … 651 652 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 652 653 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> { 654 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 655 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent; 656 653 657 public: 654 658 typedef V Value; 655 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,656 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, NodeMap<V>)> Parent;657 659 658 660 NodeMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor) … … 677 679 : public SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 678 680 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> { 681 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>, 682 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent; 683 679 684 public: 680 685 typedef V Value; 681 typedef SubMapExtender<SubDigraphBase<DGR, NF, AF, false>,682 LEMON_SCOPE_FIX(DigraphAdaptorBase<DGR>, ArcMap<V>)> Parent;683 686 684 687 ArcMap(const SubDigraphBase<DGR, NF, AF, false>& adaptor) … … 864 867 template <typename GR, typename NF, typename EF, bool ch = true> 865 868 class SubGraphBase : public GraphAdaptorBase<GR> { 869 typedef GraphAdaptorBase<GR> Parent; 866 870 public: 867 871 typedef GR Graph; … … 870 874 871 875 typedef SubGraphBase Adaptor; 872 typedef GraphAdaptorBase<GR> Parent;873 876 protected: 874 877 … … 1017 1020 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1018 1021 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1022 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1023 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1024 1019 1025 public: 1020 1026 typedef V Value; 1021 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,1022 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;1023 1027 1024 1028 NodeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) … … 1043 1047 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1044 1048 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1049 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1050 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1051 1045 1052 public: 1046 1053 typedef V Value; 1047 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,1048 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;1049 1054 1050 1055 ArcMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) … … 1069 1074 : public SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1070 1075 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1076 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>, 1077 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1078 1071 1079 public: 1072 1080 typedef V Value; 1073 typedef SubMapExtender<SubGraphBase<GR, NF, EF, ch>,1074 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;1075 1081 1076 1082 EdgeMap(const SubGraphBase<GR, NF, EF, ch>& adaptor) … … 1097 1103 class SubGraphBase<GR, NF, EF, false> 1098 1104 : public GraphAdaptorBase<GR> { 1105 typedef GraphAdaptorBase<GR> Parent; 1099 1106 public: 1100 1107 typedef GR Graph; … … 1103 1110 1104 1111 typedef SubGraphBase Adaptor; 1105 typedef GraphAdaptorBase<GR> Parent;1106 1112 protected: 1107 1113 NF* _node_filter; … … 1212 1218 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1213 1219 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> { 1220 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1221 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent; 1222 1214 1223 public: 1215 1224 typedef V Value; 1216 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,1217 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, NodeMap<V>)> Parent;1218 1225 1219 1226 NodeMap(const SubGraphBase<GR, NF, EF, false>& adaptor) … … 1238 1245 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1239 1246 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> { 1247 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1248 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent; 1249 1240 1250 public: 1241 1251 typedef V Value; 1242 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,1243 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, ArcMap<V>)> Parent;1244 1252 1245 1253 ArcMap(const SubGraphBase<GR, NF, EF, false>& adaptor) … … 1264 1272 : public SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1265 1273 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> { 1274 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>, 1275 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent; 1276 1266 1277 public: 1267 1278 typedef V Value; 1268 typedef SubMapExtender<SubGraphBase<GR, NF, EF, false>,1269 LEMON_SCOPE_FIX(GraphAdaptorBase<GR>, EdgeMap<V>)> Parent;1270 1279 1271 1280 EdgeMap(const SubGraphBase<GR, NF, EF, false>& adaptor) … … 1486 1495 true> > { 1487 1496 #endif 1488 public:1489 1490 typedef GR Digraph;1491 typedef NF NodeFilterMap;1492 1493 1497 typedef DigraphAdaptorExtender< 1494 1498 SubDigraphBase<GR, NF, ConstMap<typename GR::Arc, Const<bool, true> >, 1495 1499 true> > Parent; 1500 1501 public: 1502 1503 typedef GR Digraph; 1504 typedef NF NodeFilterMap; 1496 1505 1497 1506 typedef typename Parent::Node Node; … … 1549 1558 true> > { 1550 1559 1551 public:1552 typedef GR Graph;1553 typedef NF NodeFilterMap;1554 1560 typedef GraphAdaptorExtender< 1555 1561 SubGraphBase<GR, NF, ConstMap<typename GR::Edge, Const<bool, true> >, 1556 1562 true> > Parent; 1557 1563 1564 public: 1565 1566 typedef GR Graph; 1567 typedef NF NodeFilterMap; 1568 1558 1569 typedef typename Parent::Node Node; 1570 1559 1571 protected: 1560 1572 ConstMap<typename GR::Edge, Const<bool, true> > const_true_map; … … 1630 1642 AF, false> > { 1631 1643 #endif 1632 public: 1644 typedef DigraphAdaptorExtender< 1645 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >, 1646 AF, false> > Parent; 1647 1648 public: 1649 1633 1650 /// The type of the adapted digraph. 1634 1651 typedef DGR Digraph; 1635 1652 /// The type of the arc filter map. 1636 1653 typedef AF ArcFilterMap; 1637 1638 typedef DigraphAdaptorExtender<1639 SubDigraphBase<DGR, ConstMap<typename DGR::Node, Const<bool, true> >,1640 AF, false> > Parent;1641 1654 1642 1655 typedef typename Parent::Arc Arc; … … 1739 1752 EF, false> > { 1740 1753 #endif 1741 public: 1754 typedef GraphAdaptorExtender< 1755 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >, 1756 EF, false> > Parent; 1757 1758 public: 1759 1742 1760 /// The type of the adapted graph. 1743 1761 typedef GR Graph; 1744 1762 /// The type of the edge filter map. 1745 1763 typedef EF EdgeFilterMap; 1746 1747 typedef GraphAdaptorExtender<1748 SubGraphBase<GR, ConstMap<typename GR::Node, Const<bool, true > >,1749 EF, false> > Parent;1750 1764 1751 1765 typedef typename Parent::Edge Edge; … … 2112 2126 template <typename V> 2113 2127 class NodeMap : public DGR::template NodeMap<V> { 2128 typedef typename DGR::template NodeMap<V> Parent; 2129 2114 2130 public: 2115 2116 2131 typedef V Value; 2117 typedef typename DGR::template NodeMap<Value> Parent;2118 2132 2119 2133 explicit NodeMap(const UndirectorBase<DGR>& adaptor) … … 2138 2152 template <typename V> 2139 2153 class ArcMap 2140 : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > 2141 { 2154 : public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > { 2155 typedef SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > Parent; 2156 2142 2157 public: 2143 2158 typedef V Value; 2144 typedef SubMapExtender<Adaptor, ArcMapBase<V> > Parent;2145 2159 2146 2160 explicit ArcMap(const UndirectorBase<DGR>& adaptor) … … 2164 2178 template <typename V> 2165 2179 class EdgeMap : public Digraph::template ArcMap<V> { 2180 typedef typename Digraph::template ArcMap<V> Parent; 2181 2166 2182 public: 2167 2168 2183 typedef V Value; 2169 typedef typename Digraph::template ArcMap<V> Parent;2170 2184 2171 2185 explicit EdgeMap(const UndirectorBase<DGR>& adaptor) … … 2239 2253 public GraphAdaptorExtender<UndirectorBase<DGR> > { 2240 2254 #endif 2255 typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent; 2241 2256 public: 2242 2257 /// The type of the adapted digraph. 2243 2258 typedef DGR Digraph; 2244 typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent;2245 2259 protected: 2246 2260 Undirector() { } … … 2450 2464 template <typename V> 2451 2465 class NodeMap : public GR::template NodeMap<V> { 2466 typedef typename GR::template NodeMap<V> Parent; 2467 2452 2468 public: 2453 2454 typedef typename GR::template NodeMap<V> Parent;2455 2469 2456 2470 explicit NodeMap(const OrienterBase<GR, DM>& adapter) … … 2475 2489 template <typename V> 2476 2490 class ArcMap : public GR::template EdgeMap<V> { 2491 typedef typename Graph::template EdgeMap<V> Parent; 2492 2477 2493 public: 2478 2479 typedef typename Graph::template EdgeMap<V> Parent;2480 2494 2481 2495 explicit ArcMap(const OrienterBase<GR, DM>& adapter) … … 2547 2561 public DigraphAdaptorExtender<OrienterBase<GR, DM> > { 2548 2562 #endif 2563 typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent; 2549 2564 public: 2550 2565 … … 2554 2569 typedef DM DirectionMap; 2555 2570 2556 typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent;2557 2571 typedef typename Parent::Arc Arc; 2572 2558 2573 protected: 2559 2574 Orienter() { } 2575 2560 2576 public: 2561 2577 … … 2867 2883 template <typename DGR> 2868 2884 class SplitNodesBase { 2885 typedef DigraphAdaptorBase<const DGR> Parent; 2886 2869 2887 public: 2870 2888 2871 2889 typedef DGR Digraph; 2872 typedef DigraphAdaptorBase<const DGR> Parent;2873 2890 typedef SplitNodesBase Adaptor; 2874 2891 … … 3229 3246 template <typename V> 3230 3247 class NodeMap 3231 : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > 3232 { 3248 : public SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > { 3249 typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<V> > Parent; 3250 3233 3251 public: 3234 3252 typedef V Value; 3235 typedef SubMapExtender<SplitNodesBase<DGR>, NodeMapBase<Value> > Parent;3236 3253 3237 3254 NodeMap(const SplitNodesBase<DGR>& adaptor) … … 3255 3272 template <typename V> 3256 3273 class ArcMap 3257 : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > 3258 { 3274 : public SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > { 3275 typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<V> > Parent; 3276 3259 3277 public: 3260 3278 typedef V Value; 3261 typedef SubMapExtender<SplitNodesBase<DGR>, ArcMapBase<Value> > Parent;3262 3279 3263 3280 ArcMap(const SplitNodesBase<DGR>& adaptor) … … 3325 3342 : public DigraphAdaptorExtender<SplitNodesBase<const DGR> > { 3326 3343 #endif 3344 typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent; 3345 3327 3346 public: 3328 3347 typedef DGR Digraph; 3329 typedef DigraphAdaptorExtender<SplitNodesBase<const DGR> > Parent;3330 3348 3331 3349 typedef typename DGR::Node DigraphNode;
Note: See TracChangeset
for help on using the changeset viewer.