[Lemon-commits] Alpar Juttner: Merge

Lemon HG hg at lemon.cs.elte.hu
Wed Oct 1 13:58:26 CEST 2008


details:   http://lemon.cs.elte.hu/hg/lemon/rev/cbe3ec2d59d2
changeset: 294:cbe3ec2d59d2
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Wed Oct 01 13:56:40 2008 +0200
description:
	Merge

diffstat:

11 files changed, 389 insertions(+), 523 deletions(-)
demo/lgf_demo.cc      |    2 
lemon/arg_parser.h    |    5 
lemon/assert.h        |    2 
lemon/bfs.h           |   39 ---
lemon/concepts/heap.h |    1 
lemon/dfs.h           |   38 ---
lemon/dijkstra.h      |   27 --
lemon/error.h         |  540 ++++++++++++++++++-------------------------------
lemon/graph_to_eps.h  |   15 +
lemon/lgf_reader.h    |  213 ++++++++++---------
lemon/lgf_writer.h    |   30 +-

diffs (truncated from 1742 to 300 lines):

diff -r 47fbc814aa31 -r cbe3ec2d59d2 demo/lgf_demo.cc
--- a/demo/lgf_demo.cc	Wed Oct 01 12:44:16 2008 +0200
+++ b/demo/lgf_demo.cc	Wed Oct 01 13:56:40 2008 +0200
@@ -49,7 +49,7 @@
       node("source", s).             // read 'source' node to s
       node("target", t).             // read 'target' node to t
       run();
-  } catch (DataFormatError& error) { // check if there was any error
+  } catch (Exception& error) { // check if there was any error
     std::cerr << "Error: " << error.what() << std::endl;
     return -1;
   }
diff -r 47fbc814aa31 -r cbe3ec2d59d2 lemon/arg_parser.h
--- a/lemon/arg_parser.h	Wed Oct 01 12:44:16 2008 +0200
+++ b/lemon/arg_parser.h	Wed Oct 01 13:56:40 2008 +0200
@@ -310,8 +310,9 @@
 
     ///This is the type of the return value of ArgParser::operator[]().
     ///It automatically converts to \c int, \c double, \c bool or
-    ///\c std::string if the type of the option matches, otherwise it
-    ///throws an exception (i.e. it performs runtime type checking).
+    ///\c std::string if the type of the option matches, which is checked
+    ///with an \ref LEMON_ASSERT "assertion" (i.e. it performs runtime
+    ///type checking).
     class RefType
     {
       const ArgParser &_parser;
diff -r 47fbc814aa31 -r cbe3ec2d59d2 lemon/assert.h
--- a/lemon/assert.h	Wed Oct 01 12:44:16 2008 +0200
+++ b/lemon/assert.h	Wed Oct 01 13:56:40 2008 +0200
@@ -108,7 +108,7 @@
 ///
 /// \brief Macro for assertion with customizable message
 ///
-/// Macro for assertion with customizable message.  
+/// Macro for assertion with customizable message.
 /// \param exp An expression that must be convertible to \c bool.  If it is \c
 /// false, then an assertion is raised. The concrete behaviour depends on the
 /// settings of the assertion system.
diff -r 47fbc814aa31 -r cbe3ec2d59d2 lemon/bfs.h
--- a/lemon/bfs.h	Wed Oct 01 12:44:16 2008 +0200
+++ b/lemon/bfs.h	Wed Oct 01 13:56:40 2008 +0200
@@ -135,16 +135,6 @@
 #endif
   class Bfs {
   public:
-    ///\ref Exception for uninitialized parameters.
-
-    ///This error represents problems in the initialization of the
-    ///parameters of the algorithm.
-    class UninitializedParameter : public lemon::UninitializedParameter {
-    public:
-      virtual const char* what() const throw() {
-        return "lemon::Bfs::UninitializedParameter";
-      }
-    };
 
     ///The type of the digraph the algorithm runs on.
     typedef typename TR::Digraph Digraph;
@@ -232,7 +222,8 @@
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "PredMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -250,7 +241,8 @@
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "DistMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -268,7 +260,8 @@
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "ReachedMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -286,7 +279,8 @@
       typedef T ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "ProcessedMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -304,6 +298,7 @@
       static ProcessedMap *createProcessedMap(const Digraph &g)
       {
         return new ProcessedMap(g);
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -1040,7 +1035,6 @@
     ///\return \c true if \c t is reachable form \c s.
     bool run(Node s, Node t)
     {
-      if (s==INVALID || t==INVALID) throw UninitializedParameter();
       Bfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
       if (Base::_pred)
         alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
@@ -1323,18 +1317,6 @@
   class BfsVisit {
   public:
 
-    /// \brief \ref Exception for uninitialized parameters.
-    ///
-    /// This error represents problems in the initialization
-    /// of the parameters of the algorithm.
-    class UninitializedParameter : public lemon::UninitializedParameter {
-    public:
-      virtual const char* what() const throw()
-      {
-        return "lemon::BfsVisit::UninitializedParameter";
-      }
-    };
-
     ///The traits class.
     typedef _Traits Traits;
 
@@ -1389,7 +1371,8 @@
     struct SetReachedMapTraits : public Traits {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &digraph) {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "ReachedMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     /// \brief \ref named-templ-param "Named parameter" for setting
diff -r 47fbc814aa31 -r cbe3ec2d59d2 lemon/concepts/heap.h
--- a/lemon/concepts/heap.h	Wed Oct 01 12:44:16 2008 +0200
+++ b/lemon/concepts/heap.h	Wed Oct 01 13:56:40 2008 +0200
@@ -129,7 +129,6 @@
       /// already stored in the heap.
       /// Otherwise it inserts the given item with the given priority.
       ///
-      /// It may throw an \ref UnderflowPriorityException.
       /// \param i The item.
       /// \param p The priority.
       void set(const Item &i, const Prio &p) {}
diff -r 47fbc814aa31 -r cbe3ec2d59d2 lemon/dfs.h
--- a/lemon/dfs.h	Wed Oct 01 12:44:16 2008 +0200
+++ b/lemon/dfs.h	Wed Oct 01 13:56:40 2008 +0200
@@ -136,16 +136,6 @@
 #endif
   class Dfs {
   public:
-    ///\ref Exception for uninitialized parameters.
-
-    ///This error represents problems in the initialization of the
-    ///parameters of the algorithm.
-    class UninitializedParameter : public lemon::UninitializedParameter {
-    public:
-      virtual const char* what() const throw() {
-        return "lemon::Dfs::UninitializedParameter";
-      }
-    };
 
     ///The type of the digraph the algorithm runs on.
     typedef typename TR::Digraph Digraph;
@@ -232,7 +222,8 @@
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "PredMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -250,7 +241,8 @@
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "DistMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -268,7 +260,8 @@
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "ReachedMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -286,7 +279,8 @@
       typedef T ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "ProcessedMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -974,7 +968,6 @@
     ///\return \c true if \c t is reachable form \c s.
     bool run(Node s, Node t)
     {
-      if (s==INVALID || t==INVALID) throw UninitializedParameter();
       Dfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
       if (Base::_pred)
         alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
@@ -1270,18 +1263,6 @@
   class DfsVisit {
   public:
 
-    /// \brief \ref Exception for uninitialized parameters.
-    ///
-    /// This error represents problems in the initialization
-    /// of the parameters of the algorithm.
-    class UninitializedParameter : public lemon::UninitializedParameter {
-    public:
-      virtual const char* what() const throw()
-      {
-        return "lemon::DfsVisit::UninitializedParameter";
-      }
-    };
-
     ///The traits class.
     typedef _Traits Traits;
 
@@ -1336,7 +1317,8 @@
     struct SetReachedMapTraits : public Traits {
       typedef T ReachedMap;
       static ReachedMap *createReachedMap(const Digraph &digraph) {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "ReachedMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     /// \brief \ref named-templ-param "Named parameter" for setting
diff -r 47fbc814aa31 -r cbe3ec2d59d2 lemon/dijkstra.h
--- a/lemon/dijkstra.h	Wed Oct 01 12:44:16 2008 +0200
+++ b/lemon/dijkstra.h	Wed Oct 01 13:56:40 2008 +0200
@@ -225,16 +225,6 @@
 #endif
   class Dijkstra {
   public:
-    ///\ref Exception for uninitialized parameters.
-
-    ///This error represents problems in the initialization of the
-    ///parameters of the algorithm.
-    class UninitializedParameter : public lemon::UninitializedParameter {
-    public:
-      virtual const char* what() const throw() {
-        return "lemon::Dijkstra::UninitializedParameter";
-      }
-    };
 
     ///The type of the digraph the algorithm runs on.
     typedef typename TR::Digraph Digraph;
@@ -332,7 +322,8 @@
       typedef T PredMap;
       static PredMap *createPredMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "PredMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -351,7 +342,8 @@
       typedef T DistMap;
       static DistMap *createDistMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "DistMap is not initialized");
+        return 0; // ignore warnings
       }
     };
     ///\brief \ref named-templ-param "Named parameter" for setting
@@ -370,7 +362,8 @@
       typedef T ProcessedMap;
       static ProcessedMap *createProcessedMap(const Digraph &)
       {
-        throw UninitializedParameter();
+        LEMON_ASSERT(false, "ProcessedMap is not initialized");
+        return 0; // ignore warnings
       }



More information about the Lemon-commits mailing list