GammaLib  2.0.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAException.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCTAException.hpp - CTA 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 GCTAException.hpp
23  * @brief CTA exception handler interface definition.
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCTAEXCEPTION_HPP
28 #define GCTAEXCEPTION_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string> // string
32 #include <sstream> // ostringstream
33 #include <stdexcept> // exception
34 
35 
36 /***********************************************************************//**
37  * @class GCTAExceptionHandler
38  *
39  * @brief Interface for CTA exception handler.
40  ***************************************************************************/
41 class GCTAExceptionHandler : public std::exception {
42 public:
44  virtual ~GCTAExceptionHandler(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 GCTAException
54  *
55  * @brief Interface for CTA exceptions.
56  *
57  * This is the object that it thrown in case of a CTA exception.
58  ***************************************************************************/
60 public:
61  // General exceptions
62  class file_open_error : public GCTAExceptionHandler {
63  public:
64  file_open_error(std::string origin, std::string filename,
65  std::string message = "");
66  };
67 
68  // Event bin exceptions
69  class no_member : public GCTAExceptionHandler {
70  public:
71  no_member(const std::string& origin, const std::string& message);
72  };
73 
74  // Observation exceptions
75  class no_response : public GCTAExceptionHandler {
76  public:
77  no_response(std::string origin, std::string message = "");
78  };
79  class no_pointing : public GCTAExceptionHandler {
80  public:
81  no_pointing(std::string origin, std::string message = "");
82  };
83  class no_sky : public GCTAExceptionHandler {
84  public:
85  no_sky(std::string origin, std::string message = "");
86  };
87  class no_ebds : public GCTAExceptionHandler {
88  public:
89  no_ebds(std::string origin, std::string message = "");
90  };
91  class no_gti : public GCTAExceptionHandler {
92  public:
93  no_gti(std::string origin, std::string message = "");
94  };
95  class no_energies : public GCTAExceptionHandler {
96  public:
97  no_energies(std::string origin, std::string message = "");
98  };
99  class no_dirs : public GCTAExceptionHandler {
100  public:
101  no_dirs(std::string origin, std::string message = "");
102  };
103  class bad_observation_type : public GCTAExceptionHandler {
104  public:
105  bad_observation_type(std::string origin, std::string message = "");
106  };
107  class bad_event_type : public GCTAExceptionHandler {
108  public:
109  bad_event_type(std::string origin, std::string message = "");
110  };
111  class bad_roi_type : public GCTAExceptionHandler {
112  public:
113  bad_roi_type(std::string origin, std::string message = "");
114  };
115  class bad_instdir_type : public GCTAExceptionHandler {
116  public:
117  bad_instdir_type(std::string origin, std::string message = "");
118  };
119  class bad_pointing_type : public GCTAExceptionHandler {
120  public:
121  bad_pointing_type(std::string origin, std::string message = "");
122  };
123  class bad_response_type : public GCTAExceptionHandler {
124  public:
125  bad_response_type(std::string origin, std::string message = "");
126  };
127 
128  // Model exceptions
129  class model_invalid_radial : public GCTAExceptionHandler {
130  public:
131  model_invalid_radial(std::string origin, std::string type,
132  std::string message = "");
133  };
134  class bad_model_type : public GCTAExceptionHandler {
135  public:
136  bad_model_type(const std::string& origin,
137  const std::string& message = "");
138  };
139 
140  // Response table exceptions
141  class bad_rsp_table_dim : public GCTAExceptionHandler {
142  public:
143  bad_rsp_table_dim(std::string origin,
144  int table_dim,
145  int expected_dim,
146  std::string message = "");
147  };
148  class bad_rsp_table_format : public GCTAExceptionHandler {
149  public:
150  bad_rsp_table_format(std::string origin,
151  std::string message = "");
152  };
153 };
154 
155 #endif /* GCTAEXCEPTION_HPP */
virtual const char * what() const
Exception message.
Interface for CTA exceptions.
Interface for CTA exception handler.
virtual ~GCTAExceptionHandler(void)