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 #include <pcl/pcl_config.h>
00038 #ifdef HAVE_OPENNI
00039
00040 #ifndef __OPENNI_EXCEPTION__
00041 #define __OPENNI_EXCEPTION__
00042
00043 #include <cstdarg>
00044 #include <cstdio>
00045 #include <exception>
00046 #include <string>
00047
00048
00049
00050
00051 #if defined _WIN32 && defined _MSC_VER && !defined __PRETTY_FUNCTION__
00052 #define __PRETTY_FUNCTION__ __FUNCTION__
00053 #endif
00054
00055
00056 #define THROW_OPENNI_EXCEPTION(format,...) throwOpenNIException( __PRETTY_FUNCTION__, __FILE__, __LINE__, format , ##__VA_ARGS__ )
00057
00058
00059 namespace openni_wrapper
00060 {
00061
00068 class OpenNIException : public std::exception
00069 {
00070 public:
00079 OpenNIException (const std::string& function_name, const std::string& file_name, unsigned line_number, const std::string& message) throw ();
00080
00084 virtual ~OpenNIException () throw ();
00085
00091 OpenNIException & operator= (const OpenNIException& exception) throw ();
00092
00097 virtual const char* what () const throw ();
00098
00102 const std::string& getFunctionName () const throw ();
00103
00107 const std::string& getFileName () const throw ();
00108
00112 unsigned getLineNumber () const throw ();
00113 protected:
00114 std::string function_name_;
00115 std::string file_name_;
00116 unsigned line_number_;
00117 std::string message_;
00118 std::string message_long_;
00119 } ;
00120
00129 inline void
00130 throwOpenNIException (const char* function_name, const char* file_name, unsigned line_number, const char* format, ...)
00131 {
00132 static char msg[1024];
00133 va_list args;
00134 va_start (args, format);
00135 vsprintf (msg, format, args);
00136 throw OpenNIException (function_name, file_name, line_number, msg);
00137 }
00138 }
00139 #endif
00140 #endif