MeVisLab Toolbox Reference
DCMTree_Exception.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef DCM_TREE_EXCEPTION_H
14 #define DCM_TREE_EXCEPTION_H
15 
16 // Include basics and also string.
17 #include "DCMTree_Lib.h"
18 #include "DCMTree_Defines.h"
19 
20 #include <memory>
21 
22 namespace DCMTree
23 {
26  {
27  public:
28  Exception() = default;
29 
30  virtual ~Exception();
31 
33  Exception (const std::string &method);
34 
39  Exception (const std::string &method,const std::string &description);
40 
45  Exception (const Exception &cause,const std::string &method);
46 
52  Exception (const Exception &cause,const std::string &method,const std::string &description);
53 
57  const std::string &method() const;
58 
62  const std::string &description() const;
63 
67  std::shared_ptr<const Exception> cause() const;
68 
72  std::string toString() const;
73 
74  private:
75  std::string _method;
76  std::string _description;
77  std::shared_ptr<const Exception> _cause;
78  };
79 }
80 
81 #endif
82 
83 
#define DCMTREE_EXPORT
Exception class for DCMTree.
std::string toString() const
convert this exception including the traced ones to a string
std::shared_ptr< const Exception > cause() const
get the cause of this exception
Exception(const std::string &method, const std::string &description)
ctor sets method to the given value sets description to the given value
const std::string & description() const
get the description of the reason for the exception
const std::string & method() const
get the method value (method where the exception has been thrown)
Exception(const Exception &cause, const std::string &method, const std::string &description)
sets method and description remembers the cause can be used for an exception-traces
virtual ~Exception()
Exception(const Exception &cause, const std::string &method)
sets method and remembers the cause can be used for an exception-traces
Exception(const std::string &method)
ctor - sets method to the given value
class to dump a DCMTree dicom message into a human readable file this class could be used as a starte...