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 94 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 92 of file Matrix.cpp.

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

The copy constructor.

Definition at line 135 of file Matrix.cpp.

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

The destuctor.

Definition at line 104 of file Matrix.h.


Member Function Documentation

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

Return a copy of the exception message.

Definition at line 141 of file Matrix.cpp.

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

Overload the casting operator to a string.

Definition at line 146 of file Matrix.cpp.


Field Documentation

std::string Zenautics::MatrixException::m_ExceptionString

The matrix exception string.

Definition at line 114 of file Matrix.h.


The documentation for this class was generated from the following files:
Generated on Sun Feb 8 15:31:11 2009 for The Zenautics Matrix Project by  doxygen 1.5.4