00001 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ 00002 /* 00003 * mitie 00004 * Copyright (C) Jason Spencer 2009 <mitie@jasonspencer.org> 00005 * 00006 * mitie is free software: you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * mitie is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00014 * See the GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #ifndef _CJNLTOPOLOGYEXCEPTION_H_ 00021 #define _CJNLTOPOLOGYEXCEPTION_H_ 1 00022 00023 #include <string> 00024 #include <new> // bad_alloc 00025 #include <stdexcept> //range_error runtime_error 00026 00027 namespace jmitie { 00028 00030 struct E_CjNLT_Exception { }; 00031 00032 class E_CjNLT_MemoryAllocFail : public E_CjNLT_Exception, public std::bad_alloc { 00033 public: 00034 explicit E_CjNLT_MemoryAllocFail() {} 00035 }; 00036 00037 class E_CjNLT_SizeError : public E_CjNLT_Exception, public std::range_error { 00038 public: 00039 explicit E_CjNLT_SizeError (const std::string & message) : std::range_error(message) {} 00040 virtual ~E_CjNLT_SizeError() throw() {} 00041 }; 00042 00043 class E_CjNLT_BoundsError : public E_CjNLT_Exception, public std::runtime_error { 00044 public: 00045 explicit E_CjNLT_BoundsError (const std::string & message) : std::runtime_error(message) {} 00046 virtual ~E_CjNLT_BoundsError() throw() {} 00047 }; 00048 00049 class E_CjNLT_TopologyError : public E_CjNLT_Exception, public std::runtime_error { 00050 public: 00051 explicit E_CjNLT_TopologyError (const std::string & message) : std::runtime_error(message) {} 00052 virtual ~E_CjNLT_TopologyError() throw() {} 00053 }; 00054 00055 class E_CjNLT_RoutingError : public E_CjNLT_Exception, public std::runtime_error { 00056 public: 00057 explicit E_CjNLT_RoutingError (const std::string & message) : std::runtime_error(message) {} 00058 virtual ~E_CjNLT_RoutingError() throw() {} 00059 }; 00060 00061 class E_CjNLT_InternalError : public E_CjNLT_Exception, public std::runtime_error { 00062 public: 00063 explicit E_CjNLT_InternalError (const std::string & message) : std::runtime_error(message) {} 00064 virtual ~E_CjNLT_InternalError() throw() {} 00065 }; 00066 00067 } // namespace jmitie 00068 00069 #endif // _CJNLTOPOLOGYEXCEPTION_H_