Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

QuantityError.h

Go to the documentation of this file.
00001 
00007 /* Copyright (C) 2005, Bernd Speiser */
00008 /* This file is part of Quantity.
00009 
00010 Quantity is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 Quantity is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019   
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00023 02111-1307, USA.
00024 */
00025 
00026 #ifndef _QuantityError_h
00027 #define _QuantityError_h
00028 
00029 #include <string>
00030 
00031 namespace quantity
00032 {
00033 
00035 //
00036 //  exception classes
00037 //
00039 
00041 
00045 class QuantityError
00046 {
00047 public:
00048   QuantityError( const std::string& message )
00049     : _message( message )
00050   {}
00051   virtual ~QuantityError(){}
00052   
00053   virtual std::string message() const
00054   {
00055     return _message;
00056   }
00057 
00058 
00059 protected:
00060   std::string _message;
00061 
00062 };
00063 
00065 
00068 class UnitMismatch : public QuantityError
00069 {
00070 private:
00072   static const std::string UNIT_MISMATCH;
00073 
00074 public:
00076 
00078   UnitMismatch (void) : QuantityError (UNIT_MISMATCH) {}
00079 
00081 
00083   UnitMismatch (const std::string message) : QuantityError (message) {}
00084 };
00085 
00087 
00089 class InputError : public QuantityError
00090 {
00091 private:
00093   static const std::string INPUT_ERROR;
00094 
00095 public:
00097 
00099   InputError (void) : QuantityError (INPUT_ERROR) {}
00100 
00102 
00104   InputError (const std::string message) : QuantityError (message) {}
00105 };
00106 
00108 
00111 class DimensionMismatch : public QuantityError
00112 {
00113 private:
00115   static const std::string DIMENSION_MISMATCH;
00116 
00117 public:
00119 
00121   DimensionMismatch (void) : QuantityError (DIMENSION_MISMATCH) {}
00122 
00124 
00126   DimensionMismatch (const std::string message) 
00127                                             : QuantityError (message) {}
00128 };
00129 
00131 
00135 class VectorOutOfBounds : public QuantityError
00136 {
00137 private:
00139   static const std::string VECTOR_OUT_OF_BOUNDS;
00140 
00141 public:
00143 
00145   VectorOutOfBounds (void) : QuantityError (VECTOR_OUT_OF_BOUNDS) {}
00146 
00148 
00150   VectorOutOfBounds (const std::string message) 
00151                                             : QuantityError (message) {}
00152 };
00153 
00155 
00159 class LoadError : public QuantityError
00160 {
00161 private:
00163   static const std::string LOADERROR;
00164 
00165 public:
00167 
00169   LoadError (void) : QuantityError (LOADERROR) {}
00170 
00172 
00174   LoadError (const std::string message) : QuantityError (message) {}
00175 };
00176 
00177   
00178 } // namespace Quantitys
00179 
00180 #endif // _QuantityError_h
00181 
00182 
00183 
00184 
00185 
00186 
00187 
00188 
00189 
00190 
00191 
00192 
00193 

Generated on Mon Feb 12 18:43:57 2007 for Quantity by doxygen 1.3.6