opennurbs_error.h
Go to the documentation of this file.
00001 /* $NoKeywords: $ */
00002 /*
00003 //
00004 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
00005 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
00006 // McNeel & Associates.
00007 //
00008 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
00009 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
00010 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
00011 //                              
00012 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
00013 //
00015 */
00016 
00017 #if !defined(OPENNURBS_ERROR_INC_)
00018 #define OPENNURBS_ERROR_INC_
00019 
00020 /*
00021 // Macros used to log errors and warnings.  The ON_Warning() and ON_Error()
00022 // functions are defined in opennurbs_error.cpp.
00023 */
00024 
00025 #if defined(__FUNCTION__)
00026 // __FUNCTION__ macro exists
00027 #define ON_ERROR(msg) ON_ErrorEx(__FILE__,__LINE__,__FUNCTION__,msg)
00028 #define ON_WARNING(msg) ON_WarningEx(__FILE__,__LINE__,__FUNCTION__,msg)
00029 #define ON_ASSERT(cond) ON_AssertEx(cond,__FILE__,__LINE__,__FUNCTION__, #cond " is false")
00030 #define ON_ASSERT_OR_RETURN(cond,returncode) do{if (!(cond)) {ON_AssertEx(false,__FILE__,__LINE__,__FUNCTION__, #cond " is false");return(returncode);}}while(0)
00031 #else
00032 // __FUNCTION__ macro does not exist
00033 #define ON_ERROR(msg) ON_Error(__FILE__,__LINE__,msg)
00034 #define ON_WARNING(msg) ON_Warning(__FILE__,__LINE__,msg)
00035 #define ON_ASSERT(cond) ON_Assert(cond,__FILE__,__LINE__, #cond " is false")
00036 #define ON_ASSERT_OR_RETURN(cond,returncode) do{if (!(cond)) {ON_Assert(false,__FILE__,__LINE__, #cond " is false");return(returncode);}}while(0)
00037 #endif
00038 
00039 
00040 ON_BEGIN_EXTERNC
00041 
00042 /*
00043 // All error/warning messages are sent to ON_ErrorMessage().  Replace the
00044 // default handler (defined in opennurbs_error_message.cpp) with something
00045 // that is appropriate for debugging your application.
00046 */
00047 ON_DECL
00048 void ON_ErrorMessage( 
00049        int,         /* 0 = warning message, 1 = serious error message, 2 = assert failure */
00050        const char*  
00051        ); 
00052 
00053 /*
00054 Returns:
00055   Number of opennurbs errors since program started.
00056 */
00057 ON_DECL
00058 int     ON_GetErrorCount(void);
00059 
00060 /*
00061 Returns:
00062   Number of opennurbs warnings since program started.
00063 */
00064 ON_DECL
00065 int     ON_GetWarningCount(void);
00066 
00067 /*
00068 Returns:
00069   Number of math library or floating point errors that have 
00070   been handled since program started.
00071 */
00072 ON_DECL
00073 int     ON_GetMathErrorCount(void);
00074 
00075 ON_DECL
00076 int     ON_GetDebugErrorMessage(void);
00077 
00078 ON_DECL
00079 void    ON_EnableDebugErrorMessage( int bEnableDebugErrorMessage );
00080 
00081 
00082 ON_DECL
00083 void    ON_Error( const char*, /* sFileName:   __FILE__ will do fine */
00084                   int,         /* line number: __LINE__ will do fine */
00085                   const char*, /* printf() style format string */
00086                   ...          /* printf() style ags */
00087                   );
00088 
00089 ON_DECL
00090 void    ON_ErrorEx( const char*, // sFileName:   __FILE__ will do fine
00091                   int,           // line number: __LINE__ will do fine
00092                   const char*,   // sFunctionName: __FUNCTION__ will do fine
00093                   const char*,   // printf() style format string
00094                   ...            // printf() style ags
00095                   );
00096 ON_DECL
00097 void    ON_Warning( const char*, /* sFileName:   __FILE__ will do fine */
00098                     int,         /* line number: __LINE__ will do fine */
00099                     const char*, /* printf() style format string */
00100                     ...          /* printf() style ags */
00101                   );
00102 ON_DECL
00103 void    ON_WarningEx( const char*, // sFileName:   __FILE__ will do fine
00104                   int,           // line number: __LINE__ will do fine
00105                   const char*,   // sFunctionName: __FUNCTION__ will do fine
00106                   const char*,   // printf() style format string
00107                   ...            // printf() style ags
00108                   );
00109 
00110 // Ideally - these "assert" functions will be deleted when the SDK can be changed.
00111 ON_DECL
00112 void    ON_Assert( int,         /* if false, error is flagged */
00113                    const char*, /* sFileName:   __FILE__ will do fine */
00114                    int,         /* line number: __LINE__ will do fine */
00115                    const char*, /* printf() style format string */
00116                    ...          /* printf() style ags */
00117                   );
00118 
00119 ON_DECL
00120 void    ON_AssertEx( int,        // if false, error is flagged
00121                   const char*,   // sFileName:   __FILE__ will do fine
00122                   int,           // line number: __LINE__ will do fine
00123                   const char*,   // sFunctionName: __FUNCTION__ will do fine
00124                   const char*,   // printf() style format string
00125                   ...            // printf() style ags
00126                   );
00127 
00128 ON_DECL
00129 void    ON_MathError( 
00130         const char*, /* sModuleName */
00131         const char*, /* sErrorType */
00132         const char*  /* sFunctionName */
00133         );
00134 
00135 ON_END_EXTERNC
00136 
00137 #endif


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:27:00