Merge branch 'master' into develop
[jack2.git] / common / JackException.h
blobaa5f409f56a941a3d345990984693f199692e2b6
1 /*
2 Copyright (C) 2008 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __JackException__
21 #define __JackException__
23 #include "JackCompilerDeps.h"
25 #include <stdexcept>
26 #include <iostream>
27 #include <string>
29 namespace Jack
32 #define ThrowIf(inCondition, inException) \
33 if(inCondition) \
34 { \
35 throw(inException); \
39 /*!
40 \brief Exception base class.
43 class SERVER_EXPORT JackException : public std::runtime_error {
45 public:
47 JackException(const std::string& msg) : std::runtime_error(msg)
49 JackException(char* msg) : std::runtime_error(msg)
51 JackException(const char* msg) : std::runtime_error(msg)
54 std::string Message()
56 return what();
59 void PrintMessage();
63 /*!
64 \brief Exception thrown by JackEngine in temporary mode.
67 class SERVER_EXPORT JackTemporaryException : public JackException {
69 public:
71 JackTemporaryException(const std::string& msg) : JackException(msg)
73 JackTemporaryException(char* msg) : JackException(msg)
75 JackTemporaryException(const char* msg) : JackException(msg)
77 JackTemporaryException() : JackException("")
81 /*!
82 \brief
85 class SERVER_EXPORT JackQuitException : public JackException {
87 public:
89 JackQuitException(const std::string& msg) : JackException(msg)
91 JackQuitException(char* msg) : JackException(msg)
93 JackQuitException(const char* msg) : JackException(msg)
95 JackQuitException() : JackException("")
99 /*!
100 \brief Exception possibly thrown by Net slaves.
103 class SERVER_EXPORT JackNetException : public JackException {
105 public:
107 JackNetException(const std::string& msg) : JackException(msg)
109 JackNetException(char* msg) : JackException(msg)
111 JackNetException(const char* msg) : JackException(msg)
113 JackNetException() : JackException("")
119 #endif