Program exit exception class. More...
#include <cmtkExitException.h>
Public Member Functions | |
ExitException (const int exitCode=0) | |
Constructor. | |
virtual | ~ExitException () throw () |
Virtual destructor. | |
virtual const char * | what () const throw () |
Overwrite inherited "what" member. | |
int | ExitCode () const |
Return exit code. | |
Private Attributes | |
const int | m_ExitCode |
Program exit code. |
Program exit exception class.
Throwing an object of this class should return control to the global main() function, which should exit() with the given exit status. This should ensure that all local automatic as well as global static objects have their destructors called.
The global main() function can make use of this exception via the following wrapper construct,
int main( const int argc, const char* argv[] ) { int exitCode = 0; try { exitCode = doMain( argc, argv ); } catch ( const cmtk::ExitException& ex ) { exitCode = ex.ExitCode(); } return exitCode; } *
where the actual function of the program is moved into the doMain() implementation function.
Definition at line 76 of file cmtkExitException.h.
cmtk::ExitException::ExitException | ( | const int | exitCode = 0 ) |
[inline] |
Constructor.
exitCode | Program exit code. |
Definition at line 83 of file cmtkExitException.h.
virtual cmtk::ExitException::~ExitException | ( | ) | throw () [inline, virtual] |
Virtual destructor.
Definition at line 86 of file cmtkExitException.h.
int cmtk::ExitException::ExitCode | ( | ) | const [inline] |
Return exit code.
Definition at line 95 of file cmtkExitException.h.
virtual const char* cmtk::ExitException::what | ( | ) | const throw () [inline, virtual] |
Overwrite inherited "what" member.
Definition at line 89 of file cmtkExitException.h.
const int cmtk::ExitException::m_ExitCode [private] |
Program exit code.
Definition at line 102 of file cmtkExitException.h.