corelinux::Assertion Class Reference

Assertion is-a Exception created when an assertion fails. More...

`#include <Assertion.hpp>`

## Public Types

enum | Type { REQUIRE, ENSURE, CHECK, ASSERT, NEVERGETHERE }
| Assertion Types enum. More...
Public Types inherited from corelinux::Exception
enum | Severity { CONTINUABLE = 1, THREADFATAL, PROCESSFATAL, THREADTERMINATE, PROCESSTERMINATE }
| Exception Severity States. More...

## Public Member Functions

| Assertion (Type aType, CharPtr aReason, CharPtr aFile, LineNum aLine)
| Assertion Constructor. More...
| Assertion (AssertionCref rExcept)
| Assertion copy constructor. More...
virtual | ~Assertion (void)
| Virtual Destructor.
AssertionRef | operator= (AssertionCref)
| Assignment operator overload. More...
bool | operator== (AssertionCref)
| Comparisson operator overload. More...
Assertion::Type | getType (void) const
| Accessor. More...
Public Member Functions inherited from corelinux::Exception
| 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 Severity & | getSeverity (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...

## Additional Inherited Members

Protected Member Functions inherited from corelinux::Exception
| 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

Assertion is-a Exception created when an assertion fails.

It contains type information so that clients may filter the types of assertion violations that they catch. There are several types of assertion macros defined. Refer to the comments at the top of Assertion.hpp for details.

## Member Enumeration Documentation

enum corelinux::Assertion::Type

Assertion Types enum.

Enumerator
ENSURE | REQUIRE pre-condition state.
CHECK | ENSURE post-condition state.
ASSERT | CHECK invariant state.
NEVERGETHERE | ASSERT invariant state. NEVERGETHERE logic state

## Constructor & Destructor Documentation

corelinux::Assertion::Assertion | ( | Assertion::Type | aType,
|  | CharPtr | aReason,
|  | CharPtr | aFile,
|  | LineNum | aLine
| ) |  |

Assertion Constructor.

Parameters

  Type | Specifies the state condition for the assertion
  Reason | Text describing the assertion
  File | The source module the assertion was thrown from
  Line | The throw point line in the source module

corelinux::Assertion::Assertion | ( | AssertionCref | rExcept | ) |

Assertion copy constructor.

Parameters

  Assertion | const reference

## Member Function Documentation

Assertion::Type corelinux::Assertion::getType | ( | void |  | ) | const

Accessor.

Returns
  The Type which caused the assertion

Referenced by operator=().

AssertionRef corelinux::Assertion::operator= | ( | AssertionCref | aAssertion | ) |

Assignment operator overload.

Parameters

  Assertion | const reference

Returns
  Assertion reference to self

References getType(), and corelinux::Exception::operator=().

bool corelinux::Assertion::operator== | ( | AssertionCref |  | ) |

Comparisson operator overload.

Parameters

  Assertion | const reference

Returns
  true if equal, false otherwise

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

- Assertion.hpp
- Assertion.cpp

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