lemon/bfs.h
changeset 294 cbe3ec2d59d2
parent 290 f6899946c1ac
parent 288 47b3a3b67837
child 301 9db8964f0cf6
     1.1 --- a/lemon/bfs.h	Wed Oct 01 12:44:16 2008 +0200
     1.2 +++ b/lemon/bfs.h	Wed Oct 01 13:56:40 2008 +0200
     1.3 @@ -135,16 +135,6 @@
     1.4  #endif
     1.5    class Bfs {
     1.6    public:
     1.7 -    ///\ref Exception for uninitialized parameters.
     1.8 -
     1.9 -    ///This error represents problems in the initialization of the
    1.10 -    ///parameters of the algorithm.
    1.11 -    class UninitializedParameter : public lemon::UninitializedParameter {
    1.12 -    public:
    1.13 -      virtual const char* what() const throw() {
    1.14 -        return "lemon::Bfs::UninitializedParameter";
    1.15 -      }
    1.16 -    };
    1.17  
    1.18      ///The type of the digraph the algorithm runs on.
    1.19      typedef typename TR::Digraph Digraph;
    1.20 @@ -232,7 +222,8 @@
    1.21        typedef T PredMap;
    1.22        static PredMap *createPredMap(const Digraph &)
    1.23        {
    1.24 -        throw UninitializedParameter();
    1.25 +        LEMON_ASSERT(false, "PredMap is not initialized");
    1.26 +        return 0; // ignore warnings
    1.27        }
    1.28      };
    1.29      ///\brief \ref named-templ-param "Named parameter" for setting
    1.30 @@ -250,7 +241,8 @@
    1.31        typedef T DistMap;
    1.32        static DistMap *createDistMap(const Digraph &)
    1.33        {
    1.34 -        throw UninitializedParameter();
    1.35 +        LEMON_ASSERT(false, "DistMap is not initialized");
    1.36 +        return 0; // ignore warnings
    1.37        }
    1.38      };
    1.39      ///\brief \ref named-templ-param "Named parameter" for setting
    1.40 @@ -268,7 +260,8 @@
    1.41        typedef T ReachedMap;
    1.42        static ReachedMap *createReachedMap(const Digraph &)
    1.43        {
    1.44 -        throw UninitializedParameter();
    1.45 +        LEMON_ASSERT(false, "ReachedMap is not initialized");
    1.46 +        return 0; // ignore warnings
    1.47        }
    1.48      };
    1.49      ///\brief \ref named-templ-param "Named parameter" for setting
    1.50 @@ -286,7 +279,8 @@
    1.51        typedef T ProcessedMap;
    1.52        static ProcessedMap *createProcessedMap(const Digraph &)
    1.53        {
    1.54 -        throw UninitializedParameter();
    1.55 +        LEMON_ASSERT(false, "ProcessedMap is not initialized");
    1.56 +        return 0; // ignore warnings
    1.57        }
    1.58      };
    1.59      ///\brief \ref named-templ-param "Named parameter" for setting
    1.60 @@ -304,6 +298,7 @@
    1.61        static ProcessedMap *createProcessedMap(const Digraph &g)
    1.62        {
    1.63          return new ProcessedMap(g);
    1.64 +        return 0; // ignore warnings
    1.65        }
    1.66      };
    1.67      ///\brief \ref named-templ-param "Named parameter" for setting
    1.68 @@ -1040,7 +1035,6 @@
    1.69      ///\return \c true if \c t is reachable form \c s.
    1.70      bool run(Node s, Node t)
    1.71      {
    1.72 -      if (s==INVALID || t==INVALID) throw UninitializedParameter();
    1.73        Bfs<Digraph,TR> alg(*reinterpret_cast<const Digraph*>(Base::_g));
    1.74        if (Base::_pred)
    1.75          alg.predMap(*reinterpret_cast<PredMap*>(Base::_pred));
    1.76 @@ -1323,18 +1317,6 @@
    1.77    class BfsVisit {
    1.78    public:
    1.79  
    1.80 -    /// \brief \ref Exception for uninitialized parameters.
    1.81 -    ///
    1.82 -    /// This error represents problems in the initialization
    1.83 -    /// of the parameters of the algorithm.
    1.84 -    class UninitializedParameter : public lemon::UninitializedParameter {
    1.85 -    public:
    1.86 -      virtual const char* what() const throw()
    1.87 -      {
    1.88 -        return "lemon::BfsVisit::UninitializedParameter";
    1.89 -      }
    1.90 -    };
    1.91 -
    1.92      ///The traits class.
    1.93      typedef _Traits Traits;
    1.94  
    1.95 @@ -1389,7 +1371,8 @@
    1.96      struct SetReachedMapTraits : public Traits {
    1.97        typedef T ReachedMap;
    1.98        static ReachedMap *createReachedMap(const Digraph &digraph) {
    1.99 -        throw UninitializedParameter();
   1.100 +        LEMON_ASSERT(false, "ReachedMap is not initialized");
   1.101 +        return 0; // ignore warnings
   1.102        }
   1.103      };
   1.104      /// \brief \ref named-templ-param "Named parameter" for setting