rambrain
exceptions.h
Go to the documentation of this file.
1 /* rambrain - a dynamical physical memory extender
2  * Copyright (C) 2015 M. Imgrund, A. Arth
3  * mimgrund (at) mpifr-bonn.mpg.de
4  * arth (at) usm.uni-muenchen.de
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef EXCEPTIONS_H
21 #define EXCEPTIONS_H
22 
23 #include <exception>
24 #include <string>
25 
26 using namespace std;
27 
28 namespace rambrain
29 {
30 
38 class rambrainException : exception
39 {
40 
41 public:
45  virtual ~rambrainException() {}
46 };
47 
48 
55 {
56 
57 public:
62  incompleteSetupException ( const string &details ) : details ( details ) {}
67 
72  inline virtual const char *what() const throw() {
73  return ( string ( "Incomplete setup of objects: " ) + details ).c_str();
74  }
75 
76 private:
77  string details;
78 
79 };
80 
81 
88 {
89 
90 public:
95  memoryException ( const string &details ) : details ( details ) {}
99  virtual ~memoryException() {}
100 
105  inline virtual const char *what() const throw() {
106  return ( string ( "Memory exception: " ) + details ).c_str();
107  }
108 
109 private:
110  string details;
111 
112 };
113 
114 
119 {
120 
121 public:
126  unexpectedStateException ( const string &details ) : details ( details ) {}
131 
136  inline virtual const char *what() const throw() {
137  return ( string ( "Unexpected state detected: " ) + details ).c_str();
138  }
139 
140 private:
141  string details;
142 
143 };
144 
145 
152 {
153 
154 public:
159  unfinishedCodeException ( const string &details ) : details ( details ) {}
164 
169  inline virtual const char *what() const throw() {
170  return ( string ( "Unfinished code section encountered: " ) + details ).c_str();
171  }
172 
173 private:
174  string details;
175 
176 };
177 
178 }
179 
180 #endif // EXCEPTIONS_H
181 
memoryException(const string &details)
Create a new exception.
Definition: exceptions.h:95
Exception for errors with the memory.
Definition: exceptions.h:87
An exception class for when code is used which is not fully finished developping. ...
Definition: exceptions.h:151
virtual ~rambrainException()
Destroy the exception.
Definition: exceptions.h:45
Exception class for cases of an incomplete setup.
Definition: exceptions.h:54
Exception base class for this library.
Definition: exceptions.h:38
incompleteSetupException(const string &details)
Create a new exception.
Definition: exceptions.h:62
virtual ~incompleteSetupException()
Destroy the exception.
Definition: exceptions.h:66
An exception for when something totally unexpected happened.
Definition: exceptions.h:118
virtual const char * what() const
Report what has gone wrong.
Definition: exceptions.h:169
virtual const char * what() const
Report what has gone wrong.
Definition: exceptions.h:72
virtual ~memoryException()
Destroy the exception.
Definition: exceptions.h:99
virtual ~unexpectedStateException()
Destroy the exception.
Definition: exceptions.h:130
unexpectedStateException(const string &details)
Create a new exception.
Definition: exceptions.h:126
STL namespace.
virtual const char * what() const
Report what has gone wrong.
Definition: exceptions.h:136
unfinishedCodeException(const string &details)
Create a new exception.
Definition: exceptions.h:159
virtual const char * what() const
Report what has gone wrong.
Definition: exceptions.h:105
virtual ~unfinishedCodeException()
Destroy the exception.
Definition: exceptions.h:163