C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
Exception.h
Go to the documentation of this file.
1 // Copyright András Vukics 2006–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
3 #ifndef CPPQEDCORE_UTILS_EXCEPTION_H_INCLUDED
4 #define CPPQEDCORE_UTILS_EXCEPTION_H_INCLUDED
5 
6 #include "ExceptionFwd.h"
7 
8 #include <string>
9 
10 namespace cpputils {
11 
13 
18 struct Exception // : public std::exception
19 {
20  virtual ~Exception() /* throw() */ {}
21 };
22 
23 
25 class TaggedException : public Exception
26 {
27 public:
28  TaggedException(const std::string& tag) : tag_(tag) {}
29 
30  virtual ~TaggedException() /* throw() */ {}
31 
32  const std::string getTag() const {return tag_;}
33 
35  const char* what() const throw() {return tag_.c_str();}
36 
37 private:
38  std::string tag_;
39 
40 };
41 
42 
43 }
44 
45 #endif // CPPQEDCORE_UTILS_EXCEPTION_H_INCLUDED
The class that is (meant to be, at least) the base of all exceptions in the framework.
Definition: Exception.h:18
const char * what() const
Returns the short description.
Definition: Exception.h:35
Namespace comprising otherwise hard-to-classify generic utilities.
Definition: Algorithm.h:10
Class reporting also the “what-ness” of the exception.
Definition: Exception.h:25