dcmtkpp
Exception.h
1 /*************************************************************************
2  * dcmtkpp - Copyright (C) Universite de Strasbourg
3  * Distributed under the terms of the CeCILL-B license, as published by
4  * the CEA-CNRS-INRIA. Refer to the LICENSE file or to
5  * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
6  * for details.
7  ************************************************************************/
8 
9 #ifndef _b9607695_cb3b_4188_8caa_bc8bb051ef28
10 #define _b9607695_cb3b_4188_8caa_bc8bb051ef28
11 
12 #include <exception>
13 #include <string>
14 
15 #include <dcmtk/config/osconfig.h>
16 #include <dcmtk/ofstd/ofcond.h>
17 
18 namespace dcmtkpp
19 {
20 
22 class Exception: public std::exception
23 {
24 public:
29  enum class Source { Message, Condition };
30 
32  Exception(std::string const & message);
33 
35  Exception(OFCondition const & condition);
36 
38  virtual ~Exception() throw();
39 
46  virtual const char* what() const throw();
47 
49  Source get_source() const;
50 
56  OFCondition const & get_condition() const;
57 
58 private:
59  Source _source;
60  std::string _message;
61  OFCondition _condition;
62 };
63 
64 }
65 
66 #endif // _b9607695_cb3b_4188_8caa_bc8bb051ef28
Definition: Association.cpp:22
virtual ~Exception()
Destructor.
Definition: Exception.cpp:34
Source get_source() const
Return the exception source.
Definition: Exception.cpp:55
virtual const char * what() const
Return the reason for the exception.
Definition: Exception.cpp:41
Base class for all DIMSE messages.
Definition: Message.h:72
Base class for dcmtkpp exceptions.
Definition: Exception.h:22
Source
Source of the Exception: either a message string or an OFCondition.
Definition: Exception.h:29
Exception(std::string const &message)
Message string constructor, set the source to Source::Message.
Definition: Exception.cpp:20
OFCondition const & get_condition() const
Return the condition that was used to create this exception.
Definition: Exception.cpp:62