Exceptions.hpp
Go to the documentation of this file.
00001 /****************************************************************
00002  *
00003  * Copyright (c) 2011
00004  * All rights reserved.
00005  *
00006  * Hochschule Bonn-Rhein-Sieg
00007  * University of Applied Sciences
00008  * Computer Science Department
00009  *
00010  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00011  *
00012  * Author:
00013  * Jan Paulus, Nico Hochgeschwender, Michael Reckhaus, Azamat Shakhimardanov
00014  * Supervised by:
00015  * Gerhard K. Kraetzschmar
00016  *
00017  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00018  *
00019  * This sofware is published under a dual-license: GNU Lesser General Public
00020  * License LGPL 2.1 and BSD license. The dual-license implies that users of this
00021  * code may choose which terms they prefer.
00022  *
00023  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00024  *
00025  * Redistribution and use in source and binary forms, with or without
00026  * modification, are permitted provided that the following conditions are met:
00027  *
00028  *     * Redistributions of source code must retain the above copyright
00029  *       notice, this list of conditions and the following disclaimer.
00030  *     * Redistributions in binary form must reproduce the above copyright
00031  *       notice, this list of conditions and the following disclaimer in the
00032  *       documentation and/or other materials provided with the distribution.
00033  *     * Neither the name of the Hochschule Bonn-Rhein-Sieg nor the names of its
00034  *       contributors may be used to endorse or promote products derived from
00035  *       this software without specific prior written permission.
00036  *
00037  * This program is free software: you can redistribute it and/or modify
00038  * it under the terms of the GNU Lesser General Public License LGPL as
00039  * published by the Free Software Foundation, either version 2.1 of the
00040  * License, or (at your option) any later version or the BSD license.
00041  *
00042  * This program is distributed in the hope that it will be useful,
00043  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00044  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00045  * GNU Lesser General Public License LGPL and the BSD license for more details.
00046  *
00047  * You should have received a copy of the GNU Lesser General Public
00048  * License LGPL and BSD license along with this program.
00049  *
00050  ****************************************************************/
00051 
00052 #ifndef _EXCEPTIONS_HPP
00053 #define _EXCEPTIONS_HPP
00054 
00055 #include <exception>
00056 #include <stdexcept>
00057 #include <iostream>
00058 #include <string>
00059 
00060 using namespace std;
00061 namespace youbot
00062 {
00063 
00065 class FileNotFoundException : public std::ios_base::failure
00066 {
00067   string msg;
00068 
00069 public:
00070   // Takes a character string describing the error.
00071   explicit FileNotFoundException(const string& message) throw () :
00072       std::ios_base::failure(message)
00073   {
00074     msg = message + " file not found";
00075   }
00076   ;
00077 
00078   virtual ~FileNotFoundException() throw ()
00079   {
00080   }
00081   ;
00082 
00083   // Returns a C-style character string describing the general cause of the current error
00084   virtual const char* what() const throw ()
00085   {
00086     return msg.c_str();
00087   }
00088   ;
00089 };
00090 
00092 class KeyNotFoundException : public std::ios_base::failure
00093 {
00094   string msg;
00095 
00096 public:
00097   // Takes a character string describing the error.
00098   explicit KeyNotFoundException(const string& message) throw () :
00099       std::ios_base::failure(message)
00100   {
00101     msg = message + " key in config file not found";
00102   }
00103   ;
00104 
00105   virtual ~KeyNotFoundException() throw ()
00106   {
00107   }
00108   ;
00109 
00110   // Returns a C-style character string describing the general cause of the current error
00111   virtual const char* what() const throw ()
00112   {
00113     return msg.c_str();
00114   }
00115   ;
00116 };
00118 class JointParameterException : public std::runtime_error
00119 {
00120   string msg;
00121 
00122 public:
00123   // Takes a character string describing the error.
00124   explicit JointParameterException(const string& message) throw () :
00125       std::runtime_error(message)
00126   {
00127     msg = message;
00128   }
00129   ;
00130 
00131   virtual ~JointParameterException() throw ()
00132   {
00133   }
00134   ;
00135 
00136   // Returns a C-style character string describing the general cause of the current error
00137   virtual const char* what() const throw ()
00138   {
00139     return msg.c_str();
00140   }
00141   ;
00142 };
00144 class JointErrorException : public std::runtime_error
00145 {
00146   string msg;
00147 
00148 public:
00149   // Takes a character string describing the error.
00150   explicit JointErrorException(const string& message) throw () :
00151       std::runtime_error(message)
00152   {
00153     msg = message;
00154   }
00155   ;
00156 
00157   virtual ~JointErrorException() throw ()
00158   {
00159   }
00160   ;
00161 
00162   // Returns a C-style character string describing the general cause of the current error
00163   virtual const char* what() const throw ()
00164   {
00165     return msg.c_str();
00166   }
00167   ;
00168 };
00170 class EtherCATConnectionException : public std::runtime_error
00171 {
00172   string msg;
00173 
00174 public:
00175   // Takes a character string describing the error.
00176   explicit EtherCATConnectionException(const string& message) throw () :
00177       std::runtime_error(message)
00178   {
00179     msg = message;
00180   }
00181   ;
00182 
00183   virtual ~EtherCATConnectionException() throw ()
00184   {
00185   }
00186   ;
00187 
00188   // Returns a C-style character string describing the general cause of the current error
00189   virtual const char* what() const throw ()
00190   {
00191     return msg.c_str();
00192   }
00193   ;
00194 };
00195 
00196 } // namespace youbot
00197 #endif //_EXCEPTIONS_HPP


youbot_driver
Author(s): Jan Paulus
autogenerated on Mon Oct 6 2014 09:08:01