1.1 --- a/lemon/bellman_ford.h Tue Jul 18 12:10:52 2006 +0000
1.2 +++ b/lemon/bellman_ford.h Tue Jul 18 13:29:59 2006 +0000
1.3 @@ -192,7 +192,7 @@
1.4
1.5 class UninitializedParameter : public lemon::UninitializedParameter {
1.6 public:
1.7 - virtual const char* exceptionName() const {
1.8 + virtual const char* what() const throw() {
1.9 return "lemon::BellmanFord::UninitializedParameter";
1.10 }
1.11 };
2.1 --- a/lemon/bfs.h Tue Jul 18 12:10:52 2006 +0000
2.2 +++ b/lemon/bfs.h Tue Jul 18 13:29:59 2006 +0000
2.3 @@ -142,7 +142,7 @@
2.4 */
2.5 class UninitializedParameter : public lemon::UninitializedParameter {
2.6 public:
2.7 - virtual const char* exceptionName() const {
2.8 + virtual const char* what() const throw() {
2.9 return "lemon::Bfs::UninitializedParameter";
2.10 }
2.11 };
3.1 --- a/lemon/bipartite_matching.h Tue Jul 18 12:10:52 2006 +0000
3.2 +++ b/lemon/bipartite_matching.h Tue Jul 18 13:29:59 2006 +0000
3.3 @@ -593,7 +593,7 @@
3.4 /// of the parameters of the algorithms.
3.5 class UninitializedParameter : public lemon::UninitializedParameter {
3.6 public:
3.7 - virtual const char* exceptionName() const {
3.8 + virtual const char* what() const throw() {
3.9 return "lemon::MaxWeightedBipartiteMatching::UninitializedParameter";
3.10 }
3.11 };
3.12 @@ -1164,7 +1164,7 @@
3.13 /// of the parameters of the algorithms.
3.14 class UninitializedParameter : public lemon::UninitializedParameter {
3.15 public:
3.16 - virtual const char* exceptionName() const {
3.17 + virtual const char* what() const throw() {
3.18 return "lemon::MinCostMaxBipartiteMatching::UninitializedParameter";
3.19 }
3.20 };
4.1 --- a/lemon/bits/utility.h Tue Jul 18 12:10:52 2006 +0000
4.2 +++ b/lemon/bits/utility.h Tue Jul 18 13:29:59 2006 +0000
4.3 @@ -161,7 +161,7 @@
4.4
4.5 struct WrongStateError : public lemon::LogicError {
4.6 public:
4.7 - virtual const char* exceptionName() const {
4.8 + virtual const char* what() const throw() {
4.9 return "lemon::BiVariant::WrongStateError";
4.10 }
4.11 };
5.1 --- a/lemon/dag_shortest_path.h Tue Jul 18 12:10:52 2006 +0000
5.2 +++ b/lemon/dag_shortest_path.h Tue Jul 18 13:29:59 2006 +0000
5.3 @@ -302,7 +302,7 @@
5.4
5.5 class UninitializedParameter : public lemon::UninitializedParameter {
5.6 public:
5.7 - virtual const char* exceptionName() const {
5.8 + virtual const char* what() const throw() {
5.9 return "lemon::DagShortestPath::UninitializedParameter";
5.10 }
5.11 };
6.1 --- a/lemon/dfs.h Tue Jul 18 12:10:52 2006 +0000
6.2 +++ b/lemon/dfs.h Tue Jul 18 13:29:59 2006 +0000
6.3 @@ -143,7 +143,7 @@
6.4 */
6.5 class UninitializedParameter : public lemon::UninitializedParameter {
6.6 public:
6.7 - virtual const char* exceptionName() const {
6.8 + virtual const char* what() const throw() {
6.9 return "lemon::Dfs::UninitializedParameter";
6.10 }
6.11 };
6.12 @@ -1223,7 +1223,7 @@
6.13 /// of the parameters of the algorithms.
6.14 class UninitializedParameter : public lemon::UninitializedParameter {
6.15 public:
6.16 - virtual const char* exceptionName() const {
6.17 + virtual const char* what() const throw()
6.18 return "lemon::DfsVisit::UninitializedParameter";
6.19 }
6.20 };
7.1 --- a/lemon/dijkstra.h Tue Jul 18 12:10:52 2006 +0000
7.2 +++ b/lemon/dijkstra.h Tue Jul 18 13:29:59 2006 +0000
7.3 @@ -187,7 +187,7 @@
7.4 */
7.5 class UninitializedParameter : public lemon::UninitializedParameter {
7.6 public:
7.7 - virtual const char* exceptionName() const {
7.8 + virtual const char* what() const throw() {
7.9 return "lemon::Dijkstra::UninitializedParameter";
7.10 }
7.11 };
8.1 --- a/lemon/edge_set.h Tue Jul 18 12:10:52 2006 +0000
8.2 +++ b/lemon/edge_set.h Tue Jul 18 13:29:59 2006 +0000
8.3 @@ -586,7 +586,7 @@
8.4
8.5 class UnsupportedOperation : public LogicError {
8.6 public:
8.7 - virtual const char* exceptionName() const {
8.8 + virtual const char* what() const throw() {
8.9 return "lemon::SmartEdgeSet::UnsupportedOperation";
8.10 }
8.11 };
8.12 @@ -683,7 +683,7 @@
8.13
8.14 class UnsupportedOperation : public LogicError {
8.15 public:
8.16 - virtual const char* exceptionName() const {
8.17 + virtual const char* what() const throw() {
8.18 return "lemon::SmartUEdgeSet::UnsupportedOperation";
8.19 }
8.20 };
9.1 --- a/lemon/edmonds_karp.h Tue Jul 18 12:10:52 2006 +0000
9.2 +++ b/lemon/edmonds_karp.h Tue Jul 18 13:29:59 2006 +0000
9.3 @@ -70,7 +70,7 @@
9.4 ///
9.5 class InvalidArgument : public lemon::LogicError {
9.6 public:
9.7 - virtual const char* exceptionName() const {
9.8 + virtual const char* what() const throw() {
9.9 return "lemon::EdmondsKarp::InvalidArgument";
9.10 }
9.11 };
10.1 --- a/lemon/error.h Tue Jul 18 12:10:52 2006 +0000
10.2 +++ b/lemon/error.h Tue Jul 18 13:29:59 2006 +0000
10.3 @@ -176,15 +176,9 @@
10.4 Exception() {}
10.5 ///\e
10.6 virtual ~Exception() throw() {}
10.7 -
10.8 - ///\e
10.9 - virtual const char* exceptionName() const {
10.10 - return "lemon::Exception";
10.11 - }
10.12 -
10.13 ///\e
10.14 virtual const char* what() const throw() {
10.15 - return exceptionName();
10.16 + return "lemon::Exception";
10.17 }
10.18 };
10.19
10.20 @@ -199,7 +193,7 @@
10.21 */
10.22 class LogicError : public Exception {
10.23 public:
10.24 - virtual const char* exceptionName() const {
10.25 + virtual const char* what() const throw() {
10.26 return "lemon::LogicError";
10.27 }
10.28 };
10.29 @@ -212,7 +206,7 @@
10.30 */
10.31 class UninitializedParameter : public LogicError {
10.32 public:
10.33 - virtual const char* exceptionName() const {
10.34 + virtual const char* what() const throw() {
10.35 return "lemon::UninitializedParameter";
10.36 }
10.37 };
10.38 @@ -227,7 +221,7 @@
10.39 */
10.40 class RuntimeError : public Exception {
10.41 public:
10.42 - virtual const char* exceptionName() const {
10.43 + virtual const char* what() const throw() {
10.44 return "lemon::RuntimeError";
10.45 }
10.46 };
10.47 @@ -235,7 +229,7 @@
10.48 ///\e
10.49 class RangeError : public RuntimeError {
10.50 public:
10.51 - virtual const char* exceptionName() const {
10.52 + virtual const char* what() const throw() {
10.53 return "lemon::RangeError";
10.54 }
10.55 };
10.56 @@ -243,7 +237,7 @@
10.57 ///\e
10.58 class IOError : public RuntimeError {
10.59 public:
10.60 - virtual const char* exceptionName() const {
10.61 + virtual const char* what() const throw() {
10.62 return "lemon::IOError";
10.63 }
10.64 };
10.65 @@ -304,7 +298,7 @@
10.66 virtual const char* what() const throw() {
10.67 try {
10.68 std::ostringstream ostr;
10.69 - ostr << exceptionName() << ": ";
10.70 + ostr << "lemon:DataFormatError" << ": ";
10.71 if (message()) ostr << message();
10.72 if( file() || line() != 0 ) {
10.73 ostr << " (";
10.74 @@ -317,11 +311,7 @@
10.75 }
10.76 catch (...) {}
10.77 if( _message_holder.valid()) return _message_holder.get().c_str();
10.78 - return exceptionName();
10.79 - }
10.80 -
10.81 - virtual const char* exceptionName() const {
10.82 - return "lemon::DataFormatError";
10.83 + return "lemon:DataFormatError";
10.84 }
10.85
10.86 virtual ~DataFormatError() throw() {}
10.87 @@ -361,19 +351,14 @@
10.88 virtual const char* what() const throw() {
10.89 try {
10.90 std::ostringstream ostr;
10.91 - ostr << exceptionName() << ": ";
10.92 + ostr << "lemon::FileOpenError" << ": ";
10.93 ostr << "Cannot open file - " << file();
10.94 _message_holder.set(ostr.str());
10.95 }
10.96 catch (...) {}
10.97 if( _message_holder.valid()) return _message_holder.get().c_str();
10.98 - return exceptionName();
10.99 - }
10.100 -
10.101 - virtual const char* exceptionName() const {
10.102 return "lemon::FileOpenError";
10.103 }
10.104 -
10.105 virtual ~FileOpenError() throw() {}
10.106 };
10.107
10.108 @@ -431,13 +416,8 @@
10.109 }
10.110 catch (...) {}
10.111 if( _message_holder.valid() ) return _message_holder.get().c_str();
10.112 - return exceptionName();
10.113 + return "lemon:IOParameterError";
10.114 }
10.115 -
10.116 - virtual const char* exceptionName() const {
10.117 - return "lemon::IOParameterError";
10.118 - }
10.119 -
10.120 virtual ~IOParameterError() throw() {}
10.121 };
10.122
10.123 @@ -485,14 +465,9 @@
10.124 }
10.125 catch(...) {}
10.126 if( _message_holder.valid() ) return _message_holder.get().c_str();
10.127 - return exceptionName();
10.128 - }
10.129 -
10.130 - virtual const char* exceptionName() const {
10.131 return "lemon::AssertionFailedError";
10.132 }
10.133 -
10.134 - virtual ~AssertionFailedError() throw() {}
10.135 + virtual ~AssertionFailedError() throw() {}
10.136 };
10.137
10.138
11.1 --- a/lemon/floyd_warshall.h Tue Jul 18 12:10:52 2006 +0000
11.2 +++ b/lemon/floyd_warshall.h Tue Jul 18 13:29:59 2006 +0000
11.3 @@ -199,7 +199,7 @@
11.4
11.5 class UninitializedParameter : public lemon::UninitializedParameter {
11.6 public:
11.7 - virtual const char* exceptionName() const {
11.8 + virtual const char* what() const throw() {
11.9 return "lemon::FloydWarshall::UninitializedParameter";
11.10 }
11.11 };
12.1 --- a/lemon/fredman_tarjan.h Tue Jul 18 12:10:52 2006 +0000
12.2 +++ b/lemon/fredman_tarjan.h Tue Jul 18 13:29:59 2006 +0000
12.3 @@ -132,7 +132,7 @@
12.4 ///of the parameters of the algorithms.
12.5 class UninitializedParameter : public lemon::UninitializedParameter {
12.6 public:
12.7 - virtual const char* exceptionName() const {
12.8 + virtual const char* what() const throw() {
12.9 return "lemon::FredmanTarjan::UninitializedParameter";
12.10 }
12.11 };
13.1 --- a/lemon/full_graph.h Tue Jul 18 12:10:52 2006 +0000
13.2 +++ b/lemon/full_graph.h Tue Jul 18 13:29:59 2006 +0000
13.3 @@ -499,7 +499,7 @@
13.4 public:
13.5
13.6 class NodeSetError : public LogicError {
13.7 - virtual const char* exceptionName() const {
13.8 + virtual const char* what() const throw() {
13.9 return "lemon::FullBpUGraph::NodeSetError";
13.10 }
13.11 };
14.1 --- a/lemon/grid_ugraph.h Tue Jul 18 12:10:52 2006 +0000
14.2 +++ b/lemon/grid_ugraph.h Tue Jul 18 13:29:59 2006 +0000
14.3 @@ -117,7 +117,7 @@
14.4
14.5 class IndexError : public RuntimeError {
14.6 public:
14.7 - virtual const char* exceptionName() const {
14.8 + virtual const char* what() const throw() {
14.9 return "lemon::GridUGraph::IndexError";
14.10 }
14.11 };
15.1 --- a/lemon/johnson.h Tue Jul 18 12:10:52 2006 +0000
15.2 +++ b/lemon/johnson.h Tue Jul 18 13:29:59 2006 +0000
15.3 @@ -234,7 +234,7 @@
15.4
15.5 class UninitializedParameter : public lemon::UninitializedParameter {
15.6 public:
15.7 - virtual const char* exceptionName() const {
15.8 + virtual const char* what() const throw() {
15.9 return "lemon::Johnson::UninitializedParameter";
15.10 }
15.11 };
16.1 --- a/lemon/list_graph.h Tue Jul 18 12:10:52 2006 +0000
16.2 +++ b/lemon/list_graph.h Tue Jul 18 13:29:59 2006 +0000
16.3 @@ -508,7 +508,7 @@
16.4
16.5 class UnsupportedOperation : public LogicError {
16.6 public:
16.7 - virtual const char* exceptionName() const {
16.8 + virtual const char* what() const throw() {
16.9 return "lemon::ListGraph::Snapshot::UnsupportedOperation";
16.10 }
16.11 };
16.12 @@ -841,7 +841,7 @@
16.13 public:
16.14
16.15 class NodeSetError : public LogicError {
16.16 - virtual const char* exceptionName() const {
16.17 + virtual const char* what() const throw() {
16.18 return "lemon::ListBpUGraph::NodeSetError";
16.19 }
16.20 };
17.1 --- a/lemon/min_cost_arborescence.h Tue Jul 18 12:10:52 2006 +0000
17.2 +++ b/lemon/min_cost_arborescence.h Tue Jul 18 13:29:59 2006 +0000
17.3 @@ -138,7 +138,7 @@
17.4 /// of the parameters of the algorithms.
17.5 class UninitializedParameter : public lemon::UninitializedParameter {
17.6 public:
17.7 - virtual const char* exceptionName() const {
17.8 + virtual const char* what() const throw() {
17.9 return "lemon::MinCostArborescence::UninitializedParameter";
17.10 }
17.11 };
18.1 --- a/lemon/min_cut.h Tue Jul 18 12:10:52 2006 +0000
18.2 +++ b/lemon/min_cut.h Tue Jul 18 13:29:59 2006 +0000
18.3 @@ -207,7 +207,7 @@
18.4 /// of the parameters of the algorithms.
18.5 class UninitializedParameter : public lemon::UninitializedParameter {
18.6 public:
18.7 - virtual const char* exceptionName() const {
18.8 + virtual const char* what() const throw() {
18.9 return "lemon::MaxCardinalitySearch::UninitializedParameter";
18.10 }
18.11 };
18.12 @@ -858,7 +858,7 @@
18.13 /// of the parameters of the algorithms.
18.14 class UninitializedParameter : public lemon::UninitializedParameter {
18.15 public:
18.16 - virtual const char* exceptionName() const {
18.17 + virtual const char* what() const throw() {
18.18 return "lemon::MinCut::UninitializedParameter";
18.19 }
18.20 };
19.1 --- a/lemon/preflow.h Tue Jul 18 12:10:52 2006 +0000
19.2 +++ b/lemon/preflow.h Tue Jul 18 13:29:59 2006 +0000
19.3 @@ -102,7 +102,7 @@
19.4 ///\ref Exception for the case when the source equals the target.
19.5 class InvalidArgument : public lemon::LogicError {
19.6 public:
19.7 - virtual const char* exceptionName() const {
19.8 + virtual const char* what() const throw() {
19.9 return "lemon::Preflow::InvalidArgument";
19.10 }
19.11 };
20.1 --- a/lemon/prim.h Tue Jul 18 12:10:52 2006 +0000
20.2 +++ b/lemon/prim.h Tue Jul 18 13:29:59 2006 +0000
20.3 @@ -187,7 +187,7 @@
20.4 /// of the parameters of the algorithms.
20.5 class UninitializedParameter : public lemon::UninitializedParameter {
20.6 public:
20.7 - virtual const char* exceptionName() const {
20.8 + virtual const char* what() const throw() {
20.9 return "lemon::Prim::UninitializedParameter";
20.10 }
20.11 };
21.1 --- a/lemon/radix_heap.h Tue Jul 18 12:10:52 2006 +0000
21.2 +++ b/lemon/radix_heap.h Tue Jul 18 13:29:59 2006 +0000
21.3 @@ -37,7 +37,7 @@
21.4
21.5 class UnderFlowPriorityError : public RuntimeError {
21.6 public:
21.7 - virtual const char* exceptionName() const {
21.8 + virtual const char* what() const throw() {
21.9 return "lemon::UnderFlowPriorityError";
21.10 }
21.11 };
22.1 --- a/lemon/refptr.h Tue Jul 18 12:10:52 2006 +0000
22.2 +++ b/lemon/refptr.h Tue Jul 18 13:29:59 2006 +0000
22.3 @@ -45,8 +45,10 @@
22.4
22.5 void attach(RefPtr &r)
22.6 {
22.7 - prev=&r; next=r.next; ref=r.ref;
22.8 - r.next=this;
22.9 + if(r.ref) {
22.10 + prev=&r; next=r.next; ref=r.ref;
22.11 + r.next=this;
22.12 + }
22.13 }
22.14 void attach(const T *p)
22.15 {
22.16 @@ -139,6 +141,30 @@
22.17 ///\e
22.18 operator bool() const { return ref; }
22.19
22.20 + ///\e
22.21 + const RefPtr &borrow(const T* &p) {
22.22 + lock();
22.23 + if(ref==p) {
22.24 + if(prev) prev->next=next;
22.25 + if(next) next->prev=prev;
22.26 + }
22.27 + else release();
22.28 + ref=p;
22.29 + next=prev=this;
22.30 + unlock();
22.31 + return *this;
22.32 + }
22.33 +
22.34 + ///\e
22.35 + const RefPtr &borrow() {
22.36 + lock();
22.37 + if(prev) prev->next=next;
22.38 + if(next) next->prev=prev;
22.39 + next=prev=this;
22.40 + unlock();
22.41 + return *this;
22.42 + }
22.43 +
22.44 }; //END OF CLASS REFPTR
22.45
22.46 } //END OF NAMESPACE LEMON
23.1 --- a/lemon/smart_graph.h Tue Jul 18 12:10:52 2006 +0000
23.2 +++ b/lemon/smart_graph.h Tue Jul 18 13:29:59 2006 +0000
23.3 @@ -431,7 +431,7 @@
23.4 public:
23.5
23.6 class NodeSetError : public LogicError {
23.7 - virtual const char* exceptionName() const {
23.8 + virtual const char* what() const throw() {
23.9 return "lemon::SmartBpUGraph::NodeSetError";
23.10 }
23.11 };
24.1 --- a/lemon/tabu_search.h Tue Jul 18 12:10:52 2006 +0000
24.2 +++ b/lemon/tabu_search.h Tue Jul 18 13:29:59 2006 +0000
24.3 @@ -341,7 +341,7 @@
24.4 /// is less than 2.
24.5 class BadParameterError : public lemon::LogicError {
24.6 public:
24.7 - virtual const char* exceptionName() const {
24.8 + virtual const char* what() const throw() {
24.9 return "lemon::TabuSearch::BadParameterError";
24.10 }
24.11 };