radarlib  1.4.6
odimh5v20_exceptions.hpp
Go to the documentation of this file.
1 /*
2  * Radar Library
3  *
4  * Copyright (C) 2009-2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  * Author: Guido Billi <guidobilli@gmail.com>
21  */
22 
27 #ifndef __RADAR_ODIMH5V20_EXCEPTIONS_HPP__
28 #define __RADAR_ODIMH5V20_EXCEPTIONS_HPP__
29 
30 #include <stdexcept>
31 #include <radarlib/defs.h>
32 
33 /* sotto windows bisogna utilizzare queste macro per poter usare la DLL */
34 #ifndef _HDF5USEDLL_
35 #define _HDF5USEDLL_
36 #endif
37 #ifndef HDF5CPP_USEDLL
38 #define HDF5CPP_USEDLL
39 #endif
40 #include "H5Cpp.h"
41 
42 namespace OdimH5v20 {
43 
44 /*===========================================================================*/
45 
52 class OdimH5Exception : public std::logic_error
53 {
54 public:
60  OdimH5Exception(const std::string& msg)
61  :std::logic_error(msg)
62  {
63  }
64  virtual ~OdimH5Exception() throw()
65  {
66  }
67 };
68 
69 /*===========================================================================*/
70 
79 {
80 public:
86  OdimH5UnsupportedException(const std::string& msg)
87  :OdimH5Exception("Unsupported operation error: " + msg)
88  {
89  }
90  virtual ~OdimH5UnsupportedException() throw()
91  {
92  }
93 };
94 
95 /*===========================================================================*/
96 
104 {
105 public:
111  OdimH5FormatException(const std::string& msg)
112  :OdimH5Exception(msg)
113  {
114  }
115  virtual ~OdimH5FormatException() throw()
116  {
117  }
118 };
119 
120 /*===========================================================================*/
121 
130 {
131 public:
137  OdimH5UnknownFormatException(const std::string& msg)
139  {
140  }
141  virtual ~OdimH5UnknownFormatException() throw()
142  {
143  }
144 };
145 
146 /*===========================================================================*/
147 
155 {
156 public:
162  OdimH5MissingAttributeException(const std::string& name)
163  :OdimH5FormatException("Attribute " + name + " not found")
164  {
165  }
166  virtual ~OdimH5MissingAttributeException() throw()
167  {
168  }
169 };
170 
171 /*===========================================================================*/
172 
180 {
181 public:
187  OdimH5InvalidAttributeValueException(const std::string& name)
188  :OdimH5FormatException("Attribute " + name + " has a invalid value")
189  {
190  }
191  virtual ~OdimH5InvalidAttributeValueException() throw()
192  {
193  }
194 };
195 
196 /*===========================================================================*/
197 
205 {
206 public:
212  OdimH5MissingGroupException(const std::string& name)
213  :OdimH5FormatException("HDF5 Group " + name + " not found")
214  {
215  }
216  virtual ~OdimH5MissingGroupException() throw()
217  {
218  }
219 };
220 
221 /*===========================================================================*/
222 
230 {
231 public:
237  OdimH5MissingDatasetException(const std::string& name)
238  :OdimH5FormatException("HDF5 dataset " + name + " not found")
239  {
240  }
241  virtual ~OdimH5MissingDatasetException() throw()
242  {
243  }
244 };
245 
246 /*===========================================================================*/
247 
262 {
263 public:
270  OdimH5HDF5LibException(const std::string& msg)
271  :OdimH5Exception(msg)
272  {
273  }
280  OdimH5HDF5LibException(H5::Exception& h5e)
281  :OdimH5Exception((h5e.getCDetailMsg() ? std::string(h5e.getCDetailMsg()) : "HDF5 internal error"))
282  {
283  }
291  OdimH5HDF5LibException(const std::string& msg, H5::Exception& h5e)
292  :OdimH5Exception(msg + ": " + (h5e.getCDetailMsg() ? std::string(h5e.getCDetailMsg()) : "HDF5 internal error"))
293  {
294  }
295  virtual ~OdimH5HDF5LibException() throw()
296  {
297  }
298 };
299 
300 /*===========================================================================*/
301 
302 }
303 
304 #endif
305 
306 
307 
308 
309 
310 
311 
312 
313 
314 
315 
316 
317 
318 
319 
320 
321 
322 
323 
324 
325 
326 
327 
328 
OdimH5HDF5LibException(const std::string &msg, H5::Exception &h5e)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:291
OdimH5HDF5LibException(const std::string &msg)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:270
OdimH5 missing group error.
Definition: odimh5v20_exceptions.hpp:229
OdimH5 missing attribute error.
Definition: odimh5v20_exceptions.hpp:154
OdimH5 missing group error.
Definition: odimh5v20_exceptions.hpp:204
OdimH5FormatException(const std::string &msg)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:111
Internal library macros.
OdimH5Exception(const std::string &msg)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:60
OdimH5 invalid attribute value error.
Definition: odimh5v20_exceptions.hpp:179
OdimH5InvalidAttributeValueException(const std::string &name)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:187
OdimH5UnsupportedException(const std::string &msg)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:86
OdimH5 unknown format error.
Definition: odimh5v20_exceptions.hpp:129
OdimH5 unsupported feature error.
Definition: odimh5v20_exceptions.hpp:78
HDF5 exception inside Odim Classes.
Definition: odimh5v20_exceptions.hpp:261
OdimH5HDF5LibException(H5::Exception &h5e)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:280
OdimH5MissingDatasetException(const std::string &name)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:237
OdimH5UnknownFormatException(const std::string &msg)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:137
OdimH5MissingGroupException(const std::string &name)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:212
OdimH5MissingAttributeException(const std::string &name)
Initialize the exception.
Definition: odimh5v20_exceptions.hpp:162
OdimH5 generic error.
Definition: odimh5v20_exceptions.hpp:52
OdimH5 format error.
Definition: odimh5v20_exceptions.hpp:103