OpenMS
GlobalExceptionHandler.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg$
6 // $Authors: Stephan Aiche, Marc Sturm $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/CONCEPT/Types.h>
13 
14 #include <string>
15 
16 namespace OpenMS
17 {
18 
19  namespace Exception
20  {
21 
27  class OPENMS_DLLAPI GlobalExceptionHandler
28  {
29 private:
33 
51  throw();
52 
54 
57 
59 public:
60 
63 
67 
70  static void setName(const std::string & name)
71  throw();
72 
75  static void setMessage(const std::string & message)
76  throw();
77 
80  static void setLine(int line)
81  throw();
82 
85  static void setFile(const std::string & file)
86  throw();
87 
90  static void setFunction(const std::string & function)
91  throw();
92 
95  static void set(const std::string & file, int line, const std::string & function,
96  const std::string & name, const std::string & message)
97  throw();
99 protected:
100 
102  static void terminate()
103  throw();
104 
106  static void newHandler();
107 
116 
118  static std::string & file_();
119 
121  static int & line_();
122 
124  static std::string & function_();
125 
127  static std::string & name_();
128 
130  static std::string & what_();
131 
133  };
134 
135  } // namespace Exception
136 
137 } // namespace OpenMS
138 
subpage TOPP_TargetedFileConverter Converts targeted feature or consensus feature files subpage TOPP_FileInfo Shows basic information about the file
Definition: TOPP.doxygen:44
OpenMS global exception handler.
Definition: GlobalExceptionHandler.h:28
static GlobalExceptionHandler & getInstance()
The accessor for the singleton. It also serves as a replacement for the constructor.
static void setFunction(const std::string &function)
static void setName(const std::string &name)
static void terminate()
The OPENMS replacement for terminate.
GlobalExceptionHandler()
Default constructor.
static void setFile(const std::string &file)
~GlobalExceptionHandler()
Definition: GlobalExceptionHandler.h:58
static void set(const std::string &file, int line, const std::string &function, const std::string &name, const std::string &message)
static void setMessage(const std::string &message)
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19