Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
exceptions.h
Go to the documentation of this file.
1
32#pragma once
33
34#include <ogdf/basic/Logger.h>
35#include <ogdf/basic/basic.h>
36
37namespace ogdf {
38
41
43#define OGDF_FLUSH_OUTPUTS std::cout << std::flush, ::ogdf::Logger::sfout() << std::flush
44
54#define OGDF_THROW_PARAM(CLASS, PARAM) OGDF_FLUSH_OUTPUTS, throw CLASS(PARAM)
55
63#define OGDF_THROW(CLASS) OGDF_FLUSH_OUTPUTS, throw CLASS()
64
65#ifdef OGDF_DEBUG
66# undef OGDF_THROW_PARAM
67# define OGDF_THROW_PARAM(CLASS, PARAM) \
68 OGDF_FLUSH_OUTPUTS, throw CLASS(PARAM, __FILE__, __LINE__)
69# undef OGDF_THROW
70# define OGDF_THROW(CLASS) OGDF_FLUSH_OUTPUTS, throw CLASS(__FILE__, __LINE__)
71#endif
72
74
76
82 Unknown,
84 NoFlow,
85 Sort,
86 Label,
92
93 // The following codes are used by Abacus (think about changing them to
94 // more error describing codes)
98 Buffer,
99 AddVar,
100 Sorter,
101 Phase,
102 Active,
105 Guarantee,
107 Strategy,
108 CloseHalf,
110 Variable,
111 LpIf,
112 Lp,
113 Bstack,
114 LpStatus,
116 FixSet,
117 LpSub,
118 String,
120 Pool,
121 Global,
122 FsVarStat,
123 LpVarStat,
124 OsiIf,
126 Timer,
127 Array,
128 Csense,
130 FixCand,
131 BHeap,
132 Poolslot,
133 SparVec,
134 Convar,
135 Ostream,
136 Hash,
138 InfeasCon,
139
140 STOP // INSERT NEW CODES BEFORE afcSTOP!
141};
142
144
149 Unknown,
150 Coin,
151 Abacus,
152 Cgal,
155 STOP // INSERT NEW CODES BEFORE nscSTOP!
156};
157
159
163private:
164 const char* m_file;
165 int m_line;
166
167public:
169
173 explicit Exception(const char* file = nullptr, int line = -1) : m_file(file), m_line(line) { }
174
176
179 const char* file() const { return m_file; }
180
182
185 int line() const { return m_line; }
186};
187
189
193public:
195 explicit DynamicCastFailedException(const char* file = nullptr, int line = -1)
196 : Exception(file, line) { }
197};
198
200
204public:
206 explicit InsufficientMemoryException(const char* file = nullptr, int line = -1)
207 : Exception(file, line) { }
208};
209
211
220public:
222 explicit NoStdComparerException(const char* file = nullptr, int line = -1)
223 : Exception(file, line) { }
224};
225
227
231public:
233 explicit TypeNotSupportedException(const char* file = nullptr, int line = -1)
234 : Exception(file, line) { }
235};
236
238
242public:
244 explicit AlgorithmFailureException(AlgorithmFailureCode code, const char* file = nullptr,
245 int line = -1)
246 : Exception(file, line), m_exceptionCode(code) { }
247
249 explicit AlgorithmFailureException(const char* file = nullptr, int line = -1)
250 : Exception(file, line), m_exceptionCode(AlgorithmFailureCode::Unknown) { }
251
253 AlgorithmFailureCode exceptionCode() const { return m_exceptionCode; }
254
255private:
257};
258
260
264public:
266 explicit LibraryNotSupportedException(LibraryNotSupportedCode code, const char* file = nullptr,
267 int line = -1)
268 : Exception(file, line), m_exceptionCode(code) { }
269
271 explicit LibraryNotSupportedException(const char* file = nullptr, int line = -1)
272 : Exception(file, line), m_exceptionCode(LibraryNotSupportedCode::Unknown) { }
273
275 LibraryNotSupportedCode exceptionCode() const { return m_exceptionCode; }
276
277private:
279};
280
281}
Contains logging functionality.
Basic declarations, included by all source files.
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition exceptions.h:241
AlgorithmFailureCode m_exceptionCode
The error code specifying the exception.
Definition exceptions.h:256
AlgorithmFailureCode exceptionCode() const
Returns the error code of the exception.
Definition exceptions.h:253
AlgorithmFailureException(const char *file=nullptr, int line=-1)
Constructs an algorithm failure exception.
Definition exceptions.h:249
AlgorithmFailureException(AlgorithmFailureCode code, const char *file=nullptr, int line=-1)
Constructs an algorithm failure exception.
Definition exceptions.h:244
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
Exception thrown when result of cast is 0.
Definition exceptions.h:192
DynamicCastFailedException(const char *file=nullptr, int line=-1)
Constructs a dynamic cast failed exception.
Definition exceptions.h:195
Base class of all ogdf exceptions.
Definition exceptions.h:162
const char * m_file
Source file where exception occurred.
Definition exceptions.h:164
int m_line
Line number where exception occurred.
Definition exceptions.h:165
Exception(const char *file=nullptr, int line=-1)
Constructs an exception.
Definition exceptions.h:173
int line() const
Returns the line number where the exception was thrown.
Definition exceptions.h:185
const char * file() const
Returns the name of the source file where exception was thrown.
Definition exceptions.h:179
Exception thrown when not enough memory is available to execute an algorithm.
Definition exceptions.h:203
InsufficientMemoryException(const char *file=nullptr, int line=-1)
Constructs an insufficient memory exception.
Definition exceptions.h:206
Exception thrown when an external library shall be used which is not supported.
Definition exceptions.h:263
LibraryNotSupportedCode exceptionCode() const
Returns the error code of the exception.
Definition exceptions.h:275
LibraryNotSupportedCode m_exceptionCode
The error code specifying the exception.
Definition exceptions.h:278
LibraryNotSupportedException(const char *file=nullptr, int line=-1)
Constructs a library not supported exception.
Definition exceptions.h:271
LibraryNotSupportedException(LibraryNotSupportedCode code, const char *file=nullptr, int line=-1)
Constructs a library not supported exception.
Definition exceptions.h:266
Exception thrown when a required standard comparer has not been specialized.
Definition exceptions.h:219
NoStdComparerException(const char *file=nullptr, int line=-1)
Constructs a no standard comparer available exception.
Definition exceptions.h:222
Exception thrown when a data type is not supported by a generic function.
Definition exceptions.h:230
TypeNotSupportedException(const char *file=nullptr, int line=-1)
Constructs a type-not-supported exception.
Definition exceptions.h:233
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
AlgorithmFailureCode
Code for an internal failure condition.
Definition exceptions.h:81
LibraryNotSupportedCode
Code for the library which was intended to get used, but its use is not supported.
Definition exceptions.h:148
@ IndexOutOfBounds
index out of bounds
@ ExternalFace
external face not correct
@ ForbiddenCrossing
crossing forbidden but necessary
@ NoFlow
min-cost flow could not find a legal flow
@ Sort
sequence not sorted
@ NoSolutionFound
couldn't solve the problem
@ Label
labelling failed
@ IllegalParameter
function parameter is illegal
@ TimelimitExceeded
it took too long
@ FunctionNotImplemented
the used library doesn't support that function
@ Abacus
ABACUS not supported.
@ Cgal
CGAL not supported.
@ Coin
COIN not supported.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.