UnsupportedException on erase with Snapshot
authordeba
Fri, 04 Nov 2005 16:40:54 +0000
changeset 17749fd56d75293e
parent 1773 ea5927cef15c
child 1775 f19e108cb286
UnsupportedException on erase with Snapshot
lemon/list_graph.h
     1.1 --- a/lemon/list_graph.h	Fri Nov 04 16:35:18 2005 +0000
     1.2 +++ b/lemon/list_graph.h	Fri Nov 04 16:40:54 2005 +0000
     1.3 @@ -30,6 +30,8 @@
     1.4  
     1.5  #include <lemon/bits/undir_graph_extender.h>
     1.6  
     1.7 +#include <lemon/error.h>
     1.8 +
     1.9  #include <list>
    1.10  
    1.11  namespace lemon {
    1.12 @@ -440,6 +442,16 @@
    1.13      class Snapshot : protected AlterationNotifier<Node>::ObserverBase,
    1.14  		     protected AlterationNotifier<Edge>::ObserverBase
    1.15      {
    1.16 +    public:
    1.17 +      
    1.18 +      class UnsupportedOperation : public LogicError {
    1.19 +      public:
    1.20 +	virtual const char* exceptionName() const {
    1.21 +	  return "lemon::ListGraph::Snapshot::UnsupportedOperation";
    1.22 +	}
    1.23 +      };
    1.24 +            
    1.25 +
    1.26        protected:
    1.27        
    1.28        ListGraph *g;
    1.29 @@ -450,20 +462,16 @@
    1.30        virtual void add(const Node& n) {
    1.31  	added_nodes.push_back(n);
    1.32        };
    1.33 -      ///\bug Exception...
    1.34 -      ///
    1.35        virtual void erase(const Node&) 
    1.36        {
    1.37 -	exit(1);
    1.38 +	throw UnsupportedOperation();
    1.39        }
    1.40        virtual void add(const Edge& n) {
    1.41  	added_edges.push_back(n);
    1.42        };
    1.43 -      ///\bug Exception...
    1.44 -      ///
    1.45        virtual void erase(const Edge&) 
    1.46        {
    1.47 -	exit(1);
    1.48 +	throw UnsupportedOperation();
    1.49        }
    1.50  
    1.51        ///\bug What is this used for?
    1.52 @@ -488,7 +496,7 @@
    1.53  	  detach();
    1.54  	g=0;
    1.55        }
    1.56 -            
    1.57 +
    1.58      public:
    1.59        ///Default constructur.
    1.60