// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+
#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.ixx>
-#include <Standard_TypeMismatch.hxx>
-#include <Standard_Type.hxx>
+#include <Standard_Failure.hxx>
#include <Standard_Macro.hxx>
-#include <string.h>
+#include <Standard_NoSuchObject.hxx>
#include <Standard_PCharacter.hxx>
+#include <Standard_Type.hxx>
+#include <Standard_TypeMismatch.hxx>
+
+#include <string.h>
+IMPLEMENT_STANDARD_RTTIEXT(Standard_Failure,Standard_Transient)
static Standard_CString allocate_message(const Standard_CString AString)
{
}
}
+// Define Standard_THREADLOCAL modifier as C++11 thread_local keyword
+// where it is available.
+#if (defined(__INTEL_COMPILER) && __INTEL_COMPILER > 1400) || \
+ (defined(__clang__)) /* assume standard CLang > 3.3 or XCode >= 8 */ || \
+ (defined(_MSC_VER) && _MSC_VER >= 1800) /* MSVC++ >= 14 */ || \
+ (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) /* GCC >= 4.8 */
+ #define Standard_THREADLOCAL thread_local
+#else
+ #define Standard_THREADLOCAL
+#endif
// ******************************************************************
// Standard_Failure *
// ******************************************************************
#ifndef NO_CXX_EXCEPTION
-static Handle(Standard_Failure) RaisedError;
+static Standard_THREADLOCAL Handle(Standard_Failure) RaisedError;
#endif
// ------------------------------------------------------------------
//
myMessage = copy_message(theFailure.myMessage);
}
-void Standard_Failure::Destroy()
+Standard_Failure::~Standard_Failure()
{
deallocate_message(myMessage);
}
#endif
}
-void Standard_Failure::Jump() const
+void Standard_Failure::Jump()
{
#if defined (NO_CXX_EXCEPTION) || defined (OCC_CONVERT_SIGNALS)
Standard_ErrorHandler::Error (this);
{
return new Standard_Failure(AString) ;
}
+
+//=======================================================================
+//function : GetMessageString
+//purpose : Returns error message
+//=======================================================================
+Standard_CString Standard_Failure::GetMessageString () const
+{
+ return (myMessage ? myMessage+sizeof(Standard_Integer) : "");
+}
+