00001 /* SimData: Data Infrastructure for Simulations 00002 * Copyright (C) 2002 Mark Rose <tm2@stm.lbl.gov> 00003 * 00004 * This file is part of SimData. 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 */ 00020 00021 00028 #ifndef __SIMDATA_EXCEPTION_H__ 00029 #define __SIMDATA_EXCEPTION_H__ 00030 00031 #include <string> 00032 00033 #include <SimData/Export.h> 00034 #include <SimData/Namespace.h> 00035 00036 00037 NAMESPACE_SIMDATA 00038 00039 00044 class SIMDATA_EXPORT ExceptionBase { //: public std::runtime_error { 00045 std::string _msg; 00046 std::string _type; 00047 mutable bool dump; 00048 public: 00054 ExceptionBase(std::string const &type="Exception", std::string const &msg=""); 00055 00058 ExceptionBase(ExceptionBase const &e); 00059 00065 virtual ~ExceptionBase(); 00066 00069 std::string getMessage(); 00070 00073 std::string getType(); 00074 00077 std::string getError(); 00078 00081 void appendMessage(std::string const &msg); 00082 00085 void addMessage(std::string const &msg); 00086 00090 void clear(); 00091 00094 void details(); 00095 }; 00096 00099 class SIMDATA_EXPORT Exception: public ExceptionBase { 00100 public: 00101 Exception(std::string const &type="Exception", std::string const &msg=""): 00102 ExceptionBase(type, msg) { } 00103 }; 00104 00105 #define SIMDATA_SUBEXCEPTION(a, b) \ 00106 class a: public b { \ 00107 public: \ 00108 a(std::string const &msg=""): \ 00109 b(#a, msg) { } \ 00110 a(std::string const &type, std::string const &msg): \ 00111 b(type, msg) { } \ 00112 }; 00113 00114 #define SIMDATA_EXCEPTION(a) SIMDATA_SUBEXCEPTION(a, Exception) 00115 00116 00121 SIMDATA_EXCEPTION(PythonException); 00122 00123 00124 NAMESPACE_SIMDATA_END 00125 00126 00127 #endif // __SIMDATA_EXCEPTION_H__ 00128
|
SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage. Generated on Tue Oct 14 12:06:38 2003, using Doxygen 1.2.18. |