Zenautics::MatrixException Class Reference

#include <Matrix.h>


Detailed Description

A class for exceptions thrown by the Matrix class.

The MATRIX_USE_EXCEPTION_HANDLING define enables the use of exception handling using try{} catch{}. A MatrixException is thrown. The use of exception handling is very highly recommended. When it is turned off, the matrix will try to output a message and then call 'exit(1)'.

  int main()
  { 
    try
    {
      Matrix A(2,2);
      double d = A(3,1).real(); // causes an out of bounds exception
    }
    catch( MatrixException& matrix_exception )
    {
      cout << matrix_exception << endl;
    }
    catch ( ... )
    {
      cout << "Caught unknown exception" << endl;
    }
    return 0;
  }

Definition at line 91 of file Matrix.h.


Public Member Functions

 MatrixException (const char *msg)
 The constructor.
 MatrixException (const MatrixException &matrix_exception)
 The copy constructor.
virtual ~MatrixException ()
 The destuctor.
std::string GetExceptionMessage ()
 Return a copy of the exception message.
 operator const char * ()
 Overload the casting operator to a string.

Data Fields

std::string m_ExceptionString
 The matrix exception string.

Constructor & Destructor Documentation

Zenautics::MatrixException::MatrixException ( const char *  msg  ) 

The constructor.

Definition at line 79 of file Matrix.cpp.

Zenautics::MatrixException::MatrixException ( const MatrixException matrix_exception  ) 

The copy constructor.

Definition at line 122 of file Matrix.cpp.

virtual Zenautics::MatrixException::~MatrixException (  )  [inline, virtual]

The destuctor.

Definition at line 101 of file Matrix.h.


Member Function Documentation

std::string Zenautics::MatrixException::GetExceptionMessage (  ) 

Return a copy of the exception message.

Definition at line 128 of file Matrix.cpp.

Zenautics::MatrixException::operator const char * (  ) 

Overload the casting operator to a string.

Definition at line 133 of file Matrix.cpp.


Field Documentation

std::string Zenautics::MatrixException::m_ExceptionString

The matrix exception string.

Definition at line 111 of file Matrix.h.


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