Changeset 2384:805c5a2a36dd in lemon-0.x for lemon/graph_adaptor.h
- Timestamp:
- 03/01/07 18:14:24 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3215
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/graph_adaptor.h
r2340 r2384 133 133 typedef typename ItemSetTraits<Graph, Node>::ItemNotifier NodeNotifier; 134 134 135 NodeNotifier& getNotifier(Node) const {136 return graph-> getNotifier(Node());135 NodeNotifier& notifier(Node) const { 136 return graph->notifier(Node()); 137 137 } 138 138 139 139 typedef typename ItemSetTraits<Graph, Edge>::ItemNotifier EdgeNotifier; 140 140 141 EdgeNotifier& getNotifier(Edge) const {142 return graph-> getNotifier(Edge());141 EdgeNotifier& notifier(Edge) const { 142 return graph->notifier(Edge()); 143 143 } 144 144 … … 1183 1183 void setGraph(_Graph& graph) { 1184 1184 Parent::setGraph(graph); 1185 edge_notifier_proxy.setNotifier(graph. getNotifier(GraphEdge()));1185 edge_notifier_proxy.setNotifier(graph.notifier(GraphEdge())); 1186 1186 } 1187 1187 … … 1197 1197 typedef typename Parent::EdgeNotifier UEdgeNotifier; 1198 1198 1199 using Parent:: getNotifier;1199 using Parent::notifier; 1200 1200 1201 1201 typedef AlterationNotifier<AlterableUndirGraphAdaptor, 1202 1202 Edge> EdgeNotifier; 1203 EdgeNotifier& getNotifier(Edge) const { return edge_notifier; }1203 EdgeNotifier& notifier(Edge) const { return edge_notifier; } 1204 1204 1205 1205 protected: … … 1232 1232 edges.push_back(AdaptorBase::Parent::direct(ge, true)); 1233 1233 edges.push_back(AdaptorBase::Parent::direct(ge, false)); 1234 adaptor-> getNotifier(Edge()).add(edges);1234 adaptor->notifier(Edge()).add(edges); 1235 1235 } 1236 1236 virtual void add(const std::vector<GraphEdge>& ge) { … … 1240 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 1244 virtual void erase(const GraphEdge& ge) { … … 1246 1246 edges.push_back(AdaptorBase::Parent::direct(ge, true)); 1247 1247 edges.push_back(AdaptorBase::Parent::direct(ge, false)); 1248 adaptor-> getNotifier(Edge()).erase(edges);1248 adaptor->notifier(Edge()).erase(edges); 1249 1249 } 1250 1250 virtual void erase(const std::vector<GraphEdge>& ge) { … … 1254 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 1258 virtual void build() { 1259 adaptor-> getNotifier(Edge()).build();1259 adaptor->notifier(Edge()).build(); 1260 1260 } 1261 1261 virtual void clear() { 1262 adaptor-> getNotifier(Edge()).clear();1262 adaptor->notifier(Edge()).clear(); 1263 1263 } 1264 1264 … … 2144 2144 void setGraph(_Graph& graph) { 2145 2145 Parent::setGraph(graph); 2146 node_notifier_proxy.setNotifier(graph. getNotifier(GraphNode()));2146 node_notifier_proxy.setNotifier(graph.notifier(GraphNode())); 2147 2147 } 2148 2148 … … 2156 2156 typedef InvalidType EdgeNotifier; 2157 2157 2158 NodeNotifier& getNotifier(Node) const { return node_notifier; }2158 NodeNotifier& notifier(Node) const { return node_notifier; } 2159 2159 2160 2160 protected: … … 2187 2187 nodes.push_back(AdaptorBase::Parent::inNode(gn)); 2188 2188 nodes.push_back(AdaptorBase::Parent::outNode(gn)); 2189 adaptor-> getNotifier(Node()).add(nodes);2189 adaptor->notifier(Node()).add(nodes); 2190 2190 } 2191 2191 … … 2196 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 … … 2203 2203 nodes.push_back(AdaptorBase::Parent::inNode(gn)); 2204 2204 nodes.push_back(AdaptorBase::Parent::outNode(gn)); 2205 adaptor-> getNotifier(Node()).erase(nodes);2205 adaptor->notifier(Node()).erase(nodes); 2206 2206 } 2207 2207 … … 2212 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 2216 virtual void build() { 2217 adaptor-> getNotifier(Node()).build();2217 adaptor->notifier(Node()).build(); 2218 2218 } 2219 2219 virtual void clear() { 2220 adaptor-> getNotifier(Node()).clear();2220 adaptor->notifier(Node()).clear(); 2221 2221 } 2222 2222 … … 2256 2256 void setGraph(_Graph& graph) { 2257 2257 Parent::setGraph(graph); 2258 node_notifier_proxy.setNotifier(graph. getNotifier(GraphNode()));2259 edge_notifier_proxy.setNotifier(graph. getNotifier(GraphEdge()));2258 node_notifier_proxy.setNotifier(graph.notifier(GraphNode())); 2259 edge_notifier_proxy.setNotifier(graph.notifier(GraphEdge())); 2260 2260 } 2261 2261 … … 2270 2270 typedef AlterationNotifier<AlterableSplitGraphAdaptor, Edge> EdgeNotifier; 2271 2271 2272 NodeNotifier& getNotifier(Node) const { return node_notifier; }2273 EdgeNotifier& getNotifier(Edge) const { return edge_notifier; }2272 NodeNotifier& notifier(Node) const { return node_notifier; } 2273 EdgeNotifier& notifier(Edge) const { return edge_notifier; } 2274 2274 2275 2275 protected: … … 2302 2302 nodes.push_back(AdaptorBase::Parent::inNode(gn)); 2303 2303 nodes.push_back(AdaptorBase::Parent::outNode(gn)); 2304 adaptor-> getNotifier(Node()).add(nodes);2305 adaptor-> getNotifier(Edge()).add(AdaptorBase::Parent::edge(gn));2304 adaptor->notifier(Node()).add(nodes); 2305 adaptor->notifier(Edge()).add(AdaptorBase::Parent::edge(gn)); 2306 2306 } 2307 2307 virtual void add(const std::vector<GraphNode>& gn) { … … 2313 2313 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); 2314 2314 } 2315 adaptor-> getNotifier(Node()).add(nodes);2316 adaptor-> getNotifier(Edge()).add(edges);2315 adaptor->notifier(Node()).add(nodes); 2316 adaptor->notifier(Edge()).add(edges); 2317 2317 } 2318 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 2320 std::vector<Node> nodes; 2321 2321 nodes.push_back(AdaptorBase::Parent::inNode(gn)); 2322 2322 nodes.push_back(AdaptorBase::Parent::outNode(gn)); 2323 adaptor-> getNotifier(Node()).erase(nodes);2323 adaptor->notifier(Node()).erase(nodes); 2324 2324 } 2325 2325 virtual void erase(const std::vector<GraphNode>& gn) { … … 2331 2331 nodes.push_back(AdaptorBase::Parent::outNode(gn[i])); 2332 2332 } 2333 adaptor-> getNotifier(Edge()).erase(edges);2334 adaptor-> getNotifier(Node()).erase(nodes);2333 adaptor->notifier(Edge()).erase(edges); 2334 adaptor->notifier(Node()).erase(nodes); 2335 2335 } 2336 2336 virtual void build() { 2337 2337 std::vector<Edge> edges; 2338 const typename Parent::Notifier* notifier = Parent:: getNotifier();2338 const typename Parent::Notifier* notifier = Parent::notifier(); 2339 2339 GraphNode it; 2340 2340 for (notifier->first(it); it != INVALID; notifier->next(it)) { 2341 2341 edges.push_back(AdaptorBase::Parent::edge(it)); 2342 2342 } 2343 adaptor-> getNotifier(Node()).build();2344 adaptor-> getNotifier(Edge()).add(edges);2343 adaptor->notifier(Node()).build(); 2344 adaptor->notifier(Edge()).add(edges); 2345 2345 } 2346 2346 virtual void clear() { 2347 2347 std::vector<Edge> edges; 2348 const typename Parent::Notifier* notifier = Parent:: getNotifier();2348 const typename Parent::Notifier* notifier = Parent::notifier(); 2349 2349 GraphNode it; 2350 2350 for (notifier->first(it); it != INVALID; notifier->next(it)) { 2351 2351 edges.push_back(AdaptorBase::Parent::edge(it)); 2352 2352 } 2353 adaptor-> getNotifier(Edge()).erase(edges);2354 adaptor-> getNotifier(Node()).clear();2353 adaptor->notifier(Edge()).erase(edges); 2354 adaptor->notifier(Node()).clear(); 2355 2355 } 2356 2356 … … 2382 2382 2383 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 2386 virtual void add(const std::vector<GraphEdge>& ge) { … … 2389 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 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 2396 virtual void erase(const std::vector<GraphEdge>& ge) { … … 2399 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 2403 virtual void build() { 2404 2404 std::vector<Edge> edges; 2405 const typename Parent::Notifier* notifier = Parent:: getNotifier();2405 const typename Parent::Notifier* notifier = Parent::notifier(); 2406 2406 GraphEdge it; 2407 2407 for (notifier->first(it); it != INVALID; notifier->next(it)) { 2408 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 2412 virtual void clear() { 2413 2413 std::vector<Edge> edges; 2414 const typename Parent::Notifier* notifier = Parent:: getNotifier();2414 const typename Parent::Notifier* notifier = Parent::notifier(); 2415 2415 GraphEdge it; 2416 2416 for (notifier->first(it); it != INVALID; notifier->next(it)) { 2417 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
Note: See TracChangeset
for help on using the changeset viewer.