Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef __ASTRA_EXCEPTION__
00039 #define __ASTRA_EXCEPTION__
00040
00041 #include <cstdarg>
00042 #include <cstdio>
00043 #include <exception>
00044 #include <string>
00045
00046 #if defined _WIN32 && defined _MSC_VER
00047 # define __PRETTY_FUNCTION__ __FUNCTION__
00048 #endif
00049 #define THROW_OPENNI_EXCEPTION(format,...) throwOpenNIException( __PRETTY_FUNCTION__, __FILE__, __LINE__, format , ##__VA_ARGS__ )
00050
00051 namespace astra_wrapper
00052 {
00058 class AstraException : public std::exception
00059 {
00060 public:
00061 AstraException(const std::string& function_name,
00062 const std::string& file_name,
00063 unsigned line_number,
00064 const std::string& message);
00065
00066 virtual ~AstraException() throw();
00067 AstraException & operator=(const AstraException& exception);
00068 virtual const char* what() const throw();
00069
00070 const std::string& getFunctionName() const;
00071 const std::string& getFileName() const;
00072 unsigned getLineNumber() const;
00073
00074 protected:
00075 std::string function_name_;
00076 std::string file_name_;
00077 unsigned line_number_;
00078 std::string message_;
00079 std::string message_long_;
00080 };
00081
00082 inline void throwOpenNIException(const char* function, const char* file, unsigned line, const char* format, ...)
00083 {
00084 static char msg[1024];
00085 va_list args;
00086 va_start(args, format);
00087 vsprintf(msg, format, args);
00088 throw AstraException(function, file, line, msg);
00089 }
00090 }
00091 #endif