pcl::Win32Exception Class Reference

A Win32 structured exception handler that throws C++ exceptions. More...

#include <Win32Exception.h>

+ Inheritance diagram for pcl::Win32Exception:

Public Types

typedef const void * exception_address
typedef unsigned exception_code
typedef const void * exception_data_pointer

Public Member Functions

 Win32Exception (exception_code code, exception_data_pointer data, const IsoString &details=IsoString())
 Win32Exception (const Win32Exception &)=default
String Caption () const override
const IsoStringDetails () const
exception_address ExceptionAddress () const
exception_code ExceptionCode () const
String FormatInfo () const override
String Message () const override
void Show () const override
- Public Member Functions inherited from pcl::Exception
 Exception ()=default
 Exception (const pcl::Exception &)=default
virtual ~Exception ()
virtual String ExceptionClass () const
PCL_FORCE_INLINE void ShowOnConsole () const

Static Public Member Functions

static void Initialize ()
- Static Public Member Functions inherited from pcl::Exception
static void DisableConsoleOutput (bool disable=true)
static void DisableGUIOutput (bool disable=true)
static void EnableConsoleOutput (bool=true)
static void EnableGUIOutput (bool=true)
static bool IsConsoleOutputEnabled ()
static bool IsGUIOutputEnabled ()

Detailed Description

This class can only be used on Microsoft Windows platforms. On the rest of supported platforms, including this header file from compilable code raises a compiler error.

For this handler to work properly, all code that may raise asynchronous (structured) exceptions must be compiled with the '-EHa' Visual C/C++ compiler option. Otherwise no asynchronous exception thrown in a try{} block will be caught by the corresponding catch{} block, and the program will terminate.

Definition at line 84 of file Win32Exception.h.

Member Typedef Documentation

◆ exception_address

Represents a memory address associated with an exception. For example, the address that has been accessed to cause an access violation error.

Definition at line 92 of file Win32Exception.h.

◆ exception_code

The type of an exception error code.

Definition at line 103 of file Win32Exception.h.

◆ exception_data_pointer

Represents a pointer to a data block that describes an exception. This is an opaque pointer to an EXCEPTION_RECORD structure.

Definition at line 98 of file Win32Exception.h.

Constructor & Destructor Documentation

◆ Win32Exception() [1/2]

pcl::Win32Exception::Win32Exception ( exception_code  code,
exception_data_pointer  data,
const IsoString details = IsoString() 

Constructs a new Win32Exception object with the specified exception code and data, plus optional backtrace information details.

Definition at line 109 of file Win32Exception.h.

◆ Win32Exception() [2/2]

pcl::Win32Exception::Win32Exception ( const Win32Exception )

Copy constructor.

Member Function Documentation

◆ Caption()

String pcl::Win32Exception::Caption ( ) const

Returns the type of this exception, intended to be used as a caption for a message box. As reimplemented in this class, this member function returns the string "PCL Win32 System Exception".

Reimplemented from pcl::Exception.

Definition at line 177 of file Win32Exception.h.

◆ Details()

const IsoString& pcl::Win32Exception::Details ( ) const

Returns the backtrace information associated with this exception.

The returned string will be empty if no backtrace data were available at the time this exception was generated.

Definition at line 141 of file Win32Exception.h.

◆ ExceptionAddress()

exception_address pcl::Win32Exception::ExceptionAddress ( ) const

Returns the memory address associated with this exception.

◆ ExceptionCode()

exception_code pcl::Win32Exception::ExceptionCode ( ) const

Returns the error code of this exception.

Definition at line 130 of file Win32Exception.h.

◆ FormatInfo()

String pcl::Win32Exception::FormatInfo ( ) const

Returns a formatted error message with information on this exception.

Reimplemented from pcl::Exception.

Definition at line 160 of file Win32Exception.h.

◆ Initialize()

static void pcl::Win32Exception::Initialize ( )

Initializes the structured exception handler. This static member function must be called before the calling process can raise any system exception.

A module should never call this member function. It is invoked when appropriate by the PixInsight core application and internal PCL routines.

◆ Message()

String pcl::Win32Exception::Message ( ) const

Returns an error or warning message corresponding to this exception. For example, some typical messages are "access violation", "stack overflow" and "illegal instruction", returned by specific derived classes.

Reimplemented from pcl::Exception.

Definition at line 152 of file Win32Exception.h.

◆ Show()

void pcl::Win32Exception::Show ( ) const

Writes a formatted representation of this exception on the platform console. A plain text version of the same textual representation will also be written on stdout; however, if there is no console currently attached to the process (which is the typical situation for GUI Windows applications), no console stream output will be generated.

Asynchronous exceptions are never reported on interactive graphical interfaces, such as message boxes, irrespective of global platform settings or local settings defined through calls to EnableGUIOutput() and similar functions.

Reimplemented from pcl::Exception.

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