QuantityError.h

Go to the documentation of this file.
00001 
00007 /* Copyright (C) 2005 - 2009, 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 //STL includes
00030 #include <string>
00031 
00032 namespace quantity
00033 {
00034 
00036 //
00037 //  exception classes
00038 //
00040 
00042 
00046 class QuantityError
00047 {
00048 public:
00049   QuantityError( const std::string& message )
00050     : _message( message )
00051   {}
00052   virtual ~QuantityError(){}
00053   
00054   virtual std::string message() const
00055   {
00056     return _message;
00057   }
00058 
00059 
00060 protected:
00061   std::string _message;
00062 
00063 };
00064 
00066 
00069 class UnitMismatch : public QuantityError
00070 {
00071 private:
00073   static const std::string UNIT_MISMATCH;
00074 
00075 public:
00077 
00079   UnitMismatch (void) : QuantityError (UNIT_MISMATCH) {}
00080 
00082 
00084   UnitMismatch (const std::string message) : QuantityError (message) {}
00085 };
00086 
00088 
00090 class InputError : public QuantityError
00091 {
00092 private:
00094   static const std::string INPUT_ERROR;
00095 
00096 public:
00098 
00100   InputError (void) : QuantityError (INPUT_ERROR) {}
00101 
00103 
00105   InputError (const std::string message) : QuantityError (message) {}
00106 };
00107 
00109 
00112 class DimensionMismatch : public QuantityError
00113 {
00114 private:
00116   static const std::string DIMENSION_MISMATCH;
00117 
00118 public:
00120 
00122   DimensionMismatch (void) : QuantityError (DIMENSION_MISMATCH) {}
00123 
00125 
00127   DimensionMismatch (const std::string message) 
00128                                             : QuantityError (message) {}
00129 };
00130 
00132 
00136 class VectorOutOfBounds : public QuantityError
00137 {
00138 private:
00140   static const std::string VECTOR_OUT_OF_BOUNDS;
00141 
00142 public:
00144 
00146   VectorOutOfBounds (void) : QuantityError (VECTOR_OUT_OF_BOUNDS) {}
00147 
00149 
00151   VectorOutOfBounds (const std::string message) 
00152                                             : QuantityError (message) {}
00153 };
00154 
00156 
00161 class VectorSizeError : public QuantityError
00162 {
00163 private:
00165   static const std::string VECTOR_SIZE_ERROR;
00166 
00167 public:
00169 
00171   VectorSizeError (void) : QuantityError (VECTOR_SIZE_ERROR) {}
00172 
00174 
00176   VectorSizeError (const std::string message) 
00177                                             : QuantityError (message) {}
00178 };
00179 
00181 
00185 class LoadError : public QuantityError
00186 {
00187 private:
00189   static const std::string LOADERROR;
00190 
00191 public:
00193 
00195   LoadError (void) : QuantityError (LOADERROR) {}
00196 
00198 
00200   LoadError (const std::string message) : QuantityError (message) {}
00201 };
00202 
00203   
00204 } // namespace quantity
00205 
00206 #endif // _QuantityError_h
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 
00217 
00218 
00219 

Generated on Mon Jul 27 15:55:45 2009 for Quantities by  doxygen 1.5.3