CoreLinux++  0.4.32
Public Types | Public Member Functions | Protected Member Functions | List of all members
corelinux::Exception Class Reference

Exception is the base exception class used in the CoreLinux++ libraries. More...

#include <Exception.hpp>

Public Types

enum  Severity {
  CONTINUABLE = 1, THREADFATAL, PROCESSFATAL, THREADTERMINATE,
  PROCESSTERMINATE
}
 Exception Severity States. More...
 

Public Member Functions

 Exception (CharCptr why, CharCptr file, LineNum line, Severity severity=Exception::CONTINUABLE, bool outOfMemory=false)
 Default Constructor. More...
 
 Exception (ExceptionCref crOther)
 Copy constructor. More...
 
virtual ~Exception (void)
 Virtual Destructor.
 
ExceptionRef operator= (ExceptionCref otherRef)
 Assignment operator overload. More...
 
bool operator== (ExceptionCref otherRef)
 Comparisson operator overload. More...
 
const std::string & getFile (void) const
 Accessor. More...
 
LineNumCref getLine (void) const
 Accessor. More...
 
const std::string & getWhy (void) const
 Accessor. More...
 
const SeveritygetSeverity (void) const
 Accessor. More...
 
const std::string & getUnwind (void) const
 Accessor. More...
 
bool isOutOfMemory (void) const
 Accessor. More...
 
void addUnwindInfo (CharCptr unwindInfo)
 Append unwind information to the Exception. More...
 
void setThreadFatalSeverity (void)
 Change the severity to Severity::THREADFATAL.
 
void setProcessFatalSeverity (void)
 Change the severity to Severity::PROCESSFATAL.
 
void setThreadTerminateSeverity (void)
 Change the severity to Severity::THREADTERMINATE. More...
 
void setProcessTerminateSeverity (void)
 Change the severity to Severity::PROCESSTERMINATE. More...
 

Protected Member Functions

 Exception (void)
 Exceptions must have a reason. More...
 
 Exception (CharCptr file, LineNum line, Severity severity=Exception::CONTINUABLE, bool outOfMemory=false)
 Exception constructor for use by derivations.
 
void setWhy (const std::string &)
 Changes the exception reason.
 
void setWhy (CharCptr)
 Changes the exception reason.
 

Detailed Description

Exception is the base exception class used in the CoreLinux++ libraries.

It is provided to support a rich base from which domain Exceptions may derive.

Member Enumeration Documentation

Exception Severity States.

Enumerator
THREADFATAL 

System can continue processing.

PROCESSFATAL 

Exception may prove to be thread fatal.

THREADTERMINATE 

Exception may prove to be process fatal.

PROCESSTERMINATE 

System should kill thread.

System should exit

Constructor & Destructor Documentation

corelinux::Exception::Exception ( CharCptr  why,
CharCptr  file,
LineNum  line,
Exception::Severity  aSeverity = Exception::CONTINUABLE,
bool  outOfMemory = false 
)

Default Constructor.

Parameters
whydescribes why the exception was thrown
fileThe source module throwing the exception
lineThe line of source throwing the exception
severityThe Exception::Severity of the Exception
outOfMemoryAn out of memory indicator
corelinux::Exception::Exception ( ExceptionCref  crOther)

Copy constructor.

Parameters
Exceptionconst reference
corelinux::Exception::Exception ( void  )
protected

Exceptions must have a reason.

Default constructor is not allowed.

Member Function Documentation

void corelinux::Exception::addUnwindInfo ( CharCptr  unwindInfo)

Append unwind information to the Exception.

Clients should use this service to identify themselves and specify any changes to severity.

Referenced by corelinux::CommandFrame::execute(), and corelinux::CommandFrame::executeReverse().

const std::string & corelinux::Exception::getFile ( void  ) const

Accessor.

Returns
Const reference to module name where Exception was thrown

Referenced by operator=().

LineNumCref corelinux::Exception::getLine ( void  ) const

Accessor.

Returns
Const reference to line number in module where Exception was thrown

Referenced by operator=().

const Exception::Severity & corelinux::Exception::getSeverity ( void  ) const

Accessor.

Returns
Const reference to Severity of Exception.

Referenced by operator=().

const std::string & corelinux::Exception::getUnwind ( void  ) const

Accessor.

Returns
Const reference to the unwind stack description.

Referenced by operator=().

const std::string & corelinux::Exception::getWhy ( void  ) const

Accessor.

Returns
Const reference to Exception explanation.

Referenced by operator=().

bool corelinux::Exception::isOutOfMemory ( void  ) const
inline

Accessor.

Returns
true if out of memory exception, false otherwise

Referenced by operator=().

ExceptionRef corelinux::Exception::operator= ( ExceptionCref  otherRef)
bool corelinux::Exception::operator== ( ExceptionCref  otherRef)

Comparisson operator overload.

Parameters
Exceptionconst reference
Returns
true if equal, false otherwise
void corelinux::Exception::setProcessTerminateSeverity ( void  )

Change the severity to Severity::PROCESSTERMINATE.

This is useful to the catcher that the process should exit

References PROCESSTERMINATE.

void corelinux::Exception::setThreadTerminateSeverity ( void  )

Change the severity to Severity::THREADTERMINATE.

This is useful to the catcher that the thread should be cleaned up.

References THREADTERMINATE.


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

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium