Chemical Data Processing Library C++ API - Version 1.2.0
Base/Exceptions.hpp
Go to the documentation of this file.
1 /*
2  * Exceptions.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_BASE_EXCEPTIONS_HPP
30 #define CDPL_BASE_EXCEPTIONS_HPP
31 
32 #include <string>
33 #include <exception>
34 
35 #include "CDPL/Base/APIPrefix.hpp"
36 
37 
38 namespace CDPL
39 {
40 
41  namespace Base
42  {
43 
47  class CDPL_BASE_API Exception : public std::exception
48  {
49 
50  public:
55  Exception(const std::string& msg = "");
56 
60  virtual ~Exception() throw();
61 
66  const char* what() const throw();
67 
68  private:
69  std::string message;
70  };
71 
76  {
77 
78  public:
83  ValueError(const std::string& msg = "");
84 
88  virtual ~ValueError() throw();
89  };
90 
95  {
96 
97  public:
102  NullPointerException(const std::string& msg = "");
103 
107  virtual ~NullPointerException() throw();
108  };
109 
114  {
115 
116  public:
121  RangeError(const std::string& msg = "");
122 
126  virtual ~RangeError() throw();
127  };
128 
133  {
134 
135  public:
140  SizeError(const std::string& msg = "");
141 
145  virtual ~SizeError() throw();
146  };
147 
152  {
153 
154  public:
159  IndexError(const std::string& msg = "");
160 
164  virtual ~IndexError() throw();
165  };
166 
171  {
172 
173  public:
178  ItemNotFound(const std::string& msg = "");
179 
183  virtual ~ItemNotFound() throw();
184  };
185 
191  {
192 
193  public:
198  BadCast(const std::string& msg = "");
199 
203  virtual ~BadCast() throw();
204  };
205 
211  {
212 
213  public:
218  OperationFailed(const std::string& msg = "");
219 
223  virtual ~OperationFailed() throw();
224  };
225 
230  {
231 
232  public:
237  CalculationFailed(const std::string& msg = "");
238 
242  virtual ~CalculationFailed() throw();
243  };
244 
250  {
251 
252  public:
257  IOError(const std::string& msg = "");
258 
262  virtual ~IOError() throw();
263  };
264  } // namespace Base
265 } // namespace CDPL
266 
267 #endif // CDPL_BASE_EXCEPTIONS_HPP
Definition of the preprocessor macro CDPL_BASE_API.
#define CDPL_BASE_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Thrown to indicate that a cast or conversion from a given source type to a requested target type is n...
Definition: Base/Exceptions.hpp:191
virtual ~BadCast()
Virtual destructor.
BadCast(const std::string &msg="")
Constructs a BadCast object with the error message set to msg.
Thrown to indicate that some requested calculation has failed.
Definition: Base/Exceptions.hpp:230
CalculationFailed(const std::string &msg="")
Constructs a CalaculationFailed object with the error message set to msg.
virtual ~CalculationFailed()
Virtual destructor.
The root of the CDPL exception hierarchy.
Definition: Base/Exceptions.hpp:48
virtual ~Exception()
Virtual destructor.
Exception(const std::string &msg="")
Constructs an Exception object with the error message set to msg.
Thrown to indicate that an I/O operation has failed because of physical (e.g. broken pipe) or logical...
Definition: Base/Exceptions.hpp:250
IOError(const std::string &msg="")
Constructs an IOError object with the error message set to msg.
virtual ~IOError()
Virtual destructor.
Thrown to indicate that an index is out of range.
Definition: Base/Exceptions.hpp:152
IndexError(const std::string &msg="")
Constructs an IndexError object with the error message set to msg.
virtual ~IndexError()
Virtual destructor.
Thrown to indicate that some requested data item could not be found.
Definition: Base/Exceptions.hpp:171
virtual ~ItemNotFound()
Virtual destructor.
ItemNotFound(const std::string &msg="")
Constructs an ItemNotFound object with the error message set to msg.
Thrown when an operation requires or expects a valid pointer but a null pointer was provided.
Definition: Base/Exceptions.hpp:95
virtual ~NullPointerException()
Virtual destructor.
NullPointerException(const std::string &msg="")
Constructs a NullPointerException object with the error message set to msg.
Thrown to indicate that some requested operation has failed (e.g. due to unfulfilled preconditions or...
Definition: Base/Exceptions.hpp:211
virtual ~OperationFailed()
Virtual destructor.
OperationFailed(const std::string &msg="")
Constructs an OperationFailed object with the error message set to msg.
Thrown to indicate that a value is out of range.
Definition: Base/Exceptions.hpp:114
RangeError(const std::string &msg="")
Constructs a RangeError object with the error message set to msg.
virtual ~RangeError()
Virtual destructor.
Thrown to indicate that the size of a (multidimensional) array is not correct.
Definition: Base/Exceptions.hpp:133
SizeError(const std::string &msg="")
Constructs a SizeError object with the error message set to msg.
virtual ~SizeError()
Virtual destructor.
Thrown to indicate errors caused by some invalid value.
Definition: Base/Exceptions.hpp:76
ValueError(const std::string &msg="")
Constructs a ValueError object with the error message set to msg.
virtual ~ValueError()
Virtual destructor.
The namespace of the Chemical Data Processing Library.