[Lemon-commits] [lemon_svn] alpar: r2865 - in hugo/trunk/lemon: . bits
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 21:50:53 CET 2006
Author: alpar
Date: Tue Jul 18 15:29:59 2006
New Revision: 2865
Modified:
hugo/trunk/lemon/bellman_ford.h
hugo/trunk/lemon/bfs.h
hugo/trunk/lemon/bipartite_matching.h
hugo/trunk/lemon/bits/utility.h
hugo/trunk/lemon/dag_shortest_path.h
hugo/trunk/lemon/dfs.h
hugo/trunk/lemon/dijkstra.h
hugo/trunk/lemon/edge_set.h
hugo/trunk/lemon/edmonds_karp.h
hugo/trunk/lemon/error.h
hugo/trunk/lemon/floyd_warshall.h
hugo/trunk/lemon/fredman_tarjan.h
hugo/trunk/lemon/full_graph.h
hugo/trunk/lemon/grid_ugraph.h
hugo/trunk/lemon/johnson.h
hugo/trunk/lemon/list_graph.h
hugo/trunk/lemon/min_cost_arborescence.h
hugo/trunk/lemon/min_cut.h
hugo/trunk/lemon/preflow.h
hugo/trunk/lemon/prim.h
hugo/trunk/lemon/radix_heap.h
hugo/trunk/lemon/refptr.h
hugo/trunk/lemon/smart_graph.h
hugo/trunk/lemon/tabu_search.h
Log:
exceptionName() has been thrown away
Modified: hugo/trunk/lemon/bellman_ford.h
==============================================================================
--- hugo/trunk/lemon/bellman_ford.h (original)
+++ hugo/trunk/lemon/bellman_ford.h Tue Jul 18 15:29:59 2006
@@ -192,7 +192,7 @@
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::BellmanFord::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/bfs.h
==============================================================================
--- hugo/trunk/lemon/bfs.h (original)
+++ hugo/trunk/lemon/bfs.h Tue Jul 18 15:29:59 2006
@@ -142,7 +142,7 @@
*/
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::Bfs::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/bipartite_matching.h
==============================================================================
--- hugo/trunk/lemon/bipartite_matching.h (original)
+++ hugo/trunk/lemon/bipartite_matching.h Tue Jul 18 15:29:59 2006
@@ -593,7 +593,7 @@
/// of the parameters of the algorithms.
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::MaxWeightedBipartiteMatching::UninitializedParameter";
}
};
@@ -1164,7 +1164,7 @@
/// of the parameters of the algorithms.
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::MinCostMaxBipartiteMatching::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/bits/utility.h
==============================================================================
--- hugo/trunk/lemon/bits/utility.h (original)
+++ hugo/trunk/lemon/bits/utility.h Tue Jul 18 15:29:59 2006
@@ -161,7 +161,7 @@
struct WrongStateError : public lemon::LogicError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::BiVariant::WrongStateError";
}
};
Modified: hugo/trunk/lemon/dag_shortest_path.h
==============================================================================
--- hugo/trunk/lemon/dag_shortest_path.h (original)
+++ hugo/trunk/lemon/dag_shortest_path.h Tue Jul 18 15:29:59 2006
@@ -302,7 +302,7 @@
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::DagShortestPath::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/dfs.h
==============================================================================
--- hugo/trunk/lemon/dfs.h (original)
+++ hugo/trunk/lemon/dfs.h Tue Jul 18 15:29:59 2006
@@ -143,7 +143,7 @@
*/
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::Dfs::UninitializedParameter";
}
};
@@ -1223,7 +1223,7 @@
/// of the parameters of the algorithms.
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw()
return "lemon::DfsVisit::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/dijkstra.h
==============================================================================
--- hugo/trunk/lemon/dijkstra.h (original)
+++ hugo/trunk/lemon/dijkstra.h Tue Jul 18 15:29:59 2006
@@ -187,7 +187,7 @@
*/
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::Dijkstra::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/edge_set.h
==============================================================================
--- hugo/trunk/lemon/edge_set.h (original)
+++ hugo/trunk/lemon/edge_set.h Tue Jul 18 15:29:59 2006
@@ -586,7 +586,7 @@
class UnsupportedOperation : public LogicError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::SmartEdgeSet::UnsupportedOperation";
}
};
@@ -683,7 +683,7 @@
class UnsupportedOperation : public LogicError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::SmartUEdgeSet::UnsupportedOperation";
}
};
Modified: hugo/trunk/lemon/edmonds_karp.h
==============================================================================
--- hugo/trunk/lemon/edmonds_karp.h (original)
+++ hugo/trunk/lemon/edmonds_karp.h Tue Jul 18 15:29:59 2006
@@ -70,7 +70,7 @@
///
class InvalidArgument : public lemon::LogicError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::EdmondsKarp::InvalidArgument";
}
};
Modified: hugo/trunk/lemon/error.h
==============================================================================
--- hugo/trunk/lemon/error.h (original)
+++ hugo/trunk/lemon/error.h Tue Jul 18 15:29:59 2006
@@ -176,15 +176,9 @@
Exception() {}
///\e
virtual ~Exception() throw() {}
-
- ///\e
- virtual const char* exceptionName() const {
- return "lemon::Exception";
- }
-
///\e
virtual const char* what() const throw() {
- return exceptionName();
+ return "lemon::Exception";
}
};
@@ -199,7 +193,7 @@
*/
class LogicError : public Exception {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::LogicError";
}
};
@@ -212,7 +206,7 @@
*/
class UninitializedParameter : public LogicError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::UninitializedParameter";
}
};
@@ -227,7 +221,7 @@
*/
class RuntimeError : public Exception {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::RuntimeError";
}
};
@@ -235,7 +229,7 @@
///\e
class RangeError : public RuntimeError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::RangeError";
}
};
@@ -243,7 +237,7 @@
///\e
class IOError : public RuntimeError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::IOError";
}
};
@@ -304,7 +298,7 @@
virtual const char* what() const throw() {
try {
std::ostringstream ostr;
- ostr << exceptionName() << ": ";
+ ostr << "lemon:DataFormatError" << ": ";
if (message()) ostr << message();
if( file() || line() != 0 ) {
ostr << " (";
@@ -317,11 +311,7 @@
}
catch (...) {}
if( _message_holder.valid()) return _message_holder.get().c_str();
- return exceptionName();
- }
-
- virtual const char* exceptionName() const {
- return "lemon::DataFormatError";
+ return "lemon:DataFormatError";
}
virtual ~DataFormatError() throw() {}
@@ -361,19 +351,14 @@
virtual const char* what() const throw() {
try {
std::ostringstream ostr;
- ostr << exceptionName() << ": ";
+ ostr << "lemon::FileOpenError" << ": ";
ostr << "Cannot open file - " << file();
_message_holder.set(ostr.str());
}
catch (...) {}
if( _message_holder.valid()) return _message_holder.get().c_str();
- return exceptionName();
- }
-
- virtual const char* exceptionName() const {
return "lemon::FileOpenError";
}
-
virtual ~FileOpenError() throw() {}
};
@@ -431,13 +416,8 @@
}
catch (...) {}
if( _message_holder.valid() ) return _message_holder.get().c_str();
- return exceptionName();
- }
-
- virtual const char* exceptionName() const {
- return "lemon::IOParameterError";
+ return "lemon:IOParameterError";
}
-
virtual ~IOParameterError() throw() {}
};
@@ -485,14 +465,9 @@
}
catch(...) {}
if( _message_holder.valid() ) return _message_holder.get().c_str();
- return exceptionName();
- }
-
- virtual const char* exceptionName() const {
return "lemon::AssertionFailedError";
}
-
- virtual ~AssertionFailedError() throw() {}
+ virtual ~AssertionFailedError() throw() {}
};
Modified: hugo/trunk/lemon/floyd_warshall.h
==============================================================================
--- hugo/trunk/lemon/floyd_warshall.h (original)
+++ hugo/trunk/lemon/floyd_warshall.h Tue Jul 18 15:29:59 2006
@@ -199,7 +199,7 @@
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::FloydWarshall::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/fredman_tarjan.h
==============================================================================
--- hugo/trunk/lemon/fredman_tarjan.h (original)
+++ hugo/trunk/lemon/fredman_tarjan.h Tue Jul 18 15:29:59 2006
@@ -132,7 +132,7 @@
///of the parameters of the algorithms.
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::FredmanTarjan::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/full_graph.h
==============================================================================
--- hugo/trunk/lemon/full_graph.h (original)
+++ hugo/trunk/lemon/full_graph.h Tue Jul 18 15:29:59 2006
@@ -499,7 +499,7 @@
public:
class NodeSetError : public LogicError {
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::FullBpUGraph::NodeSetError";
}
};
Modified: hugo/trunk/lemon/grid_ugraph.h
==============================================================================
--- hugo/trunk/lemon/grid_ugraph.h (original)
+++ hugo/trunk/lemon/grid_ugraph.h Tue Jul 18 15:29:59 2006
@@ -117,7 +117,7 @@
class IndexError : public RuntimeError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::GridUGraph::IndexError";
}
};
Modified: hugo/trunk/lemon/johnson.h
==============================================================================
--- hugo/trunk/lemon/johnson.h (original)
+++ hugo/trunk/lemon/johnson.h Tue Jul 18 15:29:59 2006
@@ -234,7 +234,7 @@
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::Johnson::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/list_graph.h
==============================================================================
--- hugo/trunk/lemon/list_graph.h (original)
+++ hugo/trunk/lemon/list_graph.h Tue Jul 18 15:29:59 2006
@@ -508,7 +508,7 @@
class UnsupportedOperation : public LogicError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::ListGraph::Snapshot::UnsupportedOperation";
}
};
@@ -841,7 +841,7 @@
public:
class NodeSetError : public LogicError {
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::ListBpUGraph::NodeSetError";
}
};
Modified: hugo/trunk/lemon/min_cost_arborescence.h
==============================================================================
--- hugo/trunk/lemon/min_cost_arborescence.h (original)
+++ hugo/trunk/lemon/min_cost_arborescence.h Tue Jul 18 15:29:59 2006
@@ -138,7 +138,7 @@
/// of the parameters of the algorithms.
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::MinCostArborescence::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/min_cut.h
==============================================================================
--- hugo/trunk/lemon/min_cut.h (original)
+++ hugo/trunk/lemon/min_cut.h Tue Jul 18 15:29:59 2006
@@ -207,7 +207,7 @@
/// of the parameters of the algorithms.
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::MaxCardinalitySearch::UninitializedParameter";
}
};
@@ -858,7 +858,7 @@
/// of the parameters of the algorithms.
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::MinCut::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/preflow.h
==============================================================================
--- hugo/trunk/lemon/preflow.h (original)
+++ hugo/trunk/lemon/preflow.h Tue Jul 18 15:29:59 2006
@@ -102,7 +102,7 @@
///\ref Exception for the case when the source equals the target.
class InvalidArgument : public lemon::LogicError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::Preflow::InvalidArgument";
}
};
Modified: hugo/trunk/lemon/prim.h
==============================================================================
--- hugo/trunk/lemon/prim.h (original)
+++ hugo/trunk/lemon/prim.h Tue Jul 18 15:29:59 2006
@@ -187,7 +187,7 @@
/// of the parameters of the algorithms.
class UninitializedParameter : public lemon::UninitializedParameter {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::Prim::UninitializedParameter";
}
};
Modified: hugo/trunk/lemon/radix_heap.h
==============================================================================
--- hugo/trunk/lemon/radix_heap.h (original)
+++ hugo/trunk/lemon/radix_heap.h Tue Jul 18 15:29:59 2006
@@ -37,7 +37,7 @@
class UnderFlowPriorityError : public RuntimeError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::UnderFlowPriorityError";
}
};
Modified: hugo/trunk/lemon/refptr.h
==============================================================================
--- hugo/trunk/lemon/refptr.h (original)
+++ hugo/trunk/lemon/refptr.h Tue Jul 18 15:29:59 2006
@@ -45,8 +45,10 @@
void attach(RefPtr &r)
{
- prev=&r; next=r.next; ref=r.ref;
- r.next=this;
+ if(r.ref) {
+ prev=&r; next=r.next; ref=r.ref;
+ r.next=this;
+ }
}
void attach(const T *p)
{
@@ -139,6 +141,30 @@
///\e
operator bool() const { return ref; }
+ ///\e
+ const RefPtr &borrow(const T* &p) {
+ lock();
+ if(ref==p) {
+ if(prev) prev->next=next;
+ if(next) next->prev=prev;
+ }
+ else release();
+ ref=p;
+ next=prev=this;
+ unlock();
+ return *this;
+ }
+
+ ///\e
+ const RefPtr &borrow() {
+ lock();
+ if(prev) prev->next=next;
+ if(next) next->prev=prev;
+ next=prev=this;
+ unlock();
+ return *this;
+ }
+
}; //END OF CLASS REFPTR
} //END OF NAMESPACE LEMON
Modified: hugo/trunk/lemon/smart_graph.h
==============================================================================
--- hugo/trunk/lemon/smart_graph.h (original)
+++ hugo/trunk/lemon/smart_graph.h Tue Jul 18 15:29:59 2006
@@ -431,7 +431,7 @@
public:
class NodeSetError : public LogicError {
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::SmartBpUGraph::NodeSetError";
}
};
Modified: hugo/trunk/lemon/tabu_search.h
==============================================================================
--- hugo/trunk/lemon/tabu_search.h (original)
+++ hugo/trunk/lemon/tabu_search.h Tue Jul 18 15:29:59 2006
@@ -341,7 +341,7 @@
/// is less than 2.
class BadParameterError : public lemon::LogicError {
public:
- virtual const char* exceptionName() const {
+ virtual const char* what() const throw() {
return "lemon::TabuSearch::BadParameterError";
}
};
More information about the Lemon-commits
mailing list