gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Get rid of exceptions in Preflow
0 1 0
default
1 file changed with 4 insertions and 14 deletions:
↑ Collapse diff ↑
Ignore white space 12 line context
... ...
@@ -16,13 +16,12 @@
16 16
 *
17 17
 */
18 18

	
19 19
#ifndef LEMON_PREFLOW_H
20 20
#define LEMON_PREFLOW_H
21 21

	
22
#include <lemon/error.h>
23 22
#include <lemon/tolerance.h>
24 23
#include <lemon/elevator.h>
25 24

	
26 25
/// \file
27 26
/// \ingroup max_flow
28 27
/// \brief Implementation of the preflow algorithm.
... ...
@@ -129,23 +128,12 @@
129 128
    typedef typename Traits::Value Value;
130 129

	
131 130
    typedef typename Traits::FlowMap FlowMap;
132 131
    typedef typename Traits::Elevator Elevator;
133 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 134
  private:
147 135

	
148 136
    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
149 137

	
150 138
    const Digraph& _graph;
151 139
    const CapacityMap* _capacity;
... ...
@@ -205,13 +193,14 @@
205 193
    ///@{
206 194

	
207 195
    template <typename _FlowMap>
208 196
    struct DefFlowMapTraits : public Traits {
209 197
      typedef _FlowMap FlowMap;
210 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 204
    /// \brief \ref named-templ-param "Named parameter" for setting
216 205
    /// FlowMap type
217 206
    ///
... ...
@@ -225,13 +214,14 @@
225 214
    };
226 215

	
227 216
    template <typename _Elevator>
228 217
    struct DefElevatorTraits : public Traits {
229 218
      typedef _Elevator Elevator;
230 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 225
    /// \brief \ref named-templ-param "Named parameter" for setting
236 226
    /// Elevator type
237 227
    ///
0 comments (0 inline)