COIN-OR::LEMON - Graph Library

Changeset 290:f6899946c1ac in lemon-1.0 for lemon/dijkstra.h


Ignore:
Timestamp:
09/30/08 20:53:18 (11 years ago)
Author:
Balazs Dezso <deba@…>
Branch:
default
Phase:
public
Message:

Simplifying exceptions

  • Using asserts instead of exceptions for unitialized parameters
  • Only the IO exceptions are used in the lemon
  • DataFormatError? is renamed to FormatError?
  • The IoError? is used for file access errors
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/dijkstra.h

    r287 r290  
    226226  class Dijkstra {
    227227  public:
    228     ///\ref Exception for uninitialized parameters.
    229 
    230     ///This error represents problems in the initialization of the
    231     ///parameters of the algorithm.
    232     class UninitializedParameter : public lemon::UninitializedParameter {
    233     public:
    234       virtual const char* what() const throw() {
    235         return "lemon::Dijkstra::UninitializedParameter";
    236       }
    237     };
    238228
    239229    ///The type of the digraph the algorithm runs on.
     
    333323      static PredMap *createPredMap(const Digraph &)
    334324      {
    335         throw UninitializedParameter();
     325        LEMON_ASSERT(false, "PredMap is not initialized");
     326        return 0; // ignore warnings
    336327      }
    337328    };
     
    352343      static DistMap *createDistMap(const Digraph &)
    353344      {
    354         throw UninitializedParameter();
     345        LEMON_ASSERT(false, "DistMap is not initialized");
     346        return 0; // ignore warnings
    355347      }
    356348    };
     
    371363      static ProcessedMap *createProcessedMap(const Digraph &)
    372364      {
    373         throw UninitializedParameter();
     365        LEMON_ASSERT(false, "ProcessedMap is not initialized");
     366        return 0; // ignore warnings
    374367      }
    375368    };
     
    409402      typedef H Heap;
    410403      static HeapCrossRef *createHeapCrossRef(const Digraph &) {
    411         throw UninitializedParameter();
     404        LEMON_ASSERT(false, "HeapCrossRef is not initialized");
     405        return 0; // ignore warnings
    412406      }
    413407      static Heap *createHeap(HeapCrossRef &)
    414408      {
    415         throw UninitializedParameter();
     409        LEMON_ASSERT(false, "Heap is not initialized");
     410        return 0; // ignore warnings
    416411      }
    417412    };
     
    11591154    void run(Node s)
    11601155    {
    1161       if (s==INVALID) throw UninitializedParameter();
    11621156      Dijkstra<Digraph,LengthMap,TR>
    11631157        dijk(*reinterpret_cast<const Digraph*>(Base::_g),
     
    11811175    bool run(Node s, Node t)
    11821176    {
    1183       if (s==INVALID || t==INVALID) throw UninitializedParameter();
    11841177      Dijkstra<Digraph,LengthMap,TR>
    11851178        dijk(*reinterpret_cast<const Digraph*>(Base::_g),
Note: See TracChangeset for help on using the changeset viewer.