Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

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 
43 #define OGDF_FLUSH_OUTPUTS \
44  std::cout << std::flush, ::ogdf::Logger::sfout() << std::flush
45 
55 #define OGDF_THROW_PARAM(CLASS, PARAM) \
56  OGDF_FLUSH_OUTPUTS, throw CLASS(PARAM)
57 
65 #define OGDF_THROW(CLASS) \
66  OGDF_FLUSH_OUTPUTS, throw CLASS()
67 
68 #ifdef OGDF_DEBUG
69 # undef OGDF_THROW_PARAM
70 # define OGDF_THROW_PARAM(CLASS, PARAM) \
71  OGDF_FLUSH_OUTPUTS, throw CLASS(PARAM, __FILE__, __LINE__)
72 # undef OGDF_THROW
73 # define OGDF_THROW(CLASS) \
74  OGDF_FLUSH_OUTPUTS, throw CLASS(__FILE__, __LINE__)
75 #endif
76 
78 
80 
86  Unknown,
88  NoFlow,
89  Sort,
90  Label,
91  ExternalFace,
96 
97  // The following codes are used by Abacus (think about changing them to
98  // more error describing codes)
100  DualBound,
101  NotInteger,
102  Buffer,
103  AddVar,
104  Sorter,
105  Phase,
106  Active,
107  NoSolution,
108  MakeFeasible,
109  Guarantee,
111  Strategy,
112  CloseHalf,
113  StandardPool,
114  Variable,
115  LpIf,
116  Lp,
117  Bstack,
118  LpStatus,
120  FixSet,
121  LpSub,
122  String,
123  Constraint,
124  Pool,
125  Global,
126  FsVarStat,
127  LpVarStat,
128  OsiIf,
130  Timer,
131  Array,
132  Csense,
133  BPrioQueue,
134  FixCand,
135  BHeap,
136  Poolslot,
137  SparVec,
138  Convar,
139  Ostream,
140  Hash,
141  Paramaster,
142  InfeasCon,
143 
144  STOP // INSERT NEW CODES BEFORE afcSTOP!
145 };
146 
148 
153  Unknown,
154  Coin,
155  Abacus,
158  STOP // INSERT NEW CODES BEFORE nscSTOP!
159 };
160 
162 
166 
167 private:
168 
169  const char *m_file;
170  int m_line;
171 
172 public:
174 
178  explicit Exception(const char *file = nullptr, int line = -1) :
179  m_file(file),
180  m_line(line)
181  { }
182 
184 
187  const char *file() const { return m_file; }
188 
190 
193  int line() const { return m_line; }
194 };
195 
196 
198 
202 
203 public:
205  explicit DynamicCastFailedException(const char *file = nullptr, int line = -1) : Exception(file, line) {}
206 };
207 
208 
210 
214 
215 public:
217  explicit InsufficientMemoryException(const char *file = nullptr, int line = -1) : Exception(file, line) {}
218 };
219 
220 
222 
231 
232 public:
234  explicit NoStdComparerException(const char *file = nullptr, int line = -1) : Exception(file, line) {}
235 };
236 
237 
239 
243 
244 public:
246  explicit TypeNotSupportedException(const char *file = nullptr, int line = -1) : Exception(file, line) {}
247 };
248 
250 
254 {
255 public:
256 
259  const char *file = nullptr,
260  int line = -1) :
261  Exception(file, line),
262  m_exceptionCode(code)
263  {}
264 
267  const char *file = nullptr,
268  int line = -1) :
269  Exception(file, line),
270  m_exceptionCode(AlgorithmFailureCode::Unknown)
271  {}
272 
274  AlgorithmFailureCode exceptionCode() const { return m_exceptionCode; }
275 
276 private:
278 };
279 
281 
285  public:
288  const char *file = nullptr,
289  int line = -1) :
290  Exception(file, line),
291  m_exceptionCode(code)
292  {}
293 
296  const char *file = nullptr,
297  int line = -1) :
298  Exception(file, line),
299  m_exceptionCode(LibraryNotSupportedCode::Unknown)
300  {}
301 
303  LibraryNotSupportedCode exceptionCode() const { return m_exceptionCode; }
304 
305 private:
307 };
308 
309 }
LibraryNotSupportedCode
Code for the library which was intended to get used, but its use is not supported.
Definition: exceptions.h:152
TypeNotSupportedException(const char *file=nullptr, int line=-1)
Constructs a type-not-supported exception.
Definition: exceptions.h:246
#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:205
int m_line
Line number where exception occurred.
Definition: exceptions.h:170
LibraryNotSupportedCode exceptionCode() const
Returns the error code of the exception.
Definition: exceptions.h:303
AlgorithmFailureCode
Code for an internal failure condition.
Definition: exceptions.h:85
AlgorithmFailureCode exceptionCode() const
Returns the error code of the exception.
Definition: exceptions.h:274
LibraryNotSupportedException(LibraryNotSupportedCode code, const char *file=nullptr, int line=-1)
Constructs a library not supported exception.
Definition: exceptions.h:287
crossing forbidden but necessary
Exception thrown when result of cast is 0.
Definition: exceptions.h:201
const char * m_file
Source file where exception occurred.
Definition: exceptions.h:169
Base class of all ogdf exceptions.
Definition: exceptions.h:165
LibraryNotSupportedException(const char *file=nullptr, int line=-1)
Constructs a library not supported exception.
Definition: exceptions.h:295
LibraryNotSupportedCode m_exceptionCode
The error code specifying the exception.
Definition: exceptions.h:306
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:266
AlgorithmFailureCode m_exceptionCode
The error code specifying the exception.
Definition: exceptions.h:277
NoStdComparerException(const char *file=nullptr, int line=-1)
Constructs a no standard comparer available exception.
Definition: exceptions.h:234
Exception thrown when a data type is not supported by a generic function.
Definition: exceptions.h:242
Contains logging functionality.
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing...
Definition: exceptions.h:253
Exception thrown when an external library shall be used which is not supported.
Definition: exceptions.h:284
Exception thrown when not enough memory is available to execute an algorithm.
Definition: exceptions.h:213
AlgorithmFailureException(AlgorithmFailureCode code, const char *file=nullptr, int line=-1)
Constructs an algorithm failure exception.
Definition: exceptions.h:258
couldn&#39;t solve the problem
const char * file() const
Returns the name of the source file where exception was thrown.
Definition: exceptions.h:187
Basic declarations, included by all source files.
int line() const
Returns the line number where the exception was thrown.
Definition: exceptions.h:193
Exception(const char *file=nullptr, int line=-1)
Constructs an exception.
Definition: exceptions.h:178
Exception thrown when a required standard comparer has not been specialized.
Definition: exceptions.h:230
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:217