MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Utility class used by InstructionQueue SIGFPE option. More...
#include <MsqFPE.hpp>
Public Member Functions | |
MsqFPE (bool enabled) | |
Set FPE state. | |
~MsqFPE () | |
Restore FPE state. | |
Static Public Member Functions | |
static bool | fpe_trap_supported () |
Check if FPE state manipulation is supported on this platform. | |
static int | get_current_fpe_state () |
static void | set_current_fpe_state (int state) |
static void | enable_trap_fpe () |
Private Member Functions | |
void * | operator new (size_t) |
dummy declaration preventing heap allocation | |
MsqFPE (const MsqFPE &) | |
dummy declaration preventing default copy constructor | |
MsqFPE & | operator= (const MsqFPE &) |
dummy declaration preventing default assignment operator | |
Private Attributes | |
bool | isEnabled |
int | prevState |
Utility class used by InstructionQueue SIGFPE option.
This is a simple utility class for enabling floating point exceptions. It provides two functionalities. The first, implemented in the static methods, is a platform-independent mechanism for modifying the the FPE state. The second, implemented in the constructor/destructor, is a utlity for setting and resetting the FPE state. The FPE state is set when the object is created and reset when the object is destroted. The intention is that an instance of this object be declared on the stack such that when the instantiating function returns, the destructor is automatically invoked, restoring the original state.
Definition at line 50 of file MsqFPE.hpp.
MBMesquite::MsqFPE::MsqFPE | ( | bool | enabled | ) |
Set FPE state.
If enabled == true
, floating point exceptions are enabled by the constructor and reset by the destructor. If enabled == false
, nothing is done.
Definition at line 138 of file MsqFPE.cpp.
References enable_trap_fpe(), get_current_fpe_state(), isEnabled, and prevState.
: isEnabled( enabled ) { if( isEnabled ) { prevState = get_current_fpe_state(); enable_trap_fpe(); } }
Restore FPE state.
Definition at line 147 of file MsqFPE.cpp.
{ if( isEnabled ) { set_current_fpe_state( prevState ); } }
MBMesquite::MsqFPE::MsqFPE | ( | const MsqFPE & | ) | [private] |
dummy declaration preventing default copy constructor
void MBMesquite::MsqFPE::enable_trap_fpe | ( | ) | [static] |
Definition at line 134 of file MsqFPE.cpp.
Referenced by MsqFPE().
{}
bool MBMesquite::MsqFPE::fpe_trap_supported | ( | ) | [static] |
Check if FPE state manipulation is supported on this platform.
Definition at line 122 of file MsqFPE.cpp.
{ return false; }
int MBMesquite::MsqFPE::get_current_fpe_state | ( | ) | [static] |
Definition at line 127 of file MsqFPE.cpp.
Referenced by MsqFPE().
{
return 0;
}
void* MBMesquite::MsqFPE::operator new | ( | size_t | ) | [private] |
dummy declaration preventing heap allocation
dummy declaration preventing default assignment operator
void MBMesquite::MsqFPE::set_current_fpe_state | ( | int | state | ) | [static] |
bool MBMesquite::MsqFPE::isEnabled [private] |
Saved constructor argument for use in destructor
Definition at line 82 of file MsqFPE.hpp.
Referenced by MsqFPE().
int MBMesquite::MsqFPE::prevState [private] |
Saved FPE state for use in destructor
Definition at line 84 of file MsqFPE.hpp.
Referenced by MsqFPE().