ML Reference
MeVis/Foundation/Sources/MLUtilities/mlErrorMacros.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00005 
00010 //----------------------------------------------------------------------------------
00011 
00012 #ifndef __mlErrorMacros_H
00013 #define __mlErrorMacros_H
00014 
00015 #ifndef __mlConfig_H
00016 #include "mlConfig.h"
00017 #endif
00018 
00019 #include "mlMacros.h"
00020 
00021 // ------------------------------------------------------
00022 // Disabling some bogus warnings in MeVis release mode
00023 // ------------------------------------------------------
00024 #if defined(_MSC_VER)
00025   #pragma warning(push)
00026   #if !defined(_DEBUG)
00027     #pragma warning(disable: 4701)  // local variable *may* be used without init
00028     #pragma warning(disable: 4702)  // unreachable code
00029     #pragma warning(disable: 4710)  // private constructors are disallowed 
00030     #pragma warning(disable: 4097)  // typedef-name 'identifier1' used as synonym for class-name 'identifier2'
00031     #pragma warning(disable: 4512)  // 'class' : assignment operator could not be generated
00032     #pragma warning(disable: 4127)  // conditional expression is constant
00033     #pragma warning(disable: 4711)  // selected for automatic inline expansion
00034   #endif
00035   #pragma warning(disable: 4127)    // conditional expression is constant
00036 #endif
00037 
00038 #include "mlLogging.h"
00039 
00040 #if defined(_MSC_VER)
00041   #pragma warning(pop)
00042 #endif
00043 //----------------------------------------------------------------------------------
00044 //
00045 // MeVis implementation of error and tracing macros. 
00046 //
00047 //----------------------------------------------------------------------------------
00048 
00051 #ifdef _DEBUG
00052   #ifdef ML_COMPILE_DEBUG_EXCEPTION_HANDLING
00053     #undef ML_SUPPRESS_DIAGNOSIS
00054   #endif
00055 #endif
00056 
00057 
00058 #ifndef ML_SUPPRESS_DIAGNOSIS
00059 
00060   #ifdef _DEBUG
00061     #ifndef ML_COMPILE_DEBUG_EXCEPTION_HANDLING
00062 
00063 
00064       #define ML_SUPPRESS_DIAGNOSIS
00065     #endif
00066 
00067   #else  // _DEBUG
00068 
00069     // In release mode the try/catch mechanisms are compiled such that 
00070     // maximum stability of the application and logging is reached.
00071     // #define ML_SUPPRESS_DIAGNOSIS
00072 
00073   #endif // _DEBUG
00074 
00075 #endif // ifndef ML_SUPPRESS_DIAGNOSIS
00076 
00077 
00078 
00079 //---------------------------------------------------------------------------
00080 // Compile diagnosis and error checking macros if ML_SUPPRESS_DIAGNOSIS is 
00081 // not defined. Then tracing and try/catching of errors is activated.
00082 // However exact debugging of error positions not possible any more.
00083 //---------------------------------------------------------------------------
00084 #ifndef ML_SUPPRESS_DIAGNOSIS
00085 
00086   //-----------------------------------------------------------------
00087   /* This area is used for the mode comparable to the release mode */
00088   //-----------------------------------------------------------------
00089 
00090   //---------------------------------------------------------------------------
00092 
00093   //---------------------------------------------------------------------------
00094   #ifndef ML_DISABLE_TRACING
00095     #define ML_TRACE_IN(__classAndMethod___)      static const char * const __ML_TRACE_IN_STRING_BUF = __FILE__ ":" __classAndMethod___; \
00096                                                 ml::Trace<MLuint16> __MLTraceObject(__ML_TRACE_IN_STRING_BUF, ml::MLGlobalTraceBuffer);
00097   #else
00098     #define ML_TRACE_IN(__classAndMethod___)
00099   #endif
00100 
00101   // Specialized tracing macro for time critical code. Usually only compiled for diagnostics versions.
00102   #ifdef ML_COMPILE_ML_TRACE_IN_TIME_CRITICAL
00103     // Compile even ML_TRACE_IN_TIME_CRITICAL if explicitly enabled.
00104     #define ML_TRACE_IN_TIME_CRITICAL(__classAndMethod___) ML_TRACE_IN(__classAndMethod___)
00105   #else
00106     // Normally do not compile ML_TRACE_IN_TIME_CRITICAL since it's time critical.
00107     #define ML_TRACE_IN_TIME_CRITICAL(__classAndMethod___)
00108   #endif
00109 
00110 #ifdef ML_DEPRECATED
00111 
00112 
00113 
00114 
00115   #define ML_TRACE_IN_TC(__classAndMethod___) ML_TRACE_IN_TIME_CRITICAL(__classAndMethod___)
00116  
00117   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00118   #pragma deprecated("ML_TRACE_IN_TC")
00119   #endif
00120 
00121 #endif // ML_DEPRECATED
00122 
00123   // Specialized tracing macro for diagnostic function inside of the ML. These function 
00124   // are considered reliable and are only traced if explicitly enabled with definition 
00125   // ML_COMPILE_ML_INTERNAL_ERROR_TRACE_IN. In normal case they are not traced to avoid 
00126   // that normal error handling functions inside the ML are also traced.
00127   // Enabled usually only in diagnostic versions.
00128   #ifdef ML_COMPILE_ML_INTERNAL_ERROR_TRACE_IN
00129 
00130     #define ML_INTERNAL_ERROR_TRACE_IN(__classAndMethod___)   ML_TRACE_IN(__classAndMethod___)
00131   #else
00132     // Normally do not compile ML_TRACE_IN_TIME_CRITICAL since it's time critical.
00133     #define ML_INTERNAL_ERROR_TRACE_IN(__classAndMethod___)
00134   #endif
00135 
00136 
00137 
00138   //----------------------------------------
00140 
00141   //----------------------------------------
00142   #define ML_TRY                       try
00143 
00144   #define ML_CATCH                     catch(...){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_UNKNOWN_EXCEPTION); }
00145   #define ML_CATCH_RETURN              catch(...){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_UNKNOWN_EXCEPTION); return; }
00146   #define ML_CATCH_RETURN_FALSE        catch(...){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_UNKNOWN_EXCEPTION); return false; }
00147   #define ML_CATCH_RETURN_NULL         catch(...){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_UNKNOWN_EXCEPTION); return 0; }
00148   #define ML_CATCH_RETHROW             catch(...){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_UNKNOWN_EXCEPTION); throw; }
00149   #define ML_CATCH_BLOCK(__paramType)  catch(__paramType)
00150 
00151 #ifdef ML_DEPRECATED
00152 
00153 
00154 
00155 
00156   #define ML_CATCH_R   ML_CATCH_RETURN
00157 
00158 
00159   #define ML_CATCH_RF  ML_CATCH_RETURN_FALSE
00160 
00161 
00162   #define ML_CATCH_RN  ML_CATCH_RETURN_NULL
00163 
00164   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00165   #pragma deprecated("ML_CATCH_R", "ML_CATCH_RF", "ML_CATCH_RN")
00166   #endif
00167 
00168 
00169 #endif // ML_DEPRECATED
00170 
00171 
00172 
00173   //----------------------------------------
00175 
00176   //----------------------------------------
00177   #define ML_CHECK(x)                if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); }
00178   #define ML_CHECK_ONLY_IN_DEBUG(x)  /* Behaves like assert, not compiled in release mode */
00179   #define ML_CHECK_RETURN(x)         if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return; }
00180   #define ML_CHECK_RETURN_FALSE(x)   if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return false; }
00181   #define ML_CHECK_RETURN_NULL(x)    if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return 0; }
00182   #define ML_CHECK_THROW(x)          if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); throw ML_BAD_POINTER_OR_0; }
00183   #define ML_CHECK_RUNTIME_TYPE(x)   if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_TYPE_NOT_REGISTERED); throw ML_TYPE_NOT_REGISTERED; }
00184 
00185 #ifdef ML_DEPRECATED
00186 
00187 
00188 
00189 
00190   #define ML_CHECK_R(x)   ML_CHECK_RETURN(x)
00191 
00192 
00193   #define ML_CHECK_RF(x)  ML_CHECK_RETURN_FALSE(x)
00194 
00195 
00196   #define ML_CHECK_RN(x)  ML_CHECK_RETURN_NULL(x)
00197 
00198 
00199   #define ML_CHECK_TH(x)  ML_CHECK_THROW(x)
00200 
00201   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00202   #pragma deprecated("ML_CHECK_R", "ML_CHECK_RF", "ML_CHECK_RN", "ML_CHECK_TH")
00203   #endif
00204 
00205 #endif // ML_DEPRECATED
00206 
00207 
00208 
00209   //----------------------------------------
00211 
00212   //----------------------------------------
00213   #define ML_CHECK_FLOAT(x)               if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); }
00214   #define ML_CHECK_FLOAT_RETURN(x)        if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return; }
00215   #define ML_CHECK_FLOAT_RETURN_FALSE(x)  if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return false; }
00216   #define ML_CHECK_FLOAT_RETURN_NULL(x)   if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return 0; }
00217   #define ML_CHECK_FLOAT_THROW(x)         if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); throw ML_BAD_POINTER_OR_0; }
00218   #define ML_CHECK_FLOAT_RUNTIME_TYPE(x)  if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_TYPE_NOT_REGISTERED); throw ML_TYPE_NOT_REGISTERED; }
00219 
00220 #ifdef ML_DEPRECATED
00221 
00222 
00223 
00224 
00225   #define ML_CHECK_FLT_R(x)   ML_CHECK_FLOAT_RETURN(x)
00226 
00227 
00228   #define ML_CHECK_FLT_RF(x)  ML_CHECK_FLOAT_RETURN_FALSE(x)
00229 
00230 
00231   #define ML_CHECK_FLT_RN(x)  ML_CHECK_FLOAT_RETURN_NULL(x)
00232 
00233 
00234   #define ML_CHECK_FLT_TH(x)  ML_CHECK_FLOAT_THROW(x)
00235 
00236   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00237   #pragma deprecated("ML_CHECK_FLT_R", "ML_CHECK_FLT_RF", "ML_CHECK_FLT_RN", "ML_CHECK_FLT_TH")
00238   #endif
00239 
00240 #endif // ML_DEPRECATED
00241 
00242 
00243 
00244   //----------------------------------------
00246 
00247   //----------------------------------------
00248   #define ML_CHECK_NEW(var, exp)     try{ (var) = new exp; if (NULL == (var)){ throw(ML_NO_MEMORY); } } catch(...){ MLPrintAndNotifyFatal(__FILE__, __LINE__, (NULL == (var)) ? ML_NO_MEMORY : ML_CONSTRUCTOR_EXCEPTION); }
00249   #define ML_CHECK_NEW_TH(var, exp)  try{ (var) = new exp; if (NULL == (var)){ throw(ML_NO_MEMORY); } } catch(...){ MLPrintAndNotifyFatal(__FILE__, __LINE__, (NULL == (var)) ? ML_NO_MEMORY : ML_CONSTRUCTOR_EXCEPTION); throw; }
00250   #define ML_DELETE(var)             if (0 !=(var)){ delete  (var); (var) = 0; }
00251   #define ML_DELETE_ARRAY(var)       if (0 !=(var)){ delete[](var); (var) = 0; }
00252 
00253 #ifdef ML_DEPRECATED
00254 
00255 
00256 
00257 
00258   #define ML_DELETE_ARR(var) ML_DELETE_ARRAY(var)
00259 
00260   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00261   #pragma deprecated("ML_DELETE_ARR")
00262   #endif
00263 
00264 #endif // ML_DEPRECATED
00265 
00266 
00267 #else // of "ifndef ML_SUPPRESS_DIAGNOSIS"
00268 
00269   //---------------------------------------------------------------
00270   /* This area is used for the mode comparable to the debug mode */
00271   //---------------------------------------------------------------
00272 
00273   //----------------------------------------
00275 
00276   //----------------------------------------
00277   // Here we are in the normal "debug" mode. We do not compile any exception handlers nor tracing 
00278   // here. Thus we disable also the tracing macro, because tracing is used typically only in release 
00279   // mode where the application continues, crashes are suppressed as far as possible and diagnosis is 
00280   // only possible with tracing information in log files.
00281   // In debug mode we let everything crash and tracing is not needed, because we have all information
00282   // available in debugger call stacks etc. For internal developer purposes it also could be enabled 
00283   // here.
00284   #define ML_TRACE_IN(__classAndMethod___)      
00285 
00286   // Normally do not compile ML_TRACE_IN_TIME_CRITICAL since it's time critical.
00287   #define ML_TRACE_IN_TIME_CRITICAL(__classAndMethod___)
00288   
00289 #ifdef ML_DEPRECATED
00290 
00291 
00292 
00293 
00294   #define ML_TRACE_IN_TC(__classAndMethod___)  ML_TRACE_IN_TIME_CRITICAL(__classAndMethod___)
00295 
00296   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00297   #pragma deprecated("ML_TRACE_IN_TC")
00298   #endif
00299 
00300 #endif // ML_DEPRECATED
00301 
00302   // Specialized tracing macro for diagnostic function inside of the ML. These function 
00303   // are considered reliable and are only traced if explicitly enabled with definition 
00304   // ML_COMPILE_ML_INTERNAL_ERROR_TRACE_IN. In normal case they are not traced to avoid that normal
00305   // error handling functions inside the ML are also traced.
00306   // Enabled usually only in diagnostic versions.
00307   #ifdef ML_COMPILE_ML_INTERNAL_ERROR_TRACE_IN
00308     // Compile ML_INTERNAL_ERROR_TRACE_IN only if explicitly enabled.
00309     #define ML_INTERNAL_ERROR_TRACE_IN(__classAndMethod___)   ML_TRACE_IN(__classAndMethod___)
00310   #else
00311     // Normally do not compile ML_INTERNAL_ERROR_TRACE_IN since it's disturbs normal tracing outputs.
00312     #define ML_INTERNAL_ERROR_TRACE_IN(__classAndMethod___)
00313   #endif
00314 
00315 
00316 
00317   //----------------------------------------
00319 
00320   //----------------------------------------
00321   #define ML_TRY                                
00322 
00323   #define ML_CATCH                              
00324   #define ML_CATCH_RETURN                            
00325   #define ML_CATCH_RETURN_FALSE                           
00326   #define ML_CATCH_RETURN_NULL                           
00327   #define ML_CATCH_RETHROW                      
00328   #define ML_CATCH_BLOCK(__paramType)           if (MLAlwaysFalse)
00329 
00330 #ifdef ML_DEPRECATED
00331 
00332 
00333 
00334 
00335   #define ML_CATCH_R   ML_CATCH_RETURN
00336 
00337 
00338   #define ML_CATCH_RF  ML_CATCH_RETURN_FALSE
00339 
00340 
00341   #define ML_CATCH_RN  ML_CATCH_RETURN_NULL
00342 
00343   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00344   #pragma deprecated("ML_CATCH_R", "ML_CATCH_RF", "ML_CATCH_RN")
00345   #endif
00346 
00347 #endif // ML_DEPRECATED
00348 
00349 
00350   //----------------------------------------------------------------------------------------
00352 
00353   //----------------------------------------------------------------------------------------
00354   #define ML_CHECK(x)                if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0);};
00355   #define ML_CHECK_ONLY_IN_DEBUG(x)  ML_CHECK(x)
00356   #define ML_CHECK_RETURN(x)         if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return;}
00357   #define ML_CHECK_RETURN_FALSE(x)   if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return false;}
00358   #define ML_CHECK_RETURN_NULL(x)    if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return 0;}
00359   #define ML_CHECK_THROW(x)          if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); throw ML_BAD_POINTER_OR_0;}
00360   #define ML_CHECK_RUNTIME_TYPE(x)   if (!(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_TYPE_NOT_REGISTERED); throw ML_TYPE_NOT_REGISTERED;}
00361 
00362 #ifdef ML_DEPRECATED
00363 
00364 
00365 
00366 
00367   #define ML_CHECK_R(x)   ML_CHECK_RETURN(x)
00368 
00369 
00370   #define ML_CHECK_RF(x)  ML_CHECK_RETURN_FALSE(x)
00371 
00372 
00373   #define ML_CHECK_RN(x)  ML_CHECK_RETURN_NULL(x)
00374 
00375 
00376   #define ML_CHECK_TH(x)  ML_CHECK_THROW(x)
00377 
00378   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00379   #pragma deprecated("ML_CHECK_R", "ML_CHECK_RF", "ML_CHECK_RN", "ML_CHECK_TH")
00380   #endif
00381 
00382 #endif // ML_DEPRECATED
00383 
00385 
00386   //----------------------------------------
00388 
00389   //----------------------------------------
00390   #define ML_CHECK_FLOAT(x)               if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); }
00391   #define ML_CHECK_FLOAT_RETURN(x)        if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return; }
00392   #define ML_CHECK_FLOAT_RETURN_FALSE(x)  if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return false; }
00393   #define ML_CHECK_FLOAT_RETURN_NULL(x)   if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); return 0; }
00394   #define ML_CHECK_FLOAT_THROW(x)         if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_BAD_POINTER_OR_0); throw ML_BAD_POINTER_OR_0; }
00395   #define ML_CHECK_FLOAT_RUNTIME_TYPE(x)  if (MLValueIs0WOM(x)){ MLPrintAndNotifyFatal(__FILE__, __LINE__, ML_TYPE_NOT_REGISTERED); throw ML_TYPE_NOT_REGISTERED; }
00396 
00397 #ifdef ML_DEPRECATED
00398 
00399 
00400 
00401 
00402   #define ML_CHECK_FLT_R(x)   ML_CHECK_FLT_RETURN(x)
00403 
00404 
00405   #define ML_CHECK_FLT_RF(x)  ML_CHECK_FLT_RETURN_FALSE(x)
00406 
00407 
00408   #define ML_CHECK_FLT_RN(x)  ML_CHECK_FLT_RETURN_NULL(x)
00409 
00410 
00411   #define ML_CHECK_FLT_TH(x)  ML_CHECK_FLT_THROW(x)
00412 
00413   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00414   #pragma deprecated("ML_CHECK_FLT_R", "ML_CHECK_FLT_RF", "ML_CHECK_FLT_RN", "ML_CHECK_FLT_TH")
00415   #endif
00416 
00417 #endif // ML_DEPRECATED
00418 
00419 
00420 
00421   //----------------------------------------
00423 
00424   //----------------------------------------
00425   #define ML_CHECK_NEW(var, exp)     (var) = new exp; 
00426   #define ML_CHECK_NEW_TH(var, exp)  (var) = new exp; 
00427   #define ML_DELETE(var)             if (0 !=(var)){ delete  (var); (var) = 0; }
00428   #define ML_DELETE_ARRAY(var)       if (0 !=(var)){ delete[](var); (var) = 0; }
00429 
00430 #ifdef ML_DEPRECATED
00431 
00432 
00433 
00434 
00435   #define ML_DELETE_ARR(var) ML_DELETE_ARRAY(var)
00436   
00437   #if defined(WIN32) && defined(ML_WARN_DEPRECATED)
00438   #pragma deprecated("ML_DELETE_ARR")
00439   #endif
00440 
00441 #endif // ML_DEPRECATED
00442 
00443 
00444 
00445 #endif // ifdef ML_SUPPRESS_DIAGNOSIS
00446 
00447 
00448 //-----------------------------------------------------------------------------------------------
00450 
00451 //-----------------------------------------------------------------------------------------------
00456 #define _ML_INFORMATION_ADD_ON(FUNC_NAME, REASON, HANDLING)
00457 
00462 #define _ML_WARNING_ADD_ON(FUNC_NAME, REASON, HANDLING)
00463 
00468 #define _ML_ERROR_ADD_ON(FUNC_NAME, REASON, HANDLING)
00469 
00474 #define _ML_FATAL_ERROR_ADD_ON(FUNC_NAME, REASON, HANDLING)
00475 
00481 #define _ML_ERROR_SHOW_ASSERT_BOX(PARAM)
00482 
00483 
00484 
00485 
00486 
00487 
00488 //--------------------------------------------------------------------------------------------
00489 //
00491 
00492 //
00493 //--------------------------------------------------------------------------------------------
00494 
00495 //--------------------------------------------------------------------------------------------
00508 //--------------------------------------------------------------------------------------------
00509 #define _ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ, RTYPE)                              \
00510     {                                                                                                       \
00511       /* Get runtime information from RTYPE which could be a crashing expression.*/                         \
00512       const ML_UTILS_NAMESPACE::RuntimeType *rtt7645 = NULL;                                                \
00513       try{ rtt7645 = RTYPE; if (MLAlwaysFalse){ throw ML_UNKNOWN_EXCEPTION;} } catch(...){ rtt7645 = NULL; }\
00514       _ML_FATAL_ERROR_ADD_ON(FUNC_NAME, REASON, HANDLING)                                                   \
00515       ML_UTILS_NAMESPACE::MLErrorOutput.printAndNotify(ML_FATAL,                                            \
00516                                                        ML_PREFIX, "Function=", FUNC_NAME, REASON, HANDLING, \
00517                                                        __FILE__, __LINE__, RT_OBJ, rtt7645);                \
00518       _ML_ERROR_SHOW_ASSERT_BOX(0);                                                                         \
00519     }
00520 
00521 //--------------------------------------------------------------------------------------------
00534 //--------------------------------------------------------------------------------------------
00535 #define _ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ, RTYPE)                                    \
00536     {                                                                                                       \
00537       /* Get runtime information from RTYPE which could be a crashing expression.*/                         \
00538       const ML_UTILS_NAMESPACE::RuntimeType *rtt1987 = NULL;                                                \
00539       try{ rtt1987 = RTYPE; if (MLAlwaysFalse){ throw ML_UNKNOWN_EXCEPTION;} } catch(...){ rtt1987 = NULL; }\
00540       _ML_ERROR_ADD_ON(FUNC_NAME, REASON, HANDLING)                                                         \
00541       ML_UTILS_NAMESPACE::MLErrorOutput.printAndNotify(ML_ERROR,                                            \
00542                                                        ML_PREFIX, "Function=", FUNC_NAME, REASON, HANDLING, \
00543                                                        __FILE__, __LINE__, RT_OBJ, rtt1987);                \
00544       _ML_ERROR_SHOW_ASSERT_BOX(0);                                                                         \
00545     }
00546 
00547 //--------------------------------------------------------------------------------------------
00561 //--------------------------------------------------------------------------------------------
00562 #define _ML_PRINT_WARNING_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ, RTYPE)                                  \
00563     {                                                                                                       \
00564       /* Get runtime information from RTYPE which could be a crashing expression.*/                         \
00565       const ML_UTILS_NAMESPACE::RuntimeType *rt9477 = NULL;                                                 \
00566       try{ rt9477 = RTYPE; if (MLAlwaysFalse){ throw ML_UNKNOWN_EXCEPTION;} } catch(...){ rt9477 = NULL; }  \
00567       _ML_WARNING_ADD_ON(FUNC_NAME, REASON, HANDLING)                                                       \
00568       ML_UTILS_NAMESPACE::MLErrorOutput.printAndNotify(ML_WARNING,                                          \
00569                                                        ML_PREFIX, "Function=", FUNC_NAME, REASON, HANDLING, \
00570                                                        __FILE__, __LINE__, RT_OBJ, rt9477);                 \
00571       /* No showing of assert box here. That would be to drastic. */                                        \
00572     }
00573 
00574 //--------------------------------------------------------------------------------------------
00588 //--------------------------------------------------------------------------------------------
00589 #define _ML_PRINT_INFORMATION_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ, RTYPE)                              \
00590     {                                                                                                       \
00591       /* Get runtime information from RTYPE which could be a crashing expression.*/                         \
00592       const ML_UTILS_NAMESPACE::RuntimeType *rtAx598 = NULL;                                                \
00593       try{ rtAx598 = RTYPE; if (MLAlwaysFalse){ throw ML_UNKNOWN_EXCEPTION;} } catch(...){ rtAx598 = NULL; }\
00594       _ML_INFORMATION_ADD_ON(FUNC_NAME, REASON, HANDLING)                                                   \
00595       ML_UTILS_NAMESPACE::MLErrorOutput.printAndNotify(ML_INFORMATION,                                      \
00596                                                        ML_PREFIX, "Function=", FUNC_NAME, REASON, HANDLING, \
00597                                                        __FILE__, __LINE__, RT_OBJ, rtAx598);                \
00598       /* No showing of assert box here. That would be to drastic. */                                        \
00599     }
00600 
00601 
00602 
00603 
00604 //--------------------------------------------------------------------------------------------
00605 //
00607 
00608 //
00609 //--------------------------------------------------------------------------------------------
00610 //--------------------------------------------------------------------------------------------
00613 //--------------------------------------------------------------------------------------------
00614 #define ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) \
00615   /* Use OR with MLAlwaysFalse to avoid compiler warnings about unreachable code when constant RT_OBJ is passed from other macro. */ \
00616   _ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ, (((RT_OBJ) || MLAlwaysFalse) ? (RT_OBJ)->getTypeId() : NULL))
00617 
00618 //--------------------------------------------------------------------------------------------
00621 //--------------------------------------------------------------------------------------------
00622 #define ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) \
00623   /* Use OR with MLAlwaysFalse to avoid compiler warnings about unreachable code when constant RT_OBJ is passed from other macro. */ \
00624   _ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ, (((RT_OBJ) || MLAlwaysFalse) ? (RT_OBJ)->getTypeId() : NULL))
00625 
00626 //--------------------------------------------------------------------------------------------
00629 //--------------------------------------------------------------------------------------------
00630 #define ML_PRINT_WARNING_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) \
00631   /* Use OR with MLAlwaysFalse to avoid compiler warnings about unreachable code when constant RT_OBJ is passed from other macro. */ \
00632   _ML_PRINT_WARNING_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ, (((RT_OBJ) || MLAlwaysFalse) ? (RT_OBJ)->getTypeId() : NULL))
00633 
00634 //--------------------------------------------------------------------------------------------
00637 //--------------------------------------------------------------------------------------------
00638 #define ML_PRINT_INFORMATION_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) \
00639   /* Use OR with MLAlwaysFalse to avoid compiler warnings about unreachable code when constant RT_OBJ is passed from other macro. */ \
00640   _ML_PRINT_INFORMATION_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ, (((RT_OBJ) || MLAlwaysFalse) ? (RT_OBJ)->getTypeId() : NULL))
00641 
00643 
00644 
00645 
00646 //--------------------------------------------------------------------------------------------
00647 //
00649 
00650 //
00651 //--------------------------------------------------------------------------------------------
00652 
00653 //--------------------------------------------------------------------------------------------
00658 //--------------------------------------------------------------------------------------------
00659 #define ML_PRINT_FATAL_ERROR(FUNC_NAME, REASON, HANDLING) \
00660   _ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)
00661 
00662 //--------------------------------------------------------------------------------------------
00667 //--------------------------------------------------------------------------------------------
00668 #define ML_PRINT_ERROR(FUNC_NAME, REASON, HANDLING) \
00669   _ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)
00670 
00671 //--------------------------------------------------------------------------------------------
00676 //--------------------------------------------------------------------------------------------
00677 #define ML_PRINT_WARNING(FUNC_NAME, REASON, HANDLING) \
00678   _ML_PRINT_WARNING_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)
00679 
00680 //--------------------------------------------------------------------------------------------
00685 //--------------------------------------------------------------------------------------------
00686 #define ML_PRINT_INFORMATION(FUNC_NAME, REASON, HANDLING) \
00687   _ML_PRINT_INFORMATION_DUMP(FUNC_NAME, REASON, HANDLING, NULL, NULL)
00688 
00689 //--------------------------------------------------------------------------------------------
00693 //--------------------------------------------------------------------------------------------
00694 #define ML_PRINT_INFO(FUNC_NAME, HANDLING) \
00695   _ML_PRINT_INFORMATION_DUMP(FUNC_NAME, ML_RESULT_OK, HANDLING, NULL, NULL)
00696 
00698 
00699 
00700 
00701 
00702 #endif // __mlErrorMacros_H
00703 
00704