Changeset 822:88226d9fe821 in lemon-0.x for src/hugo/list_graph.h
- Timestamp:
- 09/08/04 14:06:45 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1118
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/list_graph.h
r813 r822 14 14 15 15 #include <hugo/map_registry.h> 16 #include <hugo/default_map _factory.h>17 18 #include <hugo/sym_map _factory.h>16 #include <hugo/default_map.h> 17 18 #include <hugo/sym_map.h> 19 19 20 20 #include <hugo/map_defines.h> … … 80 80 class InEdgeIt; 81 81 82 /// Creating map registries. 82 83 CREATE_MAP_REGISTRIES; 83 CREATE_MAPS(DefaultMapFactory); 84 /// Creating node and edge maps. 85 CREATE_MAPS(DefaultMap); 84 86 85 87 public: … … 444 446 typedef SymListGraph Graph; 445 447 446 KEEP_NODE_MAP(ListGraph); 447 KEEP_EDGE_MAP(ListGraph); 448 448 /// Importing maps from the base class ListGraph. 449 KEEP_MAPS(ListGraph, SymListGraph); 450 451 /// Creating symmetric map registry. 449 452 CREATE_SYM_EDGE_MAP_REGISTRY; 450 CREATE_SYM_EDGE_MAP_FACTORY(DefaultMapFactory);451 IMPORT_SYM_EDGE_MAP(SymEdgeMapFactory);453 /// Creating symmetric edge map. 454 CREATE_SYM_EDGE_MAP(DefaultMap); 452 455 453 456 SymListGraph() : ListGraph() { } … … 530 533 class InEdgeIt; 531 534 532 CREATE_MAP_REGISTRIES; 533 CREATE_MAPS(DefaultMapFactory); 535 /// Creating node map registry. 536 CREATE_NODE_MAP_REGISTRY; 537 /// Creating node maps. 538 CREATE_NODE_MAP(DefaultMap); 539 540 /// Creating empty map structure for edges. 541 template <typename Value> 542 class EdgeMap { 543 public: 544 EdgeMap() {} 545 EdgeMap(const Graph&) {} 546 EdgeMap(const Graph&, const Value&) {} 547 548 EdgeMap(const EdgeMap&) {} 549 template <typename CMap> EdgeMap(const CMap&) {} 550 551 EdgeMap& operator=(const EdgeMap&) {} 552 template <typename CMap> EdgeMap& operator=(const CMap&) {} 553 554 class ConstIterator { 555 public: 556 bool operator==(const ConstIterator&) {return true;} 557 bool operator!=(const ConstIterator&) {return false;} 558 }; 559 560 typedef ConstIterator Iterator; 561 562 Iterator begin() { return Iterator();} 563 Iterator end() { return Iterator();} 564 565 ConstIterator begin() const { return ConstIterator();} 566 ConstIterator end() const { return ConstIterator();} 567 568 }; 534 569 535 570 public: … … 849 884 850 885 886 /// Creating edge map registry. 851 887 CREATE_EDGE_MAP_REGISTRY; 852 CREATE_EDGE_MAP_FACTORY(DefaultMapFactory); 853 IMPORT_EDGE_MAP(EdgeMapFactory); 888 /// Creating edge maps. 889 CREATE_EDGE_MAP(DefaultMap); 890 891 /// Importing node maps from the NodeGraphType. 892 IMPORT_NODE_MAP(NodeGraphType, graph.G, EdgeSet, graph); 854 893 855 894 … … 1091 1130 InEdgeIt &operator++() { n=G->edges[n].next_in; return *this; } 1092 1131 }; 1093 1094 1095 template <typename V> class NodeMap 1096 : public NodeGraphType::template NodeMap<V> 1097 { 1098 //This is a must, the constructors need it. 1099 typedef typename NodeGraphType::template NodeMap<V> MapImpl; 1100 typedef V Value; 1101 public: 1102 NodeMap() : MapImpl() {} 1103 1104 NodeMap(const EdgeSet& graph) 1105 : MapImpl(graph.G) { } 1106 1107 NodeMap(const EdgeSet& graph, const Value& value) 1108 : MapImpl(graph.G, value) { } 1109 1110 NodeMap(const NodeMap& copy) 1111 : MapImpl(static_cast<const MapImpl&>(copy)) {} 1112 1113 template<typename CMap> 1114 NodeMap(const CMap& copy) 1115 : MapImpl(copy) { } 1116 1117 NodeMap& operator=(const NodeMap& copy) { 1118 MapImpl::operator=(static_cast<const MapImpl&>(copy)); 1119 return *this; 1120 } 1121 1122 template <typename CMap> 1123 NodeMap& operator=(const CMap& copy) { 1124 MapImpl::operator=(copy); 1125 return *this; 1126 } 1127 1128 }; 1132 1129 1133 }; 1130 1134
Note: See TracChangeset
for help on using the changeset viewer.