Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Exception.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2013.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Stephan Aiche$
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_CONCEPT_EXCEPTION_H
36 #define OPENMS_CONCEPT_EXCEPTION_H
37 
38 #include <OpenMS/config.h>
39 #include <OpenMS/CONCEPT/Types.h>
40 
41 #include <new>
42 #include <string>
43 #include <sstream>
44 
45 namespace OpenMS
46 {
47 
62  namespace Exception
63  {
64 
90  class OPENMS_DLLAPI BaseException :
91  public std::exception
92  {
93 public:
94 
98 
100  BaseException() throw();
101 
103  BaseException(const char * file, int line, const char * function) throw();
104 
106  BaseException(const char * file, int line, const char * function, const std::string & name, const std::string & message) throw();
107 
109  BaseException(const BaseException & exception) throw();
110 
112  virtual ~BaseException() throw();
114 
118 
120  const char * getName() const throw();
121 
123  virtual const char * what() const throw();
124 
126  int getLine() const throw();
127 
129  const char * getFile() const throw();
130 
132  const char * getFunction() const throw();
133 
135  const char * getMessage() const throw();
136 
138  void setMessage(const std::string & message) throw();
139 
141 
142 protected:
143 
145  const char * file_;
146 
148  int line_;
149 
151  const char * function_;
152 
154  std::string name_;
155 
157  std::string what_;
158  };
159 
167  class OPENMS_DLLAPI Precondition :
168  public BaseException
169  {
170 public:
171  Precondition(const char * file, int line, const char * function, const std::string & condition) throw();
172  };
173 
181  class OPENMS_DLLAPI Postcondition :
182  public BaseException
183  {
184 public:
185  Postcondition(const char * file, int line, const char * function, const std::string & condition) throw();
186  };
187 
196  class OPENMS_DLLAPI MissingInformation :
197  public BaseException
198  {
199 public:
200  MissingInformation(const char * file, int line, const char * function, const std::string & error_message) throw();
201  };
202 
203 
217  class OPENMS_DLLAPI IndexUnderflow :
218  public BaseException
219  {
220 public:
221  IndexUnderflow(const char * file, int line, const char * function, SignedSize index = 0, Size size = 0) throw();
222  };
223 
236  class OPENMS_DLLAPI SizeUnderflow :
237  public BaseException
238  {
239 public:
240  SizeUnderflow(const char * file, int line, const char * function, Size size = 0) throw();
241  };
242 
255  class OPENMS_DLLAPI IndexOverflow :
256  public BaseException
257  {
258 public:
259  IndexOverflow(const char * file, int line, const char * function, SignedSize index = 0, Size size = 0) throw();
260  };
261 
272  class OPENMS_DLLAPI FailedAPICall :
273  public BaseException
274  {
275 public:
276  FailedAPICall(const char * file, int line, const char * function, const std::string & message) throw();
277  };
278 
286  class OPENMS_DLLAPI InvalidRange :
287  public BaseException
288  {
289 public:
290  InvalidRange(const char * file, int line, const char * function) throw();
291  };
292 
293 
304  class OPENMS_DLLAPI InvalidSize :
305  public BaseException
306  {
307 public:
308  InvalidSize(const char * file, int line, const char * function, Size size = 0) throw();
309  };
310 
311 
320  class OPENMS_DLLAPI OutOfRange :
321  public BaseException
322  {
323 public:
324  OutOfRange(const char * file, int line, const char * function) throw();
325  };
326 
336  class OPENMS_DLLAPI InvalidValue :
337  public BaseException
338  {
339 public:
340  InvalidValue(const char * file, int line, const char * function, const std::string & message, const std::string & value) throw();
341  };
342 
348  class OPENMS_DLLAPI InvalidParameter :
349  public BaseException
350  {
351 public:
352  InvalidParameter(const char * file, int line, const char * function, const std::string & message) throw();
353  };
354 
363  class OPENMS_DLLAPI ConversionError :
364  public BaseException
365  {
366 public:
367  ConversionError(const char * file, int line, const char * function, const std::string & error) throw();
368  };
369 
379  class OPENMS_DLLAPI IllegalSelfOperation :
380  public BaseException
381  {
382 public:
383  IllegalSelfOperation(const char * file, int line, const char * function) throw();
384  };
385 
394  class OPENMS_DLLAPI NullPointer :
395  public BaseException
396  {
397 public:
398  NullPointer(const char * file, int line, const char * function) throw();
399  };
400 
408  class OPENMS_DLLAPI InvalidIterator :
409  public BaseException
410  {
411 public:
412  InvalidIterator(const char * file, int line, const char * function) throw();
413  };
414 
423  class OPENMS_DLLAPI IncompatibleIterators :
424  public BaseException
425  {
426 public:
427  IncompatibleIterators(const char * file, int line, const char * function) throw();
428  };
429 
437  class OPENMS_DLLAPI NotImplemented :
438  public BaseException
439  {
440 public:
441  NotImplemented(const char * file, int line, const char * function) throw();
442  };
443 
451  class OPENMS_DLLAPI IllegalTreeOperation :
452  public BaseException
453  {
454 public:
455  IllegalTreeOperation(const char * file, int line, const char * function) throw();
456  };
457 
468 #ifdef _MSC_VER // disable some seqan warnings that distract from ours
469 # pragma warning( push ) // save warning state
470 # pragma warning( disable : 4275 )
471 #endif
472  class OPENMS_DLLAPI OutOfMemory :
473  public BaseException, public std::bad_alloc
474  {
475 public:
476  OutOfMemory(const char * file, int line, const char * function, Size size = 0) throw();
477  };
478 #ifdef _MSC_VER
479 # pragma warning( pop ) // restore old warning state
480 #endif
481 
486  class OPENMS_DLLAPI BufferOverflow :
487  public BaseException
488  {
489 public:
490  BufferOverflow(const char * file, int line, const char * function) throw();
491  };
492 
498  class OPENMS_DLLAPI DivisionByZero :
499  public BaseException
500  {
501 public:
502  DivisionByZero(const char * file, int line, const char * function) throw();
503  };
504 
510  class OPENMS_DLLAPI OutOfGrid :
511  public BaseException
512  {
513 public:
514  OutOfGrid(const char * file, int line, const char * function) throw();
515  };
516 
524  class OPENMS_DLLAPI FileNotFound :
525  public BaseException
526  {
527 public:
528  FileNotFound(const char * file, int line, const char * function, const std::string & filename) throw();
529  };
530 
538  class OPENMS_DLLAPI FileNotReadable :
539  public BaseException
540  {
541 public:
542  FileNotReadable(const char * file, int line, const char * function, const std::string & filename) throw();
543  };
544 
552  class OPENMS_DLLAPI FileNotWritable :
553  public BaseException
554  {
555 public:
556  FileNotWritable(const char * file, int line, const char * function, const std::string & filename) throw();
557  };
558 
566  class OPENMS_DLLAPI IOException :
567  public BaseException
568  {
569 public:
570  IOException(const char * file, int line, const char * function, const std::string & filename) throw();
571  };
572 
580  class OPENMS_DLLAPI FileEmpty :
581  public BaseException
582  {
583 public:
584  FileEmpty(const char * file, int line, const char * function, const std::string & filename) throw();
585  };
586 
594  class OPENMS_DLLAPI IllegalPosition :
595  public BaseException
596  {
597 public:
598  IllegalPosition(const char * file, int line, const char * function, float x, float y, float z) throw();
599  };
600 
608  class OPENMS_DLLAPI ParseError :
609  public BaseException
610  {
611 public:
612  ParseError(const char * file, int line, const char * function, const std::string & expression, const std::string & message) throw();
613  };
614 
622  class OPENMS_DLLAPI UnableToCreateFile :
623  public BaseException
624  {
625 public:
626  UnableToCreateFile(const char * file, int line, const char * function, const std::string & filename) throw();
627  };
628 
634  class OPENMS_DLLAPI IllegalArgument :
635  public BaseException
636  {
637 public:
638  IllegalArgument(const char * file, int line, const char * function, const std::string & error_message) throw();
639  };
640 
648  class OPENMS_DLLAPI ElementNotFound :
649  public BaseException
650  {
651 public:
652  ElementNotFound(const char * file, int line, const char * function, const std::string & element) throw();
653  };
654 
662  class OPENMS_DLLAPI UnableToFit :
663  public BaseException
664  {
665 public:
666  UnableToFit(const char * file, int line, const char * function, const std::string & name, const std::string & message) throw();
667  };
668 
677  class OPENMS_DLLAPI UnableToCalibrate :
678  public BaseException
679  {
680 public:
681  UnableToCalibrate(const char * file, int line, const char * function, const std::string & name, const std::string & message) throw();
682  };
683 
691  class OPENMS_DLLAPI DepletedIDPool :
692  public BaseException
693  {
694 public:
695  DepletedIDPool(const char * file, int line, const char * function, const std::string & name, const std::string & message) throw();
696  };
697 
698  } // namespace Exception
699 
721  OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const Exception::BaseException & e);
722 
723 } // namespace OPENMS
724 
725 #endif // OPENMS_CONCEPT_EXCEPTION_H
const char * file_
The source file the exception was thrown in.
Definition: Exception.h:145
Int underflow exception.
Definition: Exception.h:217
File not writable exception.
Definition: Exception.h:552
Incompatible iterator exception.
Definition: Exception.h:423
Element could not be found exception.
Definition: Exception.h:648
Out of range exception.
Definition: Exception.h:320
Int overflow exception.
Definition: Exception.h:255
A call to an external library (other than OpenMS) went wrong.
Definition: Exception.h:272
std::ostream & operator<<(std::ostream &os, const ItraqQuantifier::ItraqQuantifierStats &stats)
Invalid 3-dimensional position exception.
Definition: Exception.h:594
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:151
File not found exception.
Definition: Exception.h:524
const char * function_
The source file the exception was thrown in.
Definition: Exception.h:151
Precondition failed exception.
Definition: Exception.h:167
int line_
The line number the exception was thrown in.
Definition: Exception.h:148
Exception used if an error occurred while calibrating a dataset.
Definition: Exception.h:677
File is empty.
Definition: Exception.h:580
File not readable exception.
Definition: Exception.h:538
A method or algorithm argument contains illegal values.
Definition: Exception.h:634
Null pointer argument is invalid exception.
Definition: Exception.h:394
int exception
(Used by various macros. Indicates a rough category of the exception being caught.)
Invalid iterator exception.
Definition: Exception.h:408
Exception indicating that an invalid parameter was handed over to an algorithm.
Definition: Exception.h:348
Exception base class.
Definition: Exception.h:90
Invalid conversion exception.
Definition: Exception.h:363
Division by zero error exception.
Definition: Exception.h:498
Invalid UInt exception.
Definition: Exception.h:304
Out of memory exception.
Definition: Exception.h:472
Invalid value exception.
Definition: Exception.h:336
General IOException.
Definition: Exception.h:566
Illegal self operation exception.
Definition: Exception.h:379
Exception used if no more unique document ID&#39;s can be drawn from ID pool.
Definition: Exception.h:691
Invalid range exception.
Definition: Exception.h:286
Exception used if an error occurred while fitting a model to a given dataset.
Definition: Exception.h:662
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
UInt underflow exception.
Definition: Exception.h:236
Unable to create file exception.
Definition: Exception.h:622
Postcondition failed exception.
Definition: Exception.h:181
Out of grid exception.
Definition: Exception.h:510
std::string name_
The name of the exception.
Definition: Exception.h:154
Buffer overflow exception.
Definition: Exception.h:486
Not implemented exception.
Definition: Exception.h:437
std::string what_
A more detailed description of the exception&#39;s cause.
Definition: Exception.h:157
Not all required information provided.
Definition: Exception.h:196
Illegal tree operation exception.
Definition: Exception.h:451
Parse Error exception.
Definition: Exception.h:608

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:13 using doxygen 1.8.5