00001 /*************************************************************************** 00002 tag: Peter Soetens Mon Jan 19 14:11:25 CET 2004 FactoryExceptions.hpp 00003 00004 FactoryExceptions.hpp - description 00005 ------------------- 00006 begin : Mon January 19 2004 00007 copyright : (C) 2004 Peter Soetens 00008 email : peter.soetens@mech.kuleuven.ac.be 00009 00010 *************************************************************************** 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU General Public * 00013 * License as published by the Free Software Foundation; * 00014 * version 2 of the License. * 00015 * * 00016 * As a special exception, you may use this file as part of a free * 00017 * software library without restriction. Specifically, if other files * 00018 * instantiate templates or use macros or inline functions from this * 00019 * file, or you compile this file and link it with other files to * 00020 * produce an executable, this file does not by itself cause the * 00021 * resulting executable to be covered by the GNU General Public * 00022 * License. This exception does not however invalidate any other * 00023 * reasons why the executable file might be covered by the GNU General * 00024 * Public License. * 00025 * * 00026 * This library is distributed in the hope that it will be useful, * 00027 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00028 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00029 * Lesser General Public License for more details. * 00030 * * 00031 * You should have received a copy of the GNU General Public * 00032 * License along with this library; if not, write to the Free Software * 00033 * Foundation, Inc., 59 Temple Place, * 00034 * Suite 330, Boston, MA 02111-1307 USA * 00035 * * 00036 ***************************************************************************/ 00037 00038 #ifndef FACTORYEXCEPTIONS_HPP 00039 #define FACTORYEXCEPTIONS_HPP 00040 00041 #include <string> 00042 #include <exception> 00043 #include "rtt-config.h" 00044 00049 namespace RTT 00050 { 00055 struct RTT_EXPORT name_not_found_exception 00056 : public std::exception 00057 { 00058 name_not_found_exception( const std::string& n="name" ); 00059 ~name_not_found_exception() throw(); 00060 std::string name; 00061 std::string whatstr; 00062 virtual const char* what() const throw(); 00063 }; 00064 00069 struct RTT_EXPORT invalid_handle_exception 00070 : public std::exception 00071 { 00072 invalid_handle_exception(); 00073 ~invalid_handle_exception() throw(); 00074 std::string whatstr; 00075 virtual const char* what() const throw(); 00076 }; 00077 00082 struct RTT_EXPORT wrong_number_of_args_exception 00083 : public std::exception 00084 { 00085 int wanted; 00086 int received; 00087 std::string whatstr; 00088 wrong_number_of_args_exception( int w, int r ); 00089 ~wrong_number_of_args_exception() throw(); 00090 virtual const char* what() const throw(); 00091 }; 00092 00097 struct RTT_EXPORT wrong_types_of_args_exception 00098 : public std::exception 00099 { 00100 // this contains the number of the argument that had the wrong 00101 // type. The first argument has number 1. 00102 int whicharg; 00103 std::string expected_; 00104 std::string received_; 00105 std::string whatstr; 00106 wrong_types_of_args_exception( int w, const std::string& expected, const std::string& received ); 00107 ~wrong_types_of_args_exception() throw(); 00108 virtual const char* what() const throw(); 00109 }; 00110 00115 struct RTT_EXPORT no_asynchronous_operation_exception 00116 : public std::exception 00117 { 00118 std::string whatstr; 00119 no_asynchronous_operation_exception( const std::string& what ); 00120 ~no_asynchronous_operation_exception() throw(); 00121 virtual const char* what() const throw(); 00122 }; 00123 00130 struct RTT_EXPORT non_lvalue_args_exception 00131 : public std::exception 00132 { 00133 // thrown when a factory expects an AssignableDataSource (lvalue), but only 00134 // found a DataSource (rvalue). 00135 int whicharg; 00136 std::string received_; 00137 std::string whatstr; 00138 non_lvalue_args_exception( int w, const std::string& received ); 00139 ~non_lvalue_args_exception() throw(); 00140 virtual const char* what() const throw(); 00141 }; 00142 } 00143 00144 #endif