]> git.donarmstrong.com Git - bamtools.git/blob - src/api/internal/utils/BamException_p.h
Organized api/internal into subdirs
[bamtools.git] / src / api / internal / utils / BamException_p.h
1 // ***************************************************************************
2 // BamException_p.h (c) 2011 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 6 October 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides a basic exception class for BamTools internals
8 // ***************************************************************************
9
10 #ifndef BAMEXCEPTION_P_H
11 #define BAMEXCEPTION_P_H
12
13 //  -------------
14 //  W A R N I N G
15 //  -------------
16 //
17 // This file is not part of the BamTools API.  It exists purely as an
18 // implementation detail. This header file may change from version to version
19 // without notice, or even be removed.
20 //
21 // We mean it.
22
23 #include <exception>
24 #include <string>
25
26 namespace BamTools {
27 namespace Internal {
28
29 class BamException : public std::exception {
30
31     public:
32         inline BamException(const std::string& where, const std::string& message)
33             : std::exception()
34             , m_errorString(where + SEPARATOR + message)
35         { }
36
37         inline ~BamException(void) throw() { }
38
39         inline const char* what(void) const throw() {
40             return m_errorString.c_str();
41         }
42
43     private:
44         std::string m_errorString;
45         static const std::string SEPARATOR;
46 };
47
48 } // namespace Internal
49 } // namespace BamTools
50
51 #endif // BAMEXCEPTION_P_H