#ifndef Utils_ExceptHandlers_HeaderFile
#define Utils_ExceptHandlers_HeaderFile
+#include <SALOME_Utils.hxx>
+
#include <stdexcept>
-#include <utilities.h>
typedef void (*PVF)();
-class Unexpect { //save / retrieve unexpected exceptions treatment
+class UTILS_EXPORT Unexpect { //save / retrieve unexpected exceptions treatment
PVF old;
public :
+#ifndef WNT
+ Unexpect( PVF f )
+ { old = std::set_unexpected(f); }
+ ~Unexpect() { std::set_unexpected(old); }
+#else
Unexpect( PVF f )
- { old = set_unexpected(f); }
- ~Unexpect() { set_unexpected(old); }
+ { old = ::set_unexpected(f); }
+ ~Unexpect() { ::set_unexpected(old); }
+#endif
};
-class Terminate {//save / retrieve terminate function
+class UTILS_EXPORT Terminate {//save / retrieve terminate function
PVF old;
public :
+#ifndef WNT
Terminate( PVF f )
- { old = set_terminate(f); }
- ~Terminate() { set_terminate(old); }
+ { old = std::set_terminate(f); }
+ ~Terminate() { std::set_terminate(old); }
+#else
+ Terminate( PVF f )
+ { old = ::set_terminate(f); }
+ ~Terminate() { ::set_terminate(old); }
+#endif
};
#define UNEXPECT_CATCH(FuncName, ExceptionConstructor) \
-void FuncName () {\
+inline void FuncName () {\
throw ExceptionConstructor (); \
}
//Example of the usage
//Definitions :
-extern void SalomeException();
-extern void SALOME_SalomeException();
+UTILS_EXPORT extern void SalomeException();
+UTILS_EXPORT extern void SALOME_SalomeException();
+
#endif