Changeset 891:74589d20dbc3 in lemon-0.x for src/hugo
- Timestamp:
- 09/21/04 00:57:48 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1199
- Location:
- src/hugo
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/array_map.h
r844 r891 66 66 /** Default constructor for the map. 67 67 */ 68 ArrayMap() : values(0), capacity(0) {}68 ArrayMap() : capacity(0), values(0) {} 69 69 70 70 /** Graph and Registry initialized map constructor. … … 91 91 /** Constructor to copy a map of the same map type. 92 92 */ 93 ArrayMap(const ArrayMap& copy) : MapBase( *copy.graph, *copy.registry) {93 ArrayMap(const ArrayMap& copy) : MapBase(copy) { 94 94 capacity = copy.capacity; 95 95 if (capacity == 0) return; … … 103 103 /** Constructor to copy a map of an other map type. 104 104 */ 105 template <typename CMap> ArrayMap(const CMap& copy) 106 : MapBase(copy), capacity(0), values(0) { 107 if (MapBase::getGraph()) { 108 allocate_memory(); 109 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 110 set(it, copy[it]); 111 } 105 template <typename TT> 106 ArrayMap(const ArrayMap<MapRegistry, TT>& copy) 107 : MapBase(copy) { 108 capacity = copy.capacity; 109 if (capacity == 0) return; 110 values = allocator.allocate(capacity); 111 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 112 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 113 allocator.construct(&(values[id]), copy.values[id]); 112 114 } 113 115 } … … 117 119 ArrayMap& operator=(const ArrayMap& copy) { 118 120 if (© == this) return *this; 121 119 122 if (capacity != 0) { 120 123 MapBase::destroy(); 121 124 allocator.deallocate(values, capacity); 122 125 } 126 127 MapBase::operator=(copy); 128 123 129 capacity = copy.capacity; 124 130 if (capacity == 0) return *this; 125 131 values = allocator.allocate(capacity); 132 126 133 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 127 134 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 128 135 allocator.construct(&(values[id]), copy.values[id]); 129 136 } 137 130 138 return *this; 131 139 } 132 140 133 /** Assign operator to copy a map an other map type. 134 */ 135 template <typename CMap> ArrayMap& operator=(const CMap& copy) { 141 /** Assign operator to copy a map of an other map type. 142 */ 143 template <typename TT> 144 ArrayMap& operator=(const ArrayMap<MapRegistry, TT>& copy) { 136 145 if (capacity != 0) { 137 146 MapBase::destroy(); 138 147 allocator.deallocate(values, capacity); 139 148 } 149 140 150 MapBase::operator=(copy); 141 if (MapBase::getGraph()) { 142 allocate_memory(); 143 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 144 set(it, copy[it]); 145 } 146 } 151 152 capacity = copy.capacity; 153 if (capacity == 0) return *this; 154 values = allocator.allocate(capacity); 155 156 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 157 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 158 allocator.construct(&(values[id]), copy.values[id]); 159 } 160 147 161 return *this; 148 162 } -
src/hugo/default_map.h
r822 r891 30 30 */ 31 31 #define DEFAULT_MAP_BODY(DynMap, Value) \ 32 33 typedef DynMap<MapRegistry, Value> MapImpl;\34 35 public:\36 37 typedef typename MapRegistry::Graph Graph;\38 39 DefaultMap() : MapImpl() {}\40 41 DefaultMap(const Graph& g, MapRegistry& r) : MapImpl(g, r) {} \42 43 DefaultMap(const Graph& g, MapRegistry& r, const Value& v)\44 : MapImpl(g, r, v) {}\45 \46 DefaultMap(const DefaultMap& copy)\47 : MapImpl(static_cast<const MapImpl&>(copy)) {}\48 \49 template <typename CMap> DefaultMap(const CMap& copy) : MapImpl(copy) {}\50 \51 DefaultMap& operator=(const DefaultMap& copy) {\52 MapImpl::operator=(static_cast<const MapImpl&>(copy)); \53 return *this; \32 { \ 33 \ 34 public: \ 35 \ 36 typedef DynMap<MapRegistry, Value> Parent; \ 37 \ 38 typedef typename MapRegistry::Graph Graph; \ 39 \ 40 DefaultMap() : Parent() {} \ 41 DefaultMap(const Graph& g, MapRegistry& r) : Parent(g, r) {} \ 42 DefaultMap(const Graph& g, MapRegistry& r, const Value& v) \ 43 : Parent(g, r, v) {} \ 44 DefaultMap(const DefaultMap& copy) \ 45 : Parent(static_cast<const Parent&>(copy)) {} \ 46 template <typename TT> \ 47 DefaultMap(const DefaultMap<MapRegistry, TT>& copy) { \ 48 Parent::MapBase::operator= \ 49 (static_cast<const typename Parent::MapBase&>(copy)); \ 50 if (Parent::getGraph()) { \ 51 for (typename Parent::KeyIt it(*Parent::getGraph()); it!=INVALID; ++it) {\ 52 Parent::add(it); \ 53 Parent::operator[](it) = copy[it]; \ 54 54 } \ 55 \ 56 template <typename CMap> DefaultMap& operator=(const CMap& copy) { \ 57 MapImpl::operator=(copy); \ 58 return *this; \ 55 } \ 56 } \ 57 DefaultMap& operator=(const DefaultMap& copy) { \ 58 Parent::operator=(static_cast<const Parent&>(copy)); \ 59 return *this; \ 60 } \ 61 template <typename TT> \ 62 DefaultMap& operator=(const DefaultMap<MapRegistry, TT>& copy) { \ 63 Parent::clear(); \ 64 Parent::MapBase::operator=(copy); \ 65 if (Parent::getGraph()) { \ 66 for (typename Parent::KeyIt it(*Parent::getGraph()); it!=INVALID; ++it) {\ 67 Parent::add(it); \ 68 Parent::operator[](it) = copy[it]; \ 59 69 } \ 60 \ 61 }; 70 } \ 71 return *this; \ 72 } \ 73 }; 62 74 63 75 -
src/hugo/graph_wrapper.h
r888 r891 287 287 return GraphWrapper<Graph>::tail(e); } 288 288 289 KEEP_MAPS(Parent, RevGraphWrapper);289 // KEEP_MAPS(Parent, RevGraphWrapper); 290 290 291 291 }; … … 494 494 } 495 495 496 KEEP_MAPS(Parent, SubGraphWrapper);496 // KEEP_MAPS(Parent, SubGraphWrapper); 497 497 }; 498 498 … … 559 559 return this->graph->tail(e); } 560 560 561 KEEP_MAPS(Parent, UndirGraphWrapper);561 // KEEP_MAPS(Parent, UndirGraphWrapper); 562 562 563 563 }; … … 566 566 /// 567 567 ///\warning Graph wrappers are in even more experimental state than the other 568 ///parts of the lib. Use them at you own risk.568 ///parts of the lib. Use them at your own risk. 569 569 /// 570 570 /// An undirected graph template. … … 582 582 } 583 583 584 KEEP_MAPS(Parent, UndirGraph);584 // KEEP_MAPS(Parent, UndirGraph); 585 585 }; 586 586 … … 895 895 /// one for the backward edges. 896 896 class EdgeMap { 897 template <typename TT> friend class EdgeMap; 897 898 typename Graph::template EdgeMap<T> forward_map, backward_map; 898 899 public: 899 900 typedef T ValueType; 900 901 typedef Edge KeyType; 902 901 903 EdgeMap(const SubBidirGraphWrapper<Graph, 902 904 ForwardFilterMap, BackwardFilterMap>& g) : 903 905 forward_map(*(g.graph)), backward_map(*(g.graph)) { } 906 904 907 EdgeMap(const SubBidirGraphWrapper<Graph, 905 908 ForwardFilterMap, BackwardFilterMap>& g, T a) : 906 909 forward_map(*(g.graph), a), backward_map(*(g.graph), a) { } 910 911 template <typename TT> 912 EdgeMap(const EdgeMap<TT>& copy) 913 : forward_map(copy.forward_map), backward_map(copy.backward_map) {} 914 915 template <typename TT> 916 EdgeMap& operator=(const EdgeMap<TT>& copy) { 917 forward_map = copy.forward_map; 918 backward_map = copy.backward_map; 919 return *this; 920 } 921 907 922 void set(Edge e, T a) { 908 923 if (!e.backward) … … 911 926 backward_map.set(e, a); 912 927 } 913 T operator[](Edge e) const { 928 929 typename Graph::template EdgeMap<T>::ConstReferenceType 930 operator[](Edge e) const { 914 931 if (!e.backward) 915 932 return forward_map[e]; … … 917 934 return backward_map[e]; 918 935 } 936 937 typename Graph::template EdgeMap<T>::ReferenceType 938 operator[](Edge e) { 939 if (!e.backward) 940 return forward_map[e]; 941 else 942 return backward_map[e]; 943 } 944 919 945 void update() { 920 946 forward_map.update(); … … 924 950 925 951 926 KEEP_NODE_MAP(Parent, SubBidirGraphWrapper);952 // KEEP_NODE_MAP(Parent, SubBidirGraphWrapper); 927 953 928 954 }; … … 966 992 return 2*this->graph->edgeNum(); 967 993 } 968 KEEP_MAPS(Parent, BidirGraphWrapper);994 // KEEP_MAPS(Parent, BidirGraphWrapper); 969 995 }; 970 996 … … 992 1018 Parent::setGraph(gr); 993 1019 } 994 KEEP_MAPS(Parent, BidirGraph);1020 // KEEP_MAPS(Parent, BidirGraph); 995 1021 }; 996 1022 … … 1107 1133 }; 1108 1134 1109 KEEP_MAPS(Parent, ResGraphWrapper);1135 // KEEP_MAPS(Parent, ResGraphWrapper); 1110 1136 }; 1111 1137 … … 1169 1195 } 1170 1196 1171 KEEP_MAPS(Parent, ErasingFirstGraphWrapper);1197 // KEEP_MAPS(Parent, ErasingFirstGraphWrapper); 1172 1198 }; 1173 1199 -
src/hugo/list_graph.h
r880 r891 443 443 typedef SymListGraph Graph; 444 444 445 /// Importing maps from the base class ListGraph.446 KEEP_MAPS(ListGraph, SymListGraph);447 448 445 /// Creating symmetric map registry. 449 446 CREATE_SYM_EDGE_MAP_REGISTRY; -
src/hugo/map_defines.h
r877 r891 39 39 template <typename Value> \ 40 40 class NodeMap : public DynMap<NodeMapRegistry, Value> { \ 41 typedef DynMap<NodeMapRegistry, Value> MapImpl;\42 public:\41 public: \ 42 typedef DynMap<NodeMapRegistry, Value> Parent; \ 43 43 NodeMap() {} \ 44 NodeMap(const typename MapImpl::Graph& g) \ 45 : MapImpl(g, g.node_maps) {} \ 46 NodeMap(const typename MapImpl::Graph& g, const Value& v) \ 47 : MapImpl(g, g.node_maps, v) {} \ 48 NodeMap(const NodeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \ 49 template <typename CMap> NodeMap(const CMap& copy) : MapImpl(copy) {} \ 44 NodeMap(const typename Parent::Graph& g) \ 45 : Parent(g, g.node_maps) {} \ 46 NodeMap(const typename Parent::Graph& g, const Value& v) \ 47 : Parent(g, g.node_maps, v) {} \ 48 NodeMap(const NodeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \ 49 template <typename TT> \ 50 NodeMap(const NodeMap<TT>& copy) \ 51 : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \ 50 52 NodeMap& operator=(const NodeMap& copy) { \ 51 MapImpl::operator=(static_cast<const MapImpl&>(copy));\ 52 return *this; \ 53 } \ 54 template <typename CMap> NodeMap& operator=(const CMap& copy) { \ 55 MapImpl::operator=(copy);\ 53 Parent::operator=(static_cast<const Parent&>(copy));\ 54 return *this; \ 55 } \ 56 template <typename TT> \ 57 NodeMap& operator=(const NodeMap<TT>& copy) { \ 58 Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\ 56 59 return *this; \ 57 60 } \ … … 67 70 template <typename Value> \ 68 71 class EdgeMap : public DynMap<EdgeMapRegistry, Value> { \ 69 typedef DynMap<EdgeMapRegistry, Value> MapImpl; \ 70 public: \ 72 public: \ 73 typedef DynMap<EdgeMapRegistry, Value> Parent; \ 74 \ 71 75 EdgeMap() {} \ 72 EdgeMap(const typename MapImpl::Graph& g) \ 73 : MapImpl(g, g.edge_maps) {} \ 74 EdgeMap(const typename MapImpl::Graph& g, const Value& v) \ 75 : MapImpl(g, g.edge_maps, v) {} \ 76 EdgeMap(const EdgeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \ 77 template <typename CMap> EdgeMap(const CMap& copy) : MapImpl(copy) {} \ 76 EdgeMap(const typename Parent::Graph& g) \ 77 : Parent(g, g.edge_maps) {} \ 78 EdgeMap(const typename Parent::Graph& g, const Value& v) \ 79 : Parent(g, g.edge_maps, v) {} \ 80 EdgeMap(const EdgeMap& copy) : Parent(static_cast<const Parent&>(copy)) {} \ 81 template <typename TT> \ 82 EdgeMap(const EdgeMap<TT>& copy) \ 83 : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \ 78 84 EdgeMap& operator=(const EdgeMap& copy) { \ 79 MapImpl::operator=(static_cast<const MapImpl&>(copy));\ 80 return *this; \ 81 } \ 82 template <typename CMap> EdgeMap& operator=(const CMap& copy) { \ 83 MapImpl::operator=(copy);\ 85 Parent::operator=(static_cast<const Parent&>(copy));\ 86 return *this; \ 87 } \ 88 template <typename TT> \ 89 EdgeMap& operator=(const EdgeMap<TT>& copy) { \ 90 Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\ 84 91 return *this; \ 85 92 } \ … … 109 116 template <typename Value> \ 110 117 class SymEdgeMap : public SymMap<DynMap, SymEdgeMapRegistry, Value> { \ 111 typedef SymMap<DynMap, SymEdgeMapRegistry, Value> MapImpl; \ 112 public: \ 113 \ 114 SymEdgeMap() {} \ 115 \ 116 SymEdgeMap(const typename MapImpl::Graph& g) \ 117 : MapImpl(g, g.sym_edge_maps) {} \ 118 \ 119 SymEdgeMap(const typename MapImpl::Graph& g, const Value& v) \ 120 : MapImpl(g, g.sym_edge_maps, v) {} \ 121 \ 122 SymEdgeMap(const SymEdgeMap& copy) \ 123 : MapImpl(static_cast<const MapImpl&>(copy)) {} \ 124 \ 125 template <typename CMap> SymEdgeMap(const CMap& copy) : MapImpl(copy) {} \ 126 SymEdgeMap& operator=(const SymEdgeMap& copy) { \ 127 MapImpl::operator=(static_cast<const MapImpl&>(copy));\ 128 return *this; \ 129 } \ 130 \ 131 template <typename CMap> SymEdgeMap& operator=(const CMap& copy) { \ 132 MapImpl::operator=(copy);\ 133 return *this; \ 134 } \ 135 }; 136 118 public: \ 119 typedef SymMap<DynMap, SymEdgeMapRegistry, Value> Parent; \ 120 \ 121 SymEdgeMap() {} \ 122 SymEdgeMap(const typename Parent::Graph& g) \ 123 : Parent(g, g.sym_edge_maps) {} \ 124 SymEdgeMap(const typename Parent::Graph& g, const Value& v) \ 125 : Parent(g, g.sym_edge_maps, v) {} \ 126 SymEdgeMap(const SymEdgeMap& copy) \ 127 : Parent(static_cast<const Parent&>(copy)) {} \ 128 template <typename TT> \ 129 SymEdgeMap(const NodeMap<TT>& copy) \ 130 : Parent(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy)) {} \ 131 SymEdgeMap& operator=(const SymEdgeMap& copy) { \ 132 Parent::operator=(static_cast<const Parent&>(copy));\ 133 return *this; \ 134 } \ 135 template <typename TT> \ 136 SymEdgeMap& operator=(const SymEdgeMap<TT>& copy) { \ 137 Parent::operator=(static_cast<const typename SymEdgeMap<TT>::Parent&>(copy));\ 138 return *this; \ 139 } \ 140 }; 137 141 138 142 /** This is a macro to import an node map into a graph class. … … 140 144 #define IMPORT_NODE_MAP(From, from, To, to) \ 141 145 template <typename Value> \ 142 class NodeMap \ 143 : public From::template NodeMap<Value> { \ 144 typedef typename From::template NodeMap<Value> MapImpl; \ 145 public: \ 146 NodeMap() : MapImpl() {} \ 147 \ 148 NodeMap(const To& to) \ 149 : MapImpl(static_cast<const From&>(from)) { } \ 150 \ 151 NodeMap(const To& to, const Value& value) \ 152 : MapImpl(static_cast<const From&>(from), value) { } \ 153 \ 154 NodeMap(const NodeMap& copy) \ 155 : MapImpl(static_cast<const MapImpl&>(copy)) {} \ 156 \ 157 template<typename CMap> \ 158 NodeMap(const CMap& copy) \ 159 : MapImpl(copy) {} \ 160 \ 161 NodeMap& operator=(const NodeMap& copy) { \ 162 MapImpl::operator=(static_cast<const MapImpl&>(copy)); \ 163 return *this; \ 164 } \ 165 \ 166 template <typename CMap> \ 167 NodeMap& operator=(const CMap& copy) { \ 168 MapImpl::operator=(copy); \ 169 return *this; \ 170 } \ 146 class NodeMap : public From::template NodeMap<Value> { \ 147 \ 148 public: \ 149 typedef typename From::template NodeMap<Value> Parent; \ 150 \ 151 NodeMap() : Parent() {} \ 152 NodeMap(const To& to) \ 153 : Parent(static_cast<const From&>(from)) { } \ 154 NodeMap(const To& to, const Value& value) \ 155 : Parent(static_cast<const From&>(from), value) { } \ 156 NodeMap(const NodeMap& copy) \ 157 : Parent(static_cast<const Parent&>(copy)) {} \ 158 template <typename TT> \ 159 NodeMap(const NodeMap<TT>& copy) \ 160 : Parent(static_cast<const typename NodeMap<TT>::Parent&>(copy)) {} \ 161 NodeMap& operator=(const NodeMap& copy) { \ 162 Parent::operator=(static_cast<const Parent&>(copy)); \ 163 return *this; \ 164 } \ 165 template <typename TT> \ 166 NodeMap& operator=(const NodeMap<TT>& copy) { \ 167 Parent::operator=(static_cast<const typename NodeMap<TT>::Parent&>(copy));\ 168 return *this; \ 169 } \ 171 170 }; 172 171 … … 175 174 #define IMPORT_EDGE_MAP(From, from, To, to) \ 176 175 template <typename Value> \ 177 class EdgeMap \ 178 : public From::template EdgeMap<Value> { \ 179 typedef typename From::template EdgeMap<Value> MapImpl; \ 180 public: \ 181 EdgeMap() : MapImpl() {} \ 182 \ 183 EdgeMap(const To& to) \ 184 : MapImpl(static_cast<const From&>(from)) { } \ 185 \ 186 EdgeMap(const To& to, const Value& value) \ 187 : MapImpl(static_cast<const From&>(from), value) { } \ 188 \ 189 EdgeMap(const EdgeMap& copy) \ 190 : MapImpl(static_cast<const MapImpl&>(copy)) {} \ 191 \ 192 template<typename CMap> \ 193 EdgeMap(const CMap& copy) \ 194 : MapImpl(copy) {} \ 195 \ 196 EdgeMap& operator=(const EdgeMap& copy) { \ 197 MapImpl::operator=(static_cast<const MapImpl&>(copy)); \ 198 return *this; \ 199 } \ 200 \ 201 template <typename CMap> \ 202 EdgeMap& operator=(const CMap& copy) { \ 203 MapImpl::operator=(copy); \ 204 return *this; \ 205 } \ 176 class EdgeMap : public From::template EdgeMap<Value> { \ 177 \ 178 public: \ 179 typedef typename From::template EdgeMap<Value> Parent; \ 180 \ 181 EdgeMap() : Parent() {} \ 182 EdgeMap(const To& to) \ 183 : Parent(static_cast<const From&>(from)) { } \ 184 EdgeMap(const To& to, const Value& value) \ 185 : Parent(static_cast<const From&>(from), value) { } \ 186 EdgeMap(const EdgeMap& copy) \ 187 : Parent(static_cast<const Parent&>(copy)) {} \ 188 template <typename TT> \ 189 EdgeMap(const EdgeMap<TT>& copy) \ 190 : Parent(static_cast<const typename EdgeMap<TT>::Parent&>(copy)) {} \ 191 EdgeMap& operator=(const EdgeMap& copy) { \ 192 Parent::operator=(static_cast<const Parent&>(copy)); \ 193 return *this; \ 194 } \ 195 template <typename TT> \ 196 EdgeMap& operator=(const EdgeMap<TT>& copy) { \ 197 Parent::operator=(static_cast<const typename EdgeMap<TT>::Parent&>(copy));\ 198 return *this; \ 199 } \ 206 200 }; 207 201 -
src/hugo/map_registry.h
r822 r891 71 71 * Assign operator. 72 72 */ 73 74 73 const MapBase& operator=(const MapBase& copy) { 75 74 if (registry) { -
src/hugo/smart_graph.h
r880 r891 318 318 typedef SymSmartGraph Graph; 319 319 320 /// Importing maps from the base class ListGraph.321 KEEP_MAPS(SmartGraph, SymSmartGraph);322 323 320 /// Creating symmetric map registry. 324 321 CREATE_SYM_EDGE_MAP_REGISTRY; -
src/hugo/sym_map.h
r844 r891 104 104 : MapImpl(static_cast<const MapImpl&>(copy)) {} 105 105 106 /** Constructor to copy a map of an other map type.107 */108 template <typename CMap> SymMap(const CMap& copy)109 : MapImpl(copy) {}110 111 106 /** Assign operator to copy a map of the same map type. 112 107 */ … … 116 111 } 117 112 118 /** Assign operator to copy a map of an other map type.119 */120 template <typename CMap> SymMap& operator=(const CMap& copy) {121 MapImpl::operator=(copy);122 return *this;123 }124 125 113 /** Add a new key to the map. It called by the map registry. 126 114 */ -
src/hugo/vector_map.h
r844 r891 33 33 template <typename MapRegistry, typename Value> 34 34 class VectorMap : public MapRegistry::MapBase { 35 template <typename MR, typename T> friend class VectorMap; 35 36 public: 36 37 … … 83 84 : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1, v) {} 84 85 85 /** Constructor to copy a map of an other map type.86 */ 87 template <typename CMap> VectorMap(const CMap& copy) : MapBase(copy) {88 if (MapBase::getGraph()) {89 container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1); 90 91 set(it, copy[it]);92 }86 /** Assign operator to copy a map of an other map type. 87 */ 88 template <typename TT> 89 VectorMap(const VectorMap<MapRegistry, TT>& c) 90 : MapBase(c), container(c.container.size()) { 91 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 92 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 93 container[id] = c.container[id]; 93 94 } 94 95 } 95 96 96 /** Assign operator to copy a map an other map type. 97 */ 98 template <typename CMap> VectorMap& operator=(const CMap& copy) { 99 container.clear(); 100 this->MapBase::operator=(copy); 101 if (MapBase::getGraph()) { 102 container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1); 103 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 104 set(it, copy[it]); 105 } 97 /** Assign operator to copy a map of an other map type. 98 */ 99 template <typename TT> 100 VectorMap& operator=(const VectorMap<MapRegistry, TT>& c) { 101 container.resize(c.container.size()); 102 MapBase::operator=(c); 103 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 104 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 105 container[id] = c.container[id]; 106 106 } 107 107 return *this; 108 108 } 109 110 /** The destructor of the map.111 */112 virtual ~VectorMap() {113 }114 115 109 /** 116 110 * The subscript operator. The map can be subscripted by the
Note: See TracChangeset
for help on using the changeset viewer.