Open CASCADE Technology  6.9.1
Static Public Member Functions
OSD Class Reference

Set of Operating Sytem Dependent Tools (O)perating (S)ystem (D)ependent. More...

#include <OSD.hxx>

Static Public Member Functions

static void SetSignal (const Standard_Boolean theFloatingSignal=Standard_True)
 A tool to manage threads. More...
 
static Standard_Integer AvailableMemory ()
 Returns available memory in Kilobytes. More...
 
static void SecSleep (const Standard_Integer aDelay)
 Commands the process to sleep for a number of seconds. More...
 
static void MilliSecSleep (const Standard_Integer aDelay)
 Commands the process to sleep for a number of milliseconds. More...
 
static Standard_Boolean RealToCString (const Standard_Real aReal, Standard_PCharacter &aString)
 Converts aReal into aCstring in exponential format with a period as decimal point, no thousand separator and no grouping of digits. The conversion is independant from the current locale. More...
 
static Standard_Boolean CStringToReal (const Standard_CString aString, Standard_Real &aReal)
 Converts aCstring representing a real with a period as decimal point, no thousand separator and no grouping of digits into aReal . The conversion is independant from the current locale. More...
 
static Standard_Boolean IsDivisible (const Standard_Real aDividend, const Standard_Real aDivisor)
 Tests if the quotient theDividend/theDivisor does not overflow. More...
 
static Standard_Integer GetExponent (const Standard_Real aReal)
 Returns the exponent in base 2 of a floating-point number. More...
 
static Standard_Real GetMantissa (const Standard_Real aReal)
 Returns the mantissa of a floating-point number. More...
 
static void ControlBreak ()
 since Windows NT does not support 'SIGINT' signal like UNIX, then this method checks whether Ctrl-Break keystroke was or not. If yes then raises Exception_CTRL_BREAK. More...
 

Detailed Description

Set of Operating Sytem Dependent Tools (O)perating (S)ystem (D)ependent.

Member Function Documentation

static Standard_Integer OSD::AvailableMemory ( )
static

Returns available memory in Kilobytes.

static void OSD::ControlBreak ( )
static

since Windows NT does not support 'SIGINT' signal like UNIX, then this method checks whether Ctrl-Break keystroke was or not. If yes then raises Exception_CTRL_BREAK.

static Standard_Boolean OSD::CStringToReal ( const Standard_CString  aString,
Standard_Real aReal 
)
static

Converts aCstring representing a real with a period as decimal point, no thousand separator and no grouping of digits into aReal . The conversion is independant from the current locale.

static Standard_Integer OSD::GetExponent ( const Standard_Real  aReal)
static

Returns the exponent in base 2 of a floating-point number.

static Standard_Real OSD::GetMantissa ( const Standard_Real  aReal)
static

Returns the mantissa of a floating-point number.

static Standard_Boolean OSD::IsDivisible ( const Standard_Real  aDividend,
const Standard_Real  aDivisor 
)
static

Tests if the quotient theDividend/theDivisor does not overflow.

static void OSD::MilliSecSleep ( const Standard_Integer  aDelay)
static

Commands the process to sleep for a number of milliseconds.

static Standard_Boolean OSD::RealToCString ( const Standard_Real  aReal,
Standard_PCharacter aString 
)
static

Converts aReal into aCstring in exponential format with a period as decimal point, no thousand separator and no grouping of digits. The conversion is independant from the current locale.

static void OSD::SecSleep ( const Standard_Integer  aDelay)
static

Commands the process to sleep for a number of seconds.

static void OSD::SetSignal ( const Standard_Boolean  theFloatingSignal = Standard_True)
static

A tool to manage threads.

Sets signal and exception handlers. Windows-specific notes< > Compiled with MS VC++ sets 3 main handlers:

  • Signal handlers (via ::signal() functions) that translate system signals (SIGSEGV, SIGFPE, SIGILL) into C++ exceptions (classes inheriting Standard_Failure). They only be called if user calls ::raise() function with one of supported signal type set.
  • Exception handler OSD::WntHandler() (via ::SetUnhandledExceptionFilter()) that will be used when user's code is compiled with /EHs option.
  • Structured exception (SE) translator (via _set_se_translator()) that translates SE exceptions (aka asynchronous exceptions) into the C++ exceptions inheriting Standard_Failure. This translator will be used when user's code is compiled with /EHa option.

This approach ensures that regardless of the option the user chooses to compile his code with (/EHs or /EHa), signals (or SE exceptions) will be translated into Open CASCADE C++ exceptions.

If theFloatingSignal is TRUE then floating point exceptions will be generated in accordance with the mask _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW<> that is used to call ::_controlfp() system function. If theFloatingSignal is FALSE corresponding operations (e.g. division by zero) will gracefully complete without an exception.

Unix-specific notes< > OSD::SetSignal() sets handlers (via ::sigaction()) for multiple signals (SIGFPE, SIGSEGV, etc). Currently the number of handled signals is much greater than for Windows, in the future this may change to provide better consistency with Windows.

theFloatingSignal is recognized on Sun Solaris, Linux, and SGI Irix to generate floating-point exception according to the mask FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW (in Linux conventions).
When compiled with OBJS macro defined, already set signal handlers (e.g. by Data Base Managers) are not redefined.

Common notes< > If OSD::SetSignal() method is used in at least one thread, it must also be called in any other thread where Open CASCADE will be used, to ensure consistency of behavior. Its aFloatingSignal argument must be consistent across threads.

Keep in mind that whether the C++ exception will really be thrown (i.e. ::throw() will be called) is regulated by the NO_CXX_EXCEPTIONS and OCC_CONVERT_SIGNALS macros used during compilation of Open CASCADE and user's code. Refer to Foundation Classes User's Guide for further details.


The documentation for this class was generated from the following file: