0
3
0
... | ... |
@@ -746,16 +746,19 @@ |
746 | 746 |
} |
747 | 747 |
attach(gr); |
748 | 748 |
} |
749 | 749 |
|
750 | 750 |
/// \brief Undo the changes until the last snapshot. |
751 | 751 |
/// |
752 | 752 |
/// This function undos the changes until the last snapshot |
753 | 753 |
/// created by save() or Snapshot(ListDigraph&). |
754 |
/// |
|
755 |
/// \warning This method invalidates the snapshot, i.e. repeated |
|
756 |
/// restoring is not supported unless you call save() again. |
|
754 | 757 |
void restore() { |
755 | 758 |
detach(); |
756 | 759 |
for(std::list<Arc>::iterator it = added_arcs.begin(); |
757 | 760 |
it != added_arcs.end(); ++it) { |
758 | 761 |
digraph->erase(*it); |
759 | 762 |
} |
760 | 763 |
for(std::list<Node>::iterator it = added_nodes.begin(); |
761 | 764 |
it != added_nodes.end(); ++it) { |
... | ... |
@@ -1545,16 +1548,19 @@ |
1545 | 1548 |
} |
1546 | 1549 |
attach(gr); |
1547 | 1550 |
} |
1548 | 1551 |
|
1549 | 1552 |
/// \brief Undo the changes until the last snapshot. |
1550 | 1553 |
/// |
1551 | 1554 |
/// This function undos the changes until the last snapshot |
1552 | 1555 |
/// created by save() or Snapshot(ListGraph&). |
1556 |
/// |
|
1557 |
/// \warning This method invalidates the snapshot, i.e. repeated |
|
1558 |
/// restoring is not supported unless you call save() again. |
|
1553 | 1559 |
void restore() { |
1554 | 1560 |
detach(); |
1555 | 1561 |
for(std::list<Edge>::iterator it = added_edges.begin(); |
1556 | 1562 |
it != added_edges.end(); ++it) { |
1557 | 1563 |
graph->erase(*it); |
1558 | 1564 |
} |
1559 | 1565 |
for(std::list<Node>::iterator it = added_nodes.begin(); |
1560 | 1566 |
it != added_nodes.end(); ++it) { |
... | ... |
@@ -281,16 +281,24 @@ |
281 | 281 |
checkGraphArcMap(G); |
282 | 282 |
|
283 | 283 |
G.addNode(); |
284 | 284 |
snapshot.save(G); |
285 | 285 |
|
286 | 286 |
G.addArc(G.addNode(), G.addNode()); |
287 | 287 |
|
288 | 288 |
snapshot.restore(); |
289 |
snapshot.save(G); |
|
290 |
|
|
291 |
checkGraphNodeList(G, 4); |
|
292 |
checkGraphArcList(G, 4); |
|
293 |
|
|
294 |
G.addArc(G.addNode(), G.addNode()); |
|
295 |
|
|
296 |
snapshot.restore(); |
|
289 | 297 |
|
290 | 298 |
checkGraphNodeList(G, 4); |
291 | 299 |
checkGraphArcList(G, 4); |
292 | 300 |
} |
293 | 301 |
|
294 | 302 |
void checkConcepts() { |
295 | 303 |
{ // Checking digraph components |
296 | 304 |
checkConcept<BaseDigraphComponent, BaseDigraphComponent >(); |
... | ... |
@@ -254,16 +254,25 @@ |
254 | 254 |
checkGraphArcMap(G); |
255 | 255 |
|
256 | 256 |
G.addNode(); |
257 | 257 |
snapshot.save(G); |
258 | 258 |
|
259 | 259 |
G.addEdge(G.addNode(), G.addNode()); |
260 | 260 |
|
261 | 261 |
snapshot.restore(); |
262 |
snapshot.save(G); |
|
263 |
|
|
264 |
checkGraphNodeList(G, 4); |
|
265 |
checkGraphEdgeList(G, 3); |
|
266 |
checkGraphArcList(G, 6); |
|
267 |
|
|
268 |
G.addEdge(G.addNode(), G.addNode()); |
|
269 |
|
|
270 |
snapshot.restore(); |
|
262 | 271 |
|
263 | 272 |
checkGraphNodeList(G, 4); |
264 | 273 |
checkGraphEdgeList(G, 3); |
265 | 274 |
checkGraphArcList(G, 6); |
266 | 275 |
} |
267 | 276 |
|
268 | 277 |
void checkFullGraph(int num) { |
269 | 278 |
typedef FullGraph Graph; |
0 comments (0 inline)