00001 /** @file Exception.h 00002 * @author Gabor Madl 00003 * @date Created 04/2005 00004 * @brief The Exception class used in DREAM. 00005 * 00006 * 00007 * ================================================================= 00008 * DREAM License v2.0 00009 * 00010 * DREAM - Distributed Real-time Embedded Analysis Method 00011 * http://dre.sourceforge.net. 00012 * Copyright (c) 2005-2007 Gabor Madl, All Rights Reserved. 00013 * 00014 * This file is part of DREAM. 00015 * 00016 * DREAM is free software; you can redistribute it and/or modify it 00017 * under the terms of the GNU General Public License version 2 as 00018 * published by the Free Software Foundation. No future versions of 00019 * the GPL license may be automatically applied to DREAM. It is in 00020 * the sole discretion of the copyright holder to determine whether 00021 * DREAM may be released under a different license or terms. There 00022 * are no restrictions on the use of DREAM for any purpose. 00023 * 00024 * DREAM is distributed in the hope that it will be useful, 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00027 * GNU General Public License for more details. 00028 * 00029 * You should have received a copy of the GNU General Public License 00030 * along with this program; if not, write to the Free Software 00031 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00032 * MA 02110-1301, USA. 00033 * 00034 * By submitting comments, suggestions, code, code snippets, 00035 * techniques (including that of usage), and algorithms, submitters 00036 * acknowledge that they have the right to do so, that any such 00037 * submissions are given freely and unreservedly, and that they 00038 * waive any claims to copyright or ownership. In addition, 00039 * submitters acknowledge that any such submission might become 00040 * part of the copyright maintained on the overall body of code, 00041 * which comprises DREAM. By making a submission, submitter agrees 00042 * to these terms. Furthermore, submitters acknowledge that the 00043 * incorporation or modification of such submissions is entirely 00044 * at the discretion of the moderators of the DREAM project. 00045 * 00046 * DREAM links to the Libxml2 third party library. Please see 00047 * COPYING-libxml for the copyright information of Libxml2. 00048 * ================================================================= 00049 */ 00050 00051 #ifndef DREAM_EXCEPTION 00052 #define DREAM_EXCEPTION 00053 00054 #include "Common.h" 00055 00056 namespace DREAM 00057 { 00058 00059 /** Generic Exception class used in the whole DREAM implementation. */ 00060 class Exception 00061 { 00062 public: 00063 /** Constructor. 00064 * @param exception specifies the exception message. 00065 */ 00066 Exception (const std::string& exception); 00067 00068 /** Destructor. */ 00069 virtual ~Exception (); 00070 00071 /** Handler. 00072 * Outputs exception message. 00073 */ 00074 virtual void handler () const; 00075 protected: 00076 /** The exception message */ 00077 std::string exception_; 00078 }; 00079 00080 /** Exception class for errors caused by calling unimplemented virtual methods in base classes. */ 00081 class BaseClassException : public DREAM::Exception 00082 { 00083 public: 00084 /** Constructor. 00085 * @param exception specifies the exception message. 00086 */ 00087 BaseClassException (const std::string& exception); 00088 00089 /** Destructor. */ 00090 virtual ~BaseClassException (); 00091 00092 /** Handler. 00093 * Outputs exception message. 00094 */ 00095 virtual void handler () const; 00096 }; 00097 00098 /** Exception class for errors reported by the XML parser library. */ 00099 class XMLException : public DREAM::Exception 00100 { 00101 public: 00102 /** Constructor. 00103 * @param exception specifies the exception message. 00104 */ 00105 XMLException (const std::string& exception); 00106 00107 /** Destructor. */ 00108 virtual ~XMLException (); 00109 00110 /** Handler. 00111 * Outputs exception message. 00112 */ 00113 virtual void handler () const; 00114 }; 00115 00116 /** Conversion function from const char* to unsigned int. */ 00117 uint chartouint (const char* xmlstr) 00118 throw (DREAM::Exception); 00119 } 00120 00121 #endif 00122