NetCDF4 C++ API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NcException.h
Go to the documentation of this file.
1 
16 #ifndef INC_netcdf_NcException_h
17 #define INC_netcdf_NcException_h
18 
19 #include <exception>
20 #include <string>
21 #include <sstream>
22 
23 namespace netcdf {
24 
25 
32  class NcException : public std::exception
33  {
34 
35  public:
36 
38  std::string const exceptionName,
39  std::string const complaint,
40  std::string const file,
41  int const line);
42 
44  std::string const complaint,
45  std::string const file,
46  int const line);
47 
48  virtual ~NcException() throw() {}
49 
50  char const * what () const throw() { return exceptionMsg.c_str(); }
51 
52  private:
53 
54  std::string message;
55  std::string exceptionName;
56  std::string fileName;
57  int lineNumber;
58 
59  std::string exceptionMsg;
60 
61  };
62 
63 
64 } // namespace netcdf
65 
66 
67 #define NcEXCEPTION(a_) netcdf::NcException( "NetCDF4 API Exception", (a_), __FILE__, __LINE__ )
68 
69 
70 #endif
virtual ~NcException()
Definition: NcException.h:48
Handles the C++ API exceptions.
Definition: NcException.h:32
NcException(std::string const exceptionName, std::string const complaint, std::string const file, int const line)
Definition: NcException.cpp:20
char const * what() const
Definition: NcException.h:50