lemon/list_graph.h
changeset 1459 2ee881cf30a8
parent 1435 8e85e6bbefdf
child 1470 9b6f8c3587f0
equal deleted inserted replaced
0:85f1ee80d88e 1:12811c891d14
   455       virtual void erase(const Edge&) 
   455       virtual void erase(const Edge&) 
   456       {
   456       {
   457 	exit(1);
   457 	exit(1);
   458       }
   458       }
   459 
   459 
       
   460       ///\bug What is this used for?
       
   461       ///
       
   462       virtual void build() {}
       
   463       ///\bug What is this used for?
       
   464       ///
       
   465       virtual void clear() {}
       
   466 
   460       void regist(ListGraph &_g) {
   467       void regist(ListGraph &_g) {
   461 	g=&_g;
   468 	g=&_g;
   462 	AlterationNotifier<Node>::ObserverBase::
   469 	AlterationNotifier<Node>::ObserverBase::
   463 	  attach(g->getNotifier(Node()));
   470 	  attach(g->getNotifier(Node()));
   464 	AlterationNotifier<Edge>::ObserverBase::
   471 	AlterationNotifier<Edge>::ObserverBase::
   515 
   522 
   516     ///Undo the changes until last snapshot created by save().
   523     ///Undo the changes until last snapshot created by save().
   517     ///
   524     ///
   518     ///\todo This function might be called undo().
   525     ///\todo This function might be called undo().
   519       void restore() {
   526       void restore() {
       
   527 	ListGraph &old_g=*g;
   520 	deregist();
   528 	deregist();
   521 	while(!added_edges.empty()) {
   529 	while(!added_edges.empty()) {
   522 	  g->erase(added_edges.front());
   530 	  old_g.erase(added_edges.front());
   523 	  added_edges.pop_front();
   531 	  added_edges.pop_front();
   524 	}
   532 	}
   525  	while(!added_nodes.empty()) {
   533  	while(!added_nodes.empty()) {
   526 	  g->erase(added_nodes.front());
   534 	  old_g.erase(added_nodes.front());
   527 	  added_nodes.pop_front();
   535 	  added_nodes.pop_front();
   528 	}
   536 	}
   529       }
   537       }
   530     };
   538     };
   531     
   539