GEOSX
Classes | Functions
LvArray::system Namespace Reference

Contains functions that interact with the system or runtime environment. More...

Classes

class  FloatingPointExceptionGuard
 Changes the floating point environment and reverts it when destoyed. More...
 

Functions

std::string stackTrace (bool const lineInfo)
 Return a demangled stack trace of the last 25 frames. More...
 
std::string demangle (char const *const name)
 
template<class T >
std::string demangleType ()
 
template<class T >
std::string demangleType (T const &)
 
void setErrorHandler (std::function< void() > const &handler)
 Set the error handler called by LVARRAY_ERROR and others. More...
 
void callErrorHandler ()
 Call the error handler, by default this is std::abort.
 
void stackTraceHandler (int const sig, bool const exit)
 Print signal information and a stack trace to standard out, optionally aborting. More...
 
void setSignalHandling (void(*handler)(int))
 Set the signal handler for common signals. More...
 
void resetSignalHandling ()
 Rest the signal handling back to the original state.
 
int getDefaultFloatingPointExceptions ()
 Get the default set of exceptions to check. More...
 
int enableFloatingPointExceptions (int const exceptions=getDefaultFloatingPointExceptions())
 A wrapper around feenableexcept that work on OSX. More...
 
int disableFloatingPointExceptions (int const exceptions=getDefaultFloatingPointExceptions())
 A wrapper around fedisableexcept that work on OSX. More...
 
void setFPE ()
 Sets the floating point environment. More...
 
std::string calculateSize (size_t const bytes)
 

Detailed Description

Contains functions that interact with the system or runtime environment.

Function Documentation

◆ calculateSize()

std::string LvArray::system::calculateSize ( size_t const  bytes)
Returns
A string representing bytes converted to either KB, MB, or GB.
Parameters
bytesThe number of bytes.

◆ demangle()

std::string LvArray::system::demangle ( char const *const  name)
Returns
The demangled name corresponding to the given mangled name name.
Parameters
nameThe mangled name.

◆ demangleType() [1/2]

template<class T >
std::string LvArray::system::demangleType ( )
inline
Returns
A demangled type name corresponding to the type
Template Parameters
T.
TThe type to demangle.

Definition at line 50 of file system.hpp.

◆ demangleType() [2/2]

template<class T >
std::string LvArray::system::demangleType ( T const &  )
inline
Returns
A demangled type name corresponding to the type
Template Parameters
T.
TThe type to demangle.

Definition at line 58 of file system.hpp.

◆ disableFloatingPointExceptions()

int LvArray::system::disableFloatingPointExceptions ( int const  exceptions = getDefaultFloatingPointExceptions())

A wrapper around fedisableexcept that work on OSX.

Parameters
exceptionsThe set of floating point exceptions to disable.
Returns
The old exception mask or -1 if there was an error.

◆ enableFloatingPointExceptions()

int LvArray::system::enableFloatingPointExceptions ( int const  exceptions = getDefaultFloatingPointExceptions())

A wrapper around feenableexcept that work on OSX.

Parameters
exceptionsThe set of floating point exceptions to enable.
Returns
The old exception mask or -1 if there was an error.

◆ getDefaultFloatingPointExceptions()

int LvArray::system::getDefaultFloatingPointExceptions ( )

Get the default set of exceptions to check.

Returns
The default set of exceptions.

◆ setErrorHandler()

void LvArray::system::setErrorHandler ( std::function< void() > const &  handler)

Set the error handler called by LVARRAY_ERROR and others.

Parameters
handlerThe error handler.
Note
By default the error handler is std::abort.

◆ setFPE()

void LvArray::system::setFPE ( )

Sets the floating point environment.

Sets the floating point environment such that FE_DIVBYZERO, FE_OVERFLOW or FE_INVALID throw exceptions. Denormal numbers are flushed to zero.

◆ setSignalHandling()

void LvArray::system::setSignalHandling ( void(*)(int)  handler)

Set the signal handler for common signals.

Parameters
handlerThe signal handler.

◆ stackTrace()

std::string LvArray::system::stackTrace ( bool const  lineInfo)

Return a demangled stack trace of the last 25 frames.

Parameters
lineInfoIf true then file and line numbers will be added to the trace if available. This is only supported if LVARRAY_ADDR2LINE_EXEC is defined and normally only works in debug builds.
Returns
A demangled stack trace of the last 25 frames.

◆ stackTraceHandler()

void LvArray::system::stackTraceHandler ( int const  sig,
bool const  exit 
)

Print signal information and a stack trace to standard out, optionally aborting.

Parameters
sigThe signal received.
exitIf true abort execution.