lemon/smart_graph.h
changeset 2388 c6d537888fe5
parent 2381 0248790c66ea
child 2391 14a343be7a5a
equal deleted inserted replaced
41:f2f4b2849138 42:e2c3ea49842c
   639 
   639 
   640   protected:
   640   protected:
   641 
   641 
   642     void saveSnapshot(Snapshot &s)
   642     void saveSnapshot(Snapshot &s)
   643     {
   643     {
   644       s.g = this;
   644       s.graph = this;
   645       s.node_num = nodes.size();
   645       s.node_num = nodes.size();
   646       s.edge_num = edges.size();
   646       s.edge_num = edges.size();
   647     }
   647     }
   648 
   648 
   649     void restoreSnapshot(const Snapshot &s)
   649     void restoreSnapshot(const Snapshot &s)
   686     ///either broken program, invalid state of the graph, valid but
   686     ///either broken program, invalid state of the graph, valid but
   687     ///not the restored graph or no change. Because the runtime performance
   687     ///not the restored graph or no change. Because the runtime performance
   688     ///the validity of the snapshot is not stored.
   688     ///the validity of the snapshot is not stored.
   689     class Snapshot 
   689     class Snapshot 
   690     {
   690     {
   691       SmartUGraph *g;
   691       SmartUGraph *graph;
   692     protected:
   692     protected:
   693       friend class SmartUGraph;
   693       friend class SmartUGraph;
   694       unsigned int node_num;
   694       unsigned int node_num;
   695       unsigned int edge_num;
   695       unsigned int edge_num;
   696     public:
   696     public:
   697       ///Default constructor.
   697       ///Default constructor.
   698       
   698       
   699       ///Default constructor.
   699       ///Default constructor.
   700       ///To actually make a snapshot you must call save().
   700       ///To actually make a snapshot you must call save().
   701       ///
   701       ///
   702       Snapshot() : g(0) {}
   702       Snapshot() : graph(0) {}
   703       ///Constructor that immediately makes a snapshot
   703       ///Constructor that immediately makes a snapshot
   704       
   704       
   705       ///This constructor immediately makes a snapshot of the graph.
   705       ///This constructor immediately makes a snapshot of the graph.
   706       ///\param g The graph we make a snapshot of.
   706       ///\param g The graph we make a snapshot of.
   707       Snapshot(SmartUGraph &g) {
   707       Snapshot(SmartUGraph &g) {
   727       ///\note After you restored a state, you cannot restore
   727       ///\note After you restored a state, you cannot restore
   728       ///a later state, in other word you cannot add again the edges deleted
   728       ///a later state, in other word you cannot add again the edges deleted
   729       ///by restore().
   729       ///by restore().
   730       void restore()
   730       void restore()
   731       {
   731       {
   732         g->restoreSnapshot(*this);
   732         graph->restoreSnapshot(*this);
   733       }
   733       }
   734     };
   734     };
   735   };
   735   };
   736 
   736 
   737 
   737