Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MsqFPE Class Reference

Utility class used by InstructionQueue SIGFPE option. More...

#include <MsqFPE.hpp>

Public Member Functions

 MsqFPE (bool enabled)
 Set FPE state. More...
 
 ~MsqFPE ()
 Restore FPE state. More...
 
 MsqFPE (bool enabled)
 Set FPE state. More...
 
 ~MsqFPE ()
 Restore FPE state. More...
 

Static Public Member Functions

static bool fpe_trap_supported ()
 Check if FPE state manipulation is supported on this platform. More...
 
static int get_current_fpe_state ()
 
static void set_current_fpe_state (int state)
 
static void enable_trap_fpe ()
 
static bool fpe_trap_supported ()
 Check if FPE state manipulation is supported on this platform. More...
 
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 More...
 
 MsqFPE (const MsqFPE &)
 dummy declaration preventing default copy constructor More...
 
MsqFPEoperator= (const MsqFPE &)
 dummy declaration preventing default assignment operator More...
 
void * operator new (size_t)
 dummy declaration preventing heap allocation More...
 
 MsqFPE (const MsqFPE &)
 dummy declaration preventing default copy constructor More...
 
MsqFPEoperator= (const MsqFPE &)
 dummy declaration preventing default assignment operator More...
 

Private Attributes

bool isEnabled
 Saved constructor argument for use in destructor. More...
 
int prevState
 Saved FPE state for use in destructor. More...
 

Detailed Description

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 48 of file includeLinks/MsqFPE.hpp.

Constructor & Destructor Documentation

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 133 of file Misc/MsqFPE.cpp.

References MsqFPE::enable_trap_fpe(), MsqFPE::get_current_fpe_state(), MsqFPE::isEnabled, and MsqFPE::prevState.

133  : isEnabled( enabled )
134 {
135  if (isEnabled)
136  {
138  enable_trap_fpe();
139  }
140 }
static void enable_trap_fpe()
bool isEnabled
Saved constructor argument for use in destructor.
int prevState
Saved FPE state for use in destructor.
static int get_current_fpe_state()

Here is the call graph for this function:

~MsqFPE ( )

Restore FPE state.

Definition at line 142 of file Misc/MsqFPE.cpp.

143 {
144  if (isEnabled)
145  {
147  }
148 }
bool isEnabled
Saved constructor argument for use in destructor.
static void set_current_fpe_state(int state)
int prevState
Saved FPE state for use in destructor.
MsqFPE ( const MsqFPE )
private

dummy declaration preventing default copy constructor

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.

~MsqFPE ( )

Restore FPE state.

MsqFPE ( const MsqFPE )
private

dummy declaration preventing default copy constructor

Member Function Documentation

void enable_trap_fpe ( )
static
Returns
Enable trapping of INVALID, DIVBYZERO, and OVERFLOW

Definition at line 125 of file Misc/MsqFPE.cpp.

Referenced by MsqFPE::MsqFPE().

126  { }

Here is the caller graph for this function:

static void enable_trap_fpe ( )
static
Returns
Enable trapping of INVALID, DIVBYZERO, and OVERFLOW
bool fpe_trap_supported ( )
static

Check if FPE state manipulation is supported on this platform.

Definition at line 116 of file Misc/MsqFPE.cpp.

117  { return false; }
static bool fpe_trap_supported ( )
static

Check if FPE state manipulation is supported on this platform.

int get_current_fpe_state ( )
static
Returns
An integer representing the current FPE flags

Definition at line 119 of file Misc/MsqFPE.cpp.

Referenced by MsqFPE::MsqFPE().

120  { return 0; }

Here is the caller graph for this function:

static int get_current_fpe_state ( )
static
Returns
An integer representing the current FPE flags
void* operator new ( size_t  )
private

dummy declaration preventing heap allocation

void* operator new ( size_t  )
private

dummy declaration preventing heap allocation

MsqFPE& operator= ( const MsqFPE )
private

dummy declaration preventing default assignment operator

MsqFPE& operator= ( const MsqFPE )
private

dummy declaration preventing default assignment operator

static void set_current_fpe_state ( int  state)
static
Returns
Set the FPE flags on the processor
void set_current_fpe_state ( int  state)
static
Returns
Set the FPE flags on the processor

Definition at line 122 of file Misc/MsqFPE.cpp.

123  { }

Member Data Documentation

bool isEnabled
private

Saved constructor argument for use in destructor.

Definition at line 82 of file includeLinks/MsqFPE.hpp.

Referenced by MsqFPE::MsqFPE().

int prevState
private

Saved FPE state for use in destructor.

Definition at line 84 of file includeLinks/MsqFPE.hpp.

Referenced by MsqFPE::MsqFPE().


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