SALOME documentation central
src/Utils/Utils_ExceptHandlers.hxx
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 #ifndef Utils_ExceptHandlers_HeaderFile
00029 #define Utils_ExceptHandlers_HeaderFile
00030
00031 #include "SALOME_Utils.hxx"
00032
00033 #include <stdexcept>
00034
00035 typedef void (*PVF)();
00036
00037 class UTILS_EXPORT Unexpect {
00038 PVF old;
00039 public :
00040 #ifndef WIN32
00041 Unexpect( PVF f )
00042 { old = std::set_unexpected(f); }
00043 ~Unexpect() { std::set_unexpected(old); }
00044 #else
00045 Unexpect( PVF f )
00046 { old = ::set_unexpected(f); }
00047 ~Unexpect() { ::set_unexpected(old); }
00048 #endif
00049 };
00050
00051 class UTILS_EXPORT Terminate {
00052
00053 PVF old;
00054 public :
00055 #ifndef WIN32
00056 Terminate( PVF f )
00057 { old = std::set_terminate(f); }
00058 ~Terminate() { std::set_terminate(old); }
00059 #else
00060 Terminate( PVF f )
00061 { old = ::set_terminate(f); }
00062 ~Terminate() { ::set_terminate(old); }
00063 #endif
00064 };
00065
00066 #define UNEXPECT_CATCH(FuncName, ExceptionConstructor) \
00067 inline void FuncName () {\
00068 throw ExceptionConstructor (); \
00069 }
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 UTILS_EXPORT extern void SalomeException();
00086 UTILS_EXPORT extern void SALOME_SalomeException();
00087
00088 #endif
Copyright © 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS