lemon/preflow.h
changeset 390 53c5277ba294
parent 389 660db48f324f
child 391 624e673efa76
equal deleted inserted replaced
0:d860c3f6d6d3 1:f9e1c54782af
    17  */
    17  */
    18 
    18 
    19 #ifndef LEMON_PREFLOW_H
    19 #ifndef LEMON_PREFLOW_H
    20 #define LEMON_PREFLOW_H
    20 #define LEMON_PREFLOW_H
    21 
    21 
    22 #include <lemon/error.h>
       
    23 #include <lemon/tolerance.h>
    22 #include <lemon/tolerance.h>
    24 #include <lemon/elevator.h>
    23 #include <lemon/elevator.h>
    25 
    24 
    26 /// \file
    25 /// \file
    27 /// \ingroup max_flow
    26 /// \ingroup max_flow
   130 
   129 
   131     typedef typename Traits::FlowMap FlowMap;
   130     typedef typename Traits::FlowMap FlowMap;
   132     typedef typename Traits::Elevator Elevator;
   131     typedef typename Traits::Elevator Elevator;
   133     typedef typename Traits::Tolerance Tolerance;
   132     typedef typename Traits::Tolerance Tolerance;
   134 
   133 
   135     /// \brief \ref Exception for uninitialized parameters.
       
   136     ///
       
   137     /// This error represents problems in the initialization
       
   138     /// of the parameters of the algorithms.
       
   139     class UninitializedParameter : public lemon::Exception {
       
   140     public:
       
   141       virtual const char* what() const throw() {
       
   142         return "lemon::Preflow::UninitializedParameter";
       
   143       }
       
   144     };
       
   145 
       
   146   private:
   134   private:
   147 
   135 
   148     TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
   136     TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
   149 
   137 
   150     const Digraph& _graph;
   138     const Digraph& _graph;
   206 
   194 
   207     template <typename _FlowMap>
   195     template <typename _FlowMap>
   208     struct DefFlowMapTraits : public Traits {
   196     struct DefFlowMapTraits : public Traits {
   209       typedef _FlowMap FlowMap;
   197       typedef _FlowMap FlowMap;
   210       static FlowMap *createFlowMap(const Digraph&) {
   198       static FlowMap *createFlowMap(const Digraph&) {
   211         throw UninitializedParameter();
   199         LEMON_ASSERT(false, "FlowMap is not initialized");
       
   200         return 0; // ignore warnings
   212       }
   201       }
   213     };
   202     };
   214 
   203 
   215     /// \brief \ref named-templ-param "Named parameter" for setting
   204     /// \brief \ref named-templ-param "Named parameter" for setting
   216     /// FlowMap type
   205     /// FlowMap type
   226 
   215 
   227     template <typename _Elevator>
   216     template <typename _Elevator>
   228     struct DefElevatorTraits : public Traits {
   217     struct DefElevatorTraits : public Traits {
   229       typedef _Elevator Elevator;
   218       typedef _Elevator Elevator;
   230       static Elevator *createElevator(const Digraph&, int) {
   219       static Elevator *createElevator(const Digraph&, int) {
   231         throw UninitializedParameter();
   220         LEMON_ASSERT(false, "Elevator is not initialized");
       
   221         return 0; // ignore warnings
   232       }
   222       }
   233     };
   223     };
   234 
   224 
   235     /// \brief \ref named-templ-param "Named parameter" for setting
   225     /// \brief \ref named-templ-param "Named parameter" for setting
   236     /// Elevator type
   226     /// Elevator type