libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Exception.hpp
Go to the documentation of this file.
1 #ifndef EXCEPTION_HPP
2 #define EXCEPTION_HPP
3 /*
4 This file is part of AlgAudio.
5 
6 AlgAudio, Copyright (C) 2015 CeTA - Audiovisual Technology Center
7 
8 AlgAudio is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation, either version 3 of the
11 License, or (at your option) any later version.
12 
13 AlgAudio is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with AlgAudio. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include <string>
23 
24 namespace AlgAudio{
25 
26 namespace Exceptions{
27 
29 class Exception{
30 public:
31  Exception(std::string t) : text(t){
32 #ifdef SILLY_GDB
33  // if your GDB cannot break
34  std::cout << "Builtin trap to mark exception creation stack for exception: `" << text << "`" << std::endl;
35  // *((int*)nullptr) = 0;
36  __builtin_trap();
37 #endif // SILLY_GDB
38  }
39  virtual std::string what() {return text;}
40  virtual ~Exception() {}
41 protected:
42  std::string text;
43 };
44 
47 struct Unimplemented : public Exception{
48  Unimplemented(std::string t) : Exception(t){}
49 };
50 
51 } // namespace Exceptions
52 } // namespcae AlgAudio
53 
54 #endif // EXCEPTION_HPP
virtual ~Exception()
Definition: Exception.hpp:40
virtual std::string what()
Definition: Exception.hpp:39
Exception(std::string t)
Definition: Exception.hpp:31
Definition: Exception.hpp:47
Definition: Alertable.hpp:26
std::string text
Definition: Exception.hpp:42
Definition: Exception.hpp:29
Unimplemented(std::string t)
Definition: Exception.hpp:48