Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::Exception Class Reference

An object of this class represents an exception of MITK. Please don't instantiate exceptions manually, but use the exception macros (file mitkExceptionMacro.h) instead. Simple use in your code is: More...

#include <mitkException.h>

Inheritance diagram for mitk::Exception:
Collaboration diagram for mitk::Exception:

Classes

struct  ReThrowData
 

Public Member Functions

 Exception (const char *file, unsigned int lineNumber=0, const char *desc="None", const char *loc="Unknown")
 
virtual ~Exception () throw ()
 
virtual const char * GetClassName () const
 
void AddRethrowData (const char *file, unsigned int lineNumber, const char *message)
 Adds rethrow data to this exception. More...
 
int GetNumberOfRethrows ()
 
void GetRethrowData (int rethrowNumber, std::string &file, int &line, std::string &message)
 
template<class T >
Exceptionoperator<< (const T &data)
 Definition of the bit shift operator for this class. More...
 
template<class T >
Exceptionoperator<< (T &data)
 Definition of the bit shift operator for this class (for non const data). More...
 
Exceptionoperator<< (std::ostream &(*func)(std::ostream &))
 Definition of the bit shift operator for this class (for functions). More...
 

Protected Attributes

std::vector< ReThrowDatam_RethrowData
 

Detailed Description

An object of this class represents an exception of MITK. Please don't instantiate exceptions manually, but use the exception macros (file mitkExceptionMacro.h) instead. Simple use in your code is:

Documentation mitkThrow() << "optional exception message";

You can also define specialized exceptions which must inherit from this class. Please always use the mitkExceptionClassMacro when implementing specialized exceptions. A simple implementation can look like:

class MyException : public mitk::Exception { public: mitkExceptionClassMacro(MyException,mitk::Exception); };

You can then throw your specialized exceptions by using the macro

   mitkThrowException(MyException) << "optional exception message";

Definition at line 49 of file mitkException.h.

Constructor & Destructor Documentation

mitk::Exception::Exception ( const char *  file,
unsigned int  lineNumber = 0,
const char *  desc = "None",
const char *  loc = "Unknown" 
)
inline

Definition at line 52 of file mitkException.h.

virtual mitk::Exception::~Exception ( )
throw (
)
inlinevirtual

Definition at line 57 of file mitkException.h.

Member Function Documentation

void mitk::Exception::AddRethrowData ( const char *  file,
unsigned int  lineNumber,
const char *  message 
)

Adds rethrow data to this exception.

Definition at line 19 of file mitkException.cpp.

References m_RethrowData.

virtual const char* mitk::Exception::GetClassName ( ) const
virtual

Reimplemented in mitk::MemoryIsLockedException.

int mitk::Exception::GetNumberOfRethrows ( )
Returns
Returns how often the exception was rethrown.

Definition at line 25 of file mitkException.cpp.

void mitk::Exception::GetRethrowData ( int  rethrowNumber,
std::string &  file,
int &  line,
std::string &  message 
)
Returns
Returns the rethrow data of the specified rethrow number. Returns empty data, if the rethrowNumber doesn't exist.
Parameters
rethrowNumberThe internal number of the rethrow.
file(returnvalue) This varaiable will be filled with the file of the specified rethrow.
file(returnvalue) This varaiable will be filled with the line of the specified rethrow.
file(returnvalue) This varaiable will be filled with the message of the specified rethrow.

Definition at line 30 of file mitkException.cpp.

template<class T >
Exception& mitk::Exception::operator<< ( const T &  data)
inline

Definition of the bit shift operator for this class.

Definition at line 78 of file mitkException.h.

template<class T >
Exception& mitk::Exception::operator<< ( T &  data)
inline

Definition of the bit shift operator for this class (for non const data).

Definition at line 88 of file mitkException.h.

Exception& mitk::Exception::operator<< ( std::ostream &(*)(std::ostream &)  func)
inline

Definition of the bit shift operator for this class (for functions).

Definition at line 97 of file mitkException.h.

Member Data Documentation

std::vector<ReThrowData> mitk::Exception::m_RethrowData
protected

Definition at line 113 of file mitkException.h.

Referenced by AddRethrowData().


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