00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef TECPLOT_TOOLBOX_EXCEPTION_H
00012 #define TECPLOT_TOOLBOX_EXCEPTION_H
00013
00014 #if defined MSWIN
00015 #pragma once
00016 #endif
00017
00018 #include "tptoolbox.h"
00019 #include <exception>
00020 #include <string>
00021
00022 namespace tecplot { namespace toolbox {
00023
00024 #define ThrowException(exception, what) \
00025 { \
00026 throw exception(what, std::string(__FILE__), __LINE__); \
00027 }
00028
00029
00030
00034 class TPTOOLBOX_DLLAPI Exception : public virtual std::exception
00035 {
00036 public:
00039 Exception();
00040
00043 Exception(const std::string& what);
00044
00047 Exception(const std::string& what,
00048 const std::string& fileName,
00049 int lineNum);
00050
00053 Exception(const Exception& other);
00054
00057 virtual ~Exception() throw();
00058
00061 virtual const char * what() const throw();
00062
00065 virtual const char * fileName() const throw();
00066
00069 virtual int lineNum() const throw();
00070
00071 private:
00072 const std::string m_what;
00073 const std::string m_fileName;
00074 const int m_lineNum;
00075
00076
00077
00078
00079
00080 Exception& operator = (const Exception& other);
00081 };
00082
00083 }}
00084
00085 #endif // TECPLOT_TOOLBOX_EXCEPTION_H
00086