Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

exceptions.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/basic.h>
35 #include <ogdf/basic/Logger.h>
36 
37 namespace ogdf {
38 
41 
51 #define OGDF_THROW_PARAM(CLASS, PARAM) cout<<flush,Logger::sfout()<<flush,throw CLASS ( PARAM )
52 
60 #define OGDF_THROW(CLASS) cout<<flush,Logger::sfout()<<flush,throw CLASS ( )
61 
62 #ifdef OGDF_DEBUG
63 # undef OGDF_THROW_PARAM
64 # define OGDF_THROW_PARAM(CLASS, PARAM) cout<<flush,Logger::sfout()<<flush,throw CLASS ( PARAM , __FILE__ , __LINE__ )
65 # undef OGDF_THROW
66 # define OGDF_THROW(CLASS) cout<<flush,Logger::sfout()<<flush,throw CLASS ( __FILE__ , __LINE__ )
67 #endif
68 
70 
72 
78  Unknown,
79  SelfLoop,
82  SingleSource,
83  UpwardPlanar,
84  Tree,
85  Forest,
86  Orthogonal,
87  Planar,
89  NoCopy,
90  Connected,
91  Biconnected,
92  Full,
93  STOP // INSERT NEW CODES BEFORE pvcSTOP!
94 }; // enum PreconditionViolatedCode
95 
96 
98 
104  Unknown,
106  NoFlow,
107  Sort,
108  Label,
109  ExternalFace,
114 
115  // The following codes are used by Abacus (think about changing them to
116  // more error describing codes)
117  PrimalBound,
118  DualBound,
119  NotInteger,
120  Buffer,
121  AddVar,
122  Sorter,
123  Phase,
124  Active,
125  NoSolution,
126  MakeFeasible,
127  Guarantee,
129  Strategy,
130  CloseHalf,
131  StandardPool,
132  Variable,
133  LpIf,
134  Lp,
135  Bstack,
136  LpStatus,
138  FixSet,
139  LpSub,
140  String,
141  Constraint,
142  Pool,
143  Global,
144  FsVarStat,
145  LpVarStat,
146  OsiIf,
148  Timer,
149  Array,
150  Csense,
151  BPrioQueue,
152  FixCand,
153  BHeap,
154  Poolslot,
155  SparVec,
156  Convar,
157  Ostream,
158  Hash,
159  Paramaster,
160  InfeasCon,
161 
162  STOP // INSERT NEW CODES BEFORE afcSTOP!
163 }; // enum AlgorithmFailureCode
164 
165 
166 
168 
173  Unknown,
174  Coin,
175  Abacus,
178  STOP // INSERT NEW CODES BEFORE nscSTOP!
179 }; // enum AlgorithmFailureCode
180 
181 
182 
184 
188 
189 private:
190 
191  const char *m_file;
192  int m_line;
193 
194 public:
196 
200  explicit Exception(const char *file = nullptr, int line = -1) :
201  m_file(file),
202  m_line(line)
203  { }
204 
206 
209  const char *file() const { return m_file; }
210 
212 
215  int line() const { return m_line; }
216 };
217 
218 
220 
224 
225 public:
227  explicit DynamicCastFailedException(const char *file = nullptr, int line = -1) : Exception(file, line) {}
228 };
229 
230 
232 
236 
237 public:
239  explicit InsufficientMemoryException(const char *file = nullptr, int line = -1) : Exception(file, line) {}
240 };
241 
242 
244 
253 
254 public:
256  explicit NoStdComparerException(const char *file = nullptr, int line = -1) : Exception(file, line) {}
257 };
258 
259 
261 
265 
266 public:
268  explicit TypeNotSupportedException(const char *file = nullptr, int line = -1) : Exception(file, line) {}
269 };
270 
271 
273 
277 {
278 public:
281  const char *file = nullptr,
282  int line = -1) :
283  Exception(file, line),
284  m_exceptionCode(code)
285  {}
286 
289  const char *file = nullptr,
290  int line = -1) :
291  Exception(file, line),
292  m_exceptionCode(PreconditionViolatedCode::Unknown)
293  {}
294 
296  PreconditionViolatedCode exceptionCode() const { return m_exceptionCode; }
297 
298 private:
300 }; // class PreconditionViolatedException
301 
302 
303 
305 
309 {
310 public:
311 
314  const char *file = nullptr,
315  int line = -1) :
316  Exception(file, line),
317  m_exceptionCode(code)
318  {}
319 
322  const char *file = nullptr,
323  int line = -1) :
324  Exception(file, line),
325  m_exceptionCode(AlgorithmFailureCode::Unknown)
326  {}
327 
329  AlgorithmFailureCode exceptionCode() const { return m_exceptionCode; }
330 
331 private:
333 }; // class AlgorithmFailureException
334 
335 
336 
338 
342  public:
345  const char *file = nullptr,
346  int line = -1) :
347  Exception(file, line),
348  m_exceptionCode(code)
349  {}
350 
353  const char *file = nullptr,
354  int line = -1) :
355  Exception(file, line),
356  m_exceptionCode(LibraryNotSupportedCode::Unknown)
357  {}
358 
360  LibraryNotSupportedCode exceptionCode() const { return m_exceptionCode; }
361 
362 private:
364 }; // class LibraryNotSupportedException
365 
366 } // end namespace ogdf
static const int line
Definition: GmlParser.h:86
Exception thrown when preconditions are violated.
Definition: exceptions.h:276
PreconditionViolatedCode
Error code for a violated precondition.
Definition: exceptions.h:77
PreconditionViolatedCode exceptionCode() const
Returns the error code of the exception.
Definition: exceptions.h:296
LibraryNotSupportedCode
Code for the library which was intended to get used, but its use is not supported.
Definition: exceptions.h:172
TypeNotSupportedException(const char *file=nullptr, int line=-1)
Constructs a type-not-supported exception.
Definition: exceptions.h:268
graph is not a copy of the corresponding graph
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
DynamicCastFailedException(const char *file=nullptr, int line=-1)
Constructs a dynamic cast failed exception.
Definition: exceptions.h:227
int m_line
Line number where exception occurred.
Definition: exceptions.h:192
LibraryNotSupportedCode exceptionCode() const
Returns the error code of the exception.
Definition: exceptions.h:360
AlgorithmFailureCode
Code for an internal failure condition.
Definition: exceptions.h:103
AlgorithmFailureCode exceptionCode() const
Returns the error code of the exception.
Definition: exceptions.h:329
graph contains a self-loop
LibraryNotSupportedException(LibraryNotSupportedCode code, const char *file=nullptr, int line=-1)
Constructs a library not supported exception.
Definition: exceptions.h:344
PreconditionViolatedCode m_exceptionCode
The error code specifying the exception.
Definition: exceptions.h:299
crossing forbidden but necessary
Exception thrown when result of cast is 0.
Definition: exceptions.h:223
const char * m_file
Source file where exception occurred.
Definition: exceptions.h:191
Base class of all ogdf exceptions.
Definition: exceptions.h:187
LibraryNotSupportedException(const char *file=nullptr, int line=-1)
Constructs a library not supported exception.
Definition: exceptions.h:352
LibraryNotSupportedCode m_exceptionCode
The error code specifying the exception.
Definition: exceptions.h:363
min-cost flow could not find a legal flow
AlgorithmFailureException(const char *file=nullptr, int line=-1)
Constructs an algorithm failure exception.
Definition: exceptions.h:321
datastructure is already full
AlgorithmFailureCode m_exceptionCode
The error code specifying the exception.
Definition: exceptions.h:332
NoStdComparerException(const char *file=nullptr, int line=-1)
Constructs a no standard comparer available exception.
Definition: exceptions.h:256
Exception thrown when a data type is not supported by a generic function.
Definition: exceptions.h:264
Contains logging functionality.
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing...
Definition: exceptions.h:308
PreconditionViolatedException(PreconditionViolatedCode code, const char *file=nullptr, int line=-1)
Constructs a precondition violated exception.
Definition: exceptions.h:280
Exception thrown when an external library shall be used which is not supported.
Definition: exceptions.h:341
Exception thrown when not enough memory is available to execute an algorithm.
Definition: exceptions.h:235
PreconditionViolatedException(const char *file=nullptr, int line=-1)
Constructs a precondition violated exception.
Definition: exceptions.h:288
AlgorithmFailureException(AlgorithmFailureCode code, const char *file=nullptr, int line=-1)
Constructs an algorithm failure exception.
Definition: exceptions.h:313
couldn&#39;t solve the problem
const char * file() const
Returns the name of the source file where exception was thrown.
Definition: exceptions.h:209
Basic declarations, included by all source files.
int line() const
Returns the line number where the exception was thrown.
Definition: exceptions.h:215
Exception(const char *file=nullptr, int line=-1)
Constructs an exception.
Definition: exceptions.h:200
Exception thrown when a required standard comparer has not been specialized.
Definition: exceptions.h:252
graph is not a rooted forest
function parameter is illegal
The namespace for all OGDF objects.
the used library doesn&#39;t support that function
InsufficientMemoryException(const char *file=nullptr, int line=-1)
Constructs an insufficient memory exception.
Definition: exceptions.h:239
graph has not a single source
graph is not a rooted tree