GammaLib  2.0.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLATException.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GLATException.hpp - LAT exception handler *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-2012 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GLATException.hpp
23  * @brief LAT exception handler interface definition.
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GLATEXCEPTION_HPP
28 #define GLATEXCEPTION_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string> // string
32 #include <sstream> // ostringstream
33 #include <stdexcept> // exception
34 
35 
36 /***********************************************************************//**
37  * @class GLATExceptionHandler
38  *
39  * @brief Interface for LAT exception handler.
40  ***************************************************************************/
41 class GLATExceptionHandler : public std::exception {
42 public:
44  virtual ~GLATExceptionHandler(void) throw() { }
45  virtual const char* what() const throw();
46 protected:
47  std::string m_origin;
48  std::string m_message;
49 };
50 
51 
52 /***********************************************************************//**
53  * @class GLATException
54  *
55  * @brief Interface for LAT exceptions.
56  *
57  * This is the object that is thrown in case of a LAT exception.
58  ***************************************************************************/
60 public:
61  // Exceptions
62  class file_open_error : public GLATExceptionHandler {
63  public:
64  file_open_error(std::string origin, std::string filename,
65  std::string message = "");
66  };
67  class no_member : public GLATExceptionHandler {
68  public:
69  no_member(const std::string& origin, const std::string& message);
70  };
71  class no_sky : public GLATExceptionHandler {
72  public:
73  no_sky(std::string origin, std::string message = "");
74  };
75  class no_ebds : public GLATExceptionHandler {
76  public:
77  no_ebds(std::string origin, std::string message = "");
78  };
79  class no_gti : public GLATExceptionHandler {
80  public:
81  no_gti(std::string origin, std::string message = "");
82  };
83  class no_ltcube : public GLATExceptionHandler {
84  public:
85  no_ltcube(std::string origin, std::string message = "");
86  };
87  class no_energies : public GLATExceptionHandler {
88  public:
89  no_energies(std::string origin, std::string message = "");
90  };
91  class no_dirs : public GLATExceptionHandler {
92  public:
93  no_dirs(std::string origin, std::string message = "");
94  };
95  class bad_roi_type : public GLATExceptionHandler {
96  public:
97  bad_roi_type(std::string origin, std::string message = "");
98  };
99  class bad_instdir_type : public GLATExceptionHandler {
100  public:
101  bad_instdir_type(std::string origin, std::string message = "");
102  };
103  class invalid_response : public GLATExceptionHandler {
104  public:
105  invalid_response(std::string origin, std::string message = "");
106  };
107  class wcs_incompatible : public GLATExceptionHandler {
108  public:
109  wcs_incompatible(std::string origin, std::string name,
110  std::string message = "");
111  };
112  class diffuse_not_found : public GLATExceptionHandler {
113  public:
114  diffuse_not_found(std::string origin, std::string name,
115  std::string message = "");
116  };
117  class inconsistent_response : public GLATExceptionHandler {
118  public:
119  inconsistent_response(std::string origin, int size, int expect,
120  std::string message = "");
121  };
122  class bad_response_type : public GLATExceptionHandler {
123  public:
124  bad_response_type(std::string origin, std::string message = "");
125  };
126 };
127 
128 #endif /* GLATEXCEPTION_HPP */
virtual ~GLATExceptionHandler(void)
Interface for LAT exception handler.
Interface for LAT exceptions.
virtual const char * what() const
Exception message.