130 return graph->maxEdgeId(); |
130 return graph->maxEdgeId(); |
131 } |
131 } |
132 |
132 |
133 typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier; |
133 typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier; |
134 |
134 |
135 NodeNotifier& getNotifier(Node) const { |
135 NodeNotifier& notifier(Node) const { |
136 return graph->getNotifier(Node()); |
136 return graph->notifier(Node()); |
137 } |
137 } |
138 |
138 |
139 typedef typename ItemSetTraits<Graph, Edge>::ItemNotifier EdgeNotifier; |
139 typedef typename ItemSetTraits<Graph, Edge>::ItemNotifier EdgeNotifier; |
140 |
140 |
141 EdgeNotifier& getNotifier(Edge) const { |
141 EdgeNotifier& notifier(Edge) const { |
142 return graph->getNotifier(Edge()); |
142 return graph->notifier(Edge()); |
143 } |
143 } |
144 |
144 |
145 template <typename _Value> |
145 template <typename _Value> |
146 class NodeMap : public Graph::template NodeMap<_Value> { |
146 class NodeMap : public Graph::template NodeMap<_Value> { |
147 public: |
147 public: |
1229 |
1229 |
1230 virtual void add(const GraphEdge& ge) { |
1230 virtual void add(const GraphEdge& ge) { |
1231 std::vector<Edge> edges; |
1231 std::vector<Edge> edges; |
1232 edges.push_back(AdaptorBase::Parent::direct(ge, true)); |
1232 edges.push_back(AdaptorBase::Parent::direct(ge, true)); |
1233 edges.push_back(AdaptorBase::Parent::direct(ge, false)); |
1233 edges.push_back(AdaptorBase::Parent::direct(ge, false)); |
1234 adaptor->getNotifier(Edge()).add(edges); |
1234 adaptor->notifier(Edge()).add(edges); |
1235 } |
1235 } |
1236 virtual void add(const std::vector<GraphEdge>& ge) { |
1236 virtual void add(const std::vector<GraphEdge>& ge) { |
1237 std::vector<Edge> edges; |
1237 std::vector<Edge> edges; |
1238 for (int i = 0; i < (int)ge.size(); ++i) { |
1238 for (int i = 0; i < (int)ge.size(); ++i) { |
1239 edges.push_back(AdaptorBase::Parent::direct(ge[i], true)); |
1239 edges.push_back(AdaptorBase::Parent::direct(ge[i], true)); |
1240 edges.push_back(AdaptorBase::Parent::direct(ge[i], false)); |
1240 edges.push_back(AdaptorBase::Parent::direct(ge[i], false)); |
1241 } |
1241 } |
1242 adaptor->getNotifier(Edge()).add(edges); |
1242 adaptor->notifier(Edge()).add(edges); |
1243 } |
1243 } |
1244 virtual void erase(const GraphEdge& ge) { |
1244 virtual void erase(const GraphEdge& ge) { |
1245 std::vector<Edge> edges; |
1245 std::vector<Edge> edges; |
1246 edges.push_back(AdaptorBase::Parent::direct(ge, true)); |
1246 edges.push_back(AdaptorBase::Parent::direct(ge, true)); |
1247 edges.push_back(AdaptorBase::Parent::direct(ge, false)); |
1247 edges.push_back(AdaptorBase::Parent::direct(ge, false)); |
1248 adaptor->getNotifier(Edge()).erase(edges); |
1248 adaptor->notifier(Edge()).erase(edges); |
1249 } |
1249 } |
1250 virtual void erase(const std::vector<GraphEdge>& ge) { |
1250 virtual void erase(const std::vector<GraphEdge>& ge) { |
1251 std::vector<Edge> edges; |
1251 std::vector<Edge> edges; |
1252 for (int i = 0; i < (int)ge.size(); ++i) { |
1252 for (int i = 0; i < (int)ge.size(); ++i) { |
1253 edges.push_back(AdaptorBase::Parent::direct(ge[i], true)); |
1253 edges.push_back(AdaptorBase::Parent::direct(ge[i], true)); |
1254 edges.push_back(AdaptorBase::Parent::direct(ge[i], false)); |
1254 edges.push_back(AdaptorBase::Parent::direct(ge[i], false)); |
1255 } |
1255 } |
1256 adaptor->getNotifier(Edge()).erase(edges); |
1256 adaptor->notifier(Edge()).erase(edges); |
1257 } |
1257 } |
1258 virtual void build() { |
1258 virtual void build() { |
1259 adaptor->getNotifier(Edge()).build(); |
1259 adaptor->notifier(Edge()).build(); |
1260 } |
1260 } |
1261 virtual void clear() { |
1261 virtual void clear() { |
1262 adaptor->getNotifier(Edge()).clear(); |
1262 adaptor->notifier(Edge()).clear(); |
1263 } |
1263 } |
1264 |
1264 |
1265 const AdaptorBase* adaptor; |
1265 const AdaptorBase* adaptor; |
1266 }; |
1266 }; |
1267 |
1267 |
2184 |
2184 |
2185 virtual void add(const GraphNode& gn) { |
2185 virtual void add(const GraphNode& gn) { |
2186 std::vector<Node> nodes; |
2186 std::vector<Node> nodes; |
2187 nodes.push_back(AdaptorBase::Parent::inNode(gn)); |
2187 nodes.push_back(AdaptorBase::Parent::inNode(gn)); |
2188 nodes.push_back(AdaptorBase::Parent::outNode(gn)); |
2188 nodes.push_back(AdaptorBase::Parent::outNode(gn)); |
2189 adaptor->getNotifier(Node()).add(nodes); |
2189 adaptor->notifier(Node()).add(nodes); |
2190 } |
2190 } |
2191 |
2191 |
2192 virtual void add(const std::vector<GraphNode>& gn) { |
2192 virtual void add(const std::vector<GraphNode>& gn) { |
2193 std::vector<Node> nodes; |
2193 std::vector<Node> nodes; |
2194 for (int i = 0; i < (int)gn.size(); ++i) { |
2194 for (int i = 0; i < (int)gn.size(); ++i) { |
2195 nodes.push_back(AdaptorBase::Parent::inNode(gn[i])); |
2195 nodes.push_back(AdaptorBase::Parent::inNode(gn[i])); |
2196 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); |
2196 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); |
2197 } |
2197 } |
2198 adaptor->getNotifier(Node()).add(nodes); |
2198 adaptor->notifier(Node()).add(nodes); |
2199 } |
2199 } |
2200 |
2200 |
2201 virtual void erase(const GraphNode& gn) { |
2201 virtual void erase(const GraphNode& gn) { |
2202 std::vector<Node> nodes; |
2202 std::vector<Node> nodes; |
2203 nodes.push_back(AdaptorBase::Parent::inNode(gn)); |
2203 nodes.push_back(AdaptorBase::Parent::inNode(gn)); |
2204 nodes.push_back(AdaptorBase::Parent::outNode(gn)); |
2204 nodes.push_back(AdaptorBase::Parent::outNode(gn)); |
2205 adaptor->getNotifier(Node()).erase(nodes); |
2205 adaptor->notifier(Node()).erase(nodes); |
2206 } |
2206 } |
2207 |
2207 |
2208 virtual void erase(const std::vector<GraphNode>& gn) { |
2208 virtual void erase(const std::vector<GraphNode>& gn) { |
2209 std::vector<Node> nodes; |
2209 std::vector<Node> nodes; |
2210 for (int i = 0; i < (int)gn.size(); ++i) { |
2210 for (int i = 0; i < (int)gn.size(); ++i) { |
2211 nodes.push_back(AdaptorBase::Parent::inNode(gn[i])); |
2211 nodes.push_back(AdaptorBase::Parent::inNode(gn[i])); |
2212 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); |
2212 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); |
2213 } |
2213 } |
2214 adaptor->getNotifier(Node()).erase(nodes); |
2214 adaptor->notifier(Node()).erase(nodes); |
2215 } |
2215 } |
2216 virtual void build() { |
2216 virtual void build() { |
2217 adaptor->getNotifier(Node()).build(); |
2217 adaptor->notifier(Node()).build(); |
2218 } |
2218 } |
2219 virtual void clear() { |
2219 virtual void clear() { |
2220 adaptor->getNotifier(Node()).clear(); |
2220 adaptor->notifier(Node()).clear(); |
2221 } |
2221 } |
2222 |
2222 |
2223 const AdaptorBase* adaptor; |
2223 const AdaptorBase* adaptor; |
2224 }; |
2224 }; |
2225 |
2225 |
2299 |
2299 |
2300 virtual void add(const GraphNode& gn) { |
2300 virtual void add(const GraphNode& gn) { |
2301 std::vector<Node> nodes; |
2301 std::vector<Node> nodes; |
2302 nodes.push_back(AdaptorBase::Parent::inNode(gn)); |
2302 nodes.push_back(AdaptorBase::Parent::inNode(gn)); |
2303 nodes.push_back(AdaptorBase::Parent::outNode(gn)); |
2303 nodes.push_back(AdaptorBase::Parent::outNode(gn)); |
2304 adaptor->getNotifier(Node()).add(nodes); |
2304 adaptor->notifier(Node()).add(nodes); |
2305 adaptor->getNotifier(Edge()).add(AdaptorBase::Parent::edge(gn)); |
2305 adaptor->notifier(Edge()).add(AdaptorBase::Parent::edge(gn)); |
2306 } |
2306 } |
2307 virtual void add(const std::vector<GraphNode>& gn) { |
2307 virtual void add(const std::vector<GraphNode>& gn) { |
2308 std::vector<Node> nodes; |
2308 std::vector<Node> nodes; |
2309 std::vector<Edge> edges; |
2309 std::vector<Edge> edges; |
2310 for (int i = 0; i < (int)gn.size(); ++i) { |
2310 for (int i = 0; i < (int)gn.size(); ++i) { |
2311 edges.push_back(AdaptorBase::Parent::edge(gn[i])); |
2311 edges.push_back(AdaptorBase::Parent::edge(gn[i])); |
2312 nodes.push_back(AdaptorBase::Parent::inNode(gn[i])); |
2312 nodes.push_back(AdaptorBase::Parent::inNode(gn[i])); |
2313 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); |
2313 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); |
2314 } |
2314 } |
2315 adaptor->getNotifier(Node()).add(nodes); |
2315 adaptor->notifier(Node()).add(nodes); |
2316 adaptor->getNotifier(Edge()).add(edges); |
2316 adaptor->notifier(Edge()).add(edges); |
2317 } |
2317 } |
2318 virtual void erase(const GraphNode& gn) { |
2318 virtual void erase(const GraphNode& gn) { |
2319 adaptor->getNotifier(Edge()).erase(AdaptorBase::Parent::edge(gn)); |
2319 adaptor->notifier(Edge()).erase(AdaptorBase::Parent::edge(gn)); |
2320 std::vector<Node> nodes; |
2320 std::vector<Node> nodes; |
2321 nodes.push_back(AdaptorBase::Parent::inNode(gn)); |
2321 nodes.push_back(AdaptorBase::Parent::inNode(gn)); |
2322 nodes.push_back(AdaptorBase::Parent::outNode(gn)); |
2322 nodes.push_back(AdaptorBase::Parent::outNode(gn)); |
2323 adaptor->getNotifier(Node()).erase(nodes); |
2323 adaptor->notifier(Node()).erase(nodes); |
2324 } |
2324 } |
2325 virtual void erase(const std::vector<GraphNode>& gn) { |
2325 virtual void erase(const std::vector<GraphNode>& gn) { |
2326 std::vector<Node> nodes; |
2326 std::vector<Node> nodes; |
2327 std::vector<Edge> edges; |
2327 std::vector<Edge> edges; |
2328 for (int i = 0; i < (int)gn.size(); ++i) { |
2328 for (int i = 0; i < (int)gn.size(); ++i) { |
2329 edges.push_back(AdaptorBase::Parent::edge(gn[i])); |
2329 edges.push_back(AdaptorBase::Parent::edge(gn[i])); |
2330 nodes.push_back(AdaptorBase::Parent::inNode(gn[i])); |
2330 nodes.push_back(AdaptorBase::Parent::inNode(gn[i])); |
2331 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); |
2331 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); |
2332 } |
2332 } |
2333 adaptor->getNotifier(Edge()).erase(edges); |
2333 adaptor->notifier(Edge()).erase(edges); |
2334 adaptor->getNotifier(Node()).erase(nodes); |
2334 adaptor->notifier(Node()).erase(nodes); |
2335 } |
2335 } |
2336 virtual void build() { |
2336 virtual void build() { |
2337 std::vector<Edge> edges; |
2337 std::vector<Edge> edges; |
2338 const typename Parent::Notifier* notifier = Parent::getNotifier(); |
2338 const typename Parent::Notifier* notifier = Parent::notifier(); |
2339 GraphNode it; |
2339 GraphNode it; |
2340 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
2340 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
2341 edges.push_back(AdaptorBase::Parent::edge(it)); |
2341 edges.push_back(AdaptorBase::Parent::edge(it)); |
2342 } |
2342 } |
2343 adaptor->getNotifier(Node()).build(); |
2343 adaptor->notifier(Node()).build(); |
2344 adaptor->getNotifier(Edge()).add(edges); |
2344 adaptor->notifier(Edge()).add(edges); |
2345 } |
2345 } |
2346 virtual void clear() { |
2346 virtual void clear() { |
2347 std::vector<Edge> edges; |
2347 std::vector<Edge> edges; |
2348 const typename Parent::Notifier* notifier = Parent::getNotifier(); |
2348 const typename Parent::Notifier* notifier = Parent::notifier(); |
2349 GraphNode it; |
2349 GraphNode it; |
2350 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
2350 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
2351 edges.push_back(AdaptorBase::Parent::edge(it)); |
2351 edges.push_back(AdaptorBase::Parent::edge(it)); |
2352 } |
2352 } |
2353 adaptor->getNotifier(Edge()).erase(edges); |
2353 adaptor->notifier(Edge()).erase(edges); |
2354 adaptor->getNotifier(Node()).clear(); |
2354 adaptor->notifier(Node()).clear(); |
2355 } |
2355 } |
2356 |
2356 |
2357 const AdaptorBase* adaptor; |
2357 const AdaptorBase* adaptor; |
2358 }; |
2358 }; |
2359 |
2359 |
2379 |
2379 |
2380 |
2380 |
2381 protected: |
2381 protected: |
2382 |
2382 |
2383 virtual void add(const GraphEdge& ge) { |
2383 virtual void add(const GraphEdge& ge) { |
2384 adaptor->getNotifier(Edge()).add(AdaptorBase::edge(ge)); |
2384 adaptor->notifier(Edge()).add(AdaptorBase::edge(ge)); |
2385 } |
2385 } |
2386 virtual void add(const std::vector<GraphEdge>& ge) { |
2386 virtual void add(const std::vector<GraphEdge>& ge) { |
2387 std::vector<Edge> edges; |
2387 std::vector<Edge> edges; |
2388 for (int i = 0; i < (int)ge.size(); ++i) { |
2388 for (int i = 0; i < (int)ge.size(); ++i) { |
2389 edges.push_back(AdaptorBase::edge(ge[i])); |
2389 edges.push_back(AdaptorBase::edge(ge[i])); |
2390 } |
2390 } |
2391 adaptor->getNotifier(Edge()).add(edges); |
2391 adaptor->notifier(Edge()).add(edges); |
2392 } |
2392 } |
2393 virtual void erase(const GraphEdge& ge) { |
2393 virtual void erase(const GraphEdge& ge) { |
2394 adaptor->getNotifier(Edge()).erase(AdaptorBase::edge(ge)); |
2394 adaptor->notifier(Edge()).erase(AdaptorBase::edge(ge)); |
2395 } |
2395 } |
2396 virtual void erase(const std::vector<GraphEdge>& ge) { |
2396 virtual void erase(const std::vector<GraphEdge>& ge) { |
2397 std::vector<Edge> edges; |
2397 std::vector<Edge> edges; |
2398 for (int i = 0; i < (int)ge.size(); ++i) { |
2398 for (int i = 0; i < (int)ge.size(); ++i) { |
2399 edges.push_back(AdaptorBase::edge(ge[i])); |
2399 edges.push_back(AdaptorBase::edge(ge[i])); |
2400 } |
2400 } |
2401 adaptor->getNotifier(Edge()).erase(edges); |
2401 adaptor->notifier(Edge()).erase(edges); |
2402 } |
2402 } |
2403 virtual void build() { |
2403 virtual void build() { |
2404 std::vector<Edge> edges; |
2404 std::vector<Edge> edges; |
2405 const typename Parent::Notifier* notifier = Parent::getNotifier(); |
2405 const typename Parent::Notifier* notifier = Parent::notifier(); |
2406 GraphEdge it; |
2406 GraphEdge it; |
2407 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
2407 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
2408 edges.push_back(AdaptorBase::Parent::edge(it)); |
2408 edges.push_back(AdaptorBase::Parent::edge(it)); |
2409 } |
2409 } |
2410 adaptor->getNotifier(Edge()).add(edges); |
2410 adaptor->notifier(Edge()).add(edges); |
2411 } |
2411 } |
2412 virtual void clear() { |
2412 virtual void clear() { |
2413 std::vector<Edge> edges; |
2413 std::vector<Edge> edges; |
2414 const typename Parent::Notifier* notifier = Parent::getNotifier(); |
2414 const typename Parent::Notifier* notifier = Parent::notifier(); |
2415 GraphEdge it; |
2415 GraphEdge it; |
2416 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
2416 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
2417 edges.push_back(AdaptorBase::Parent::edge(it)); |
2417 edges.push_back(AdaptorBase::Parent::edge(it)); |
2418 } |
2418 } |
2419 adaptor->getNotifier(Edge()).erase(edges); |
2419 adaptor->notifier(Edge()).erase(edges); |
2420 } |
2420 } |
2421 |
2421 |
2422 const AdaptorBase* adaptor; |
2422 const AdaptorBase* adaptor; |
2423 }; |
2423 }; |
2424 |
2424 |