Changeset 891:74589d20dbc3 in lemon-0.x for src/hugo/map_defines.h
- Timestamp:
- 09/21/04 00:57:48 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1199
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.