MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IOExceptions.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3 /***********************************************************************************/
4 /* This file is part of MeteoIO.
5  MeteoIO is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  MeteoIO is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef IOEXCEPTIONS_H
19 #define IOEXCEPTIONS_H
20 
21 #include <exception>
22 #include <string>
23 #include <stdlib.h>
24 
25 #include <meteoio/exports.h>
26 
27 #define STRINGIFY(x) #x
28 #define TOSTRING(x) STRINGIFY(x)
29 #define AT __FILE__ ":" TOSTRING(__LINE__)
30 
31 namespace mio {
32 
41 class MIO_API IOException : public std::exception {
42  public:
43  IOException(const std::string& message="IOException occured", const std::string& position="");
44  ~IOException() throw() {}
45  virtual const char* what() const throw();
46 
47  protected:
48  #if defined(__linux) && !defined(ANDROID) && !defined(__CYGWIN__)
49  std::string resolveSymbols(char *symbols, const unsigned int& ii, bool& found_main) const;
50  #endif
51  std::string msg, full_output;
52 };
53 
61  public:
62  NotFoundException(const std::string& filename="",
63  const std::string& position="") : IOException("NotFound: " + filename, position){}
64 };
65 
73  public:
74  AccessException(const std::string& filename="",
75  const std::string& position="") : IOException("InvalidAccess: " + filename, position){}
76 };
77 
85  public:
86  InvalidNameException(const std::string& filename="",
87  const std::string& position="") : IOException("InvalidName: " + filename, position){}
88 };
89 
97  public:
98  InvalidFormatException(const std::string& message="",
99  const std::string& position="") : IOException("InvalidFormat: " + message, position){}
100 };
101 
109  public:
110  IndexOutOfBoundsException(const std::string& message="",
111  const std::string& position="") : IOException("IndexOutOfBounds: " + message, position){}
112 };
113 
121  public:
122  ConversionFailedException(const std::string& message="",
123  const std::string& position="") : IOException("ConversionFailed: " + message, position){}
124 };
125 
133  public:
134  InvalidArgumentException(const std::string& message="",
135  const std::string& position="") : IOException("InvalidArgument: " + message, position){}
136 };
137 
145  public:
146  UnknownValueException(const std::string& message="",
147  const std::string& position="") : IOException("UnknownValue: " + message, position){}
148 };
149 
157 {
158  public:
159  NoDataException(const std::string& message="",
160  const std::string& position="") : IOException("NoData: " + message, position){}
161 };
162 } //end namespace
163 
164 #endif
NotFoundException(const std::string &filename="", const std::string &position="")
Definition: IOExceptions.h:62
thrown when encountered an unexpected value (e.g. unknown name or key)
Definition: IOExceptions.h:144
AccessException(const std::string &filename="", const std::string &position="")
Definition: IOExceptions.h:74
InvalidArgumentException(const std::string &message="", const std::string &position="")
Definition: IOExceptions.h:134
#define MIO_API
Definition: exports.h:49
thrown when a given filename/servername/... is not valid (e.g. "..", "." or empty) ...
Definition: IOExceptions.h:84
~IOException()
Definition: IOExceptions.h:44
InvalidFormatException(const std::string &message="", const std::string &position="")
Definition: IOExceptions.h:98
UnknownValueException(const std::string &message="", const std::string &position="")
Definition: IOExceptions.h:146
thrown when no data is available
Definition: IOExceptions.h:156
std::string msg
Definition: IOExceptions.h:51
thrown when an unsuccessful to convert data types/classes is made (e.g. attempt to convert a literal ...
Definition: IOExceptions.h:120
thrown when encountered an unexpected function's argument (e.g. bad index, bad or missing parameter n...
Definition: IOExceptions.h:132
ConversionFailedException(const std::string &message="", const std::string &position="")
Definition: IOExceptions.h:122
thrown when parsed data does not reflect an expected format (e.g. premature end of a line...
Definition: IOExceptions.h:96
thrown when a there are insufficient rights to access a file/server/... in a certain way (e...
Definition: IOExceptions.h:72
IndexOutOfBoundsException(const std::string &message="", const std::string &position="")
Definition: IOExceptions.h:110
thrown when an index is out of bounds
Definition: IOExceptions.h:108
InvalidNameException(const std::string &filename="", const std::string &position="")
Definition: IOExceptions.h:86
thrown when a there is an unsuccessful attempt to locate a file/server/...
Definition: IOExceptions.h:60
NoDataException(const std::string &message="", const std::string &position="")
Definition: IOExceptions.h:159
The basic exception class adjusted for the needs of SLF software.
Definition: IOExceptions.h:41