Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkException.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkException.h"
18 
19 void mitk::Exception::AddRethrowData(const char *file, unsigned int lineNumber, const char *message)
20 {
21  mitk::Exception::ReThrowData data = {file, lineNumber, message};
22  this->m_RethrowData.push_back(data);
23 }
24 
26 {
27  return (int)m_RethrowData.size();
28 }
29 
30 void mitk::Exception::GetRethrowData(int rethrowNumber, std::string &file, int &line, std::string &message)
31 {
32  if ((rethrowNumber >= (int)m_RethrowData.size()) || (rethrowNumber < 0))
33  {
34  file = "";
35  line = 0;
36  message = "";
37  return;
38  }
39 
40  file = m_RethrowData.at(rethrowNumber).RethrowClassname;
41  line = m_RethrowData.at(rethrowNumber).RethrowLine;
42  message = m_RethrowData.at(rethrowNumber).RethrowMessage;
43 }
44 
45 std::ostream &mitk::operator<<(std::ostream &os, const mitk::Exception &e)
46 {
47  os << e.GetDescription();
48  return os;
49 }
static char * line
Definition: svm.cpp:2884
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
void AddRethrowData(const char *file, unsigned int lineNumber, const char *message)
Adds rethrow data to this exception.
std::vector< ReThrowData > m_RethrowData
void GetRethrowData(int rethrowNumber, std::string &file, int &line, std::string &message)
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
Definition: mitkException.h:49