Orocos Real-Time Toolkit  2.6.0
FactoryExceptions.cpp
00001 /***************************************************************************
00002   tag: Peter Soetens  Wed Jan 18 14:11:40 CET 2006  FactoryExceptions.cxx
00003 
00004                         FactoryExceptions.cxx -  description
00005                            -------------------
00006     begin                : Wed January 18 2006
00007     copyright            : (C) 2006 Peter Soetens
00008     email                : peter.soetens@mech.kuleuven.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 
00039 #include "FactoryExceptions.hpp"
00040 #include <sstream>
00041 
00042 namespace RTT {
00043 
00044     name_not_found_exception::name_not_found_exception( const std::string& n )
00045           : name(n)
00046     {
00047         whatstr = name + " not found in this factory.";
00048     }
00049 
00050     name_not_found_exception::~name_not_found_exception() throw() {}
00051 
00052     const char* name_not_found_exception::what() const throw() {
00053         return whatstr.c_str();
00054     }
00055 
00056     invalid_handle_exception::invalid_handle_exception()
00057           : whatstr("Invalid SendHandle object.")
00058     {
00059     }
00060 
00061     invalid_handle_exception::~invalid_handle_exception() throw() {}
00062 
00063     const char* invalid_handle_exception::what() const throw() {
00064         return whatstr.c_str();
00065     }
00066 
00067     no_asynchronous_operation_exception::no_asynchronous_operation_exception(std::string const& what)
00068           : whatstr(what)
00069     {
00070     }
00071 
00072     no_asynchronous_operation_exception::~no_asynchronous_operation_exception() throw() {}
00073 
00074     const char* no_asynchronous_operation_exception::what() const throw() {
00075         return whatstr.c_str();
00076     }
00077 
00078     wrong_number_of_args_exception::wrong_number_of_args_exception( int w, int r )
00079           : wanted( w ), received( r )
00080       {
00081         std::stringstream a;
00082         a << "Wrong number of arguments: Expected ";
00083         a << w;
00084         a << ", received ";
00085         a << r << ".";
00086         whatstr = a.str();
00087       }
00088 
00089     wrong_number_of_args_exception::~wrong_number_of_args_exception() throw() {}
00090 
00091     const char* wrong_number_of_args_exception::what() const throw() {
00092         return whatstr.c_str();
00093     }
00094 
00095       wrong_types_of_args_exception::wrong_types_of_args_exception( int w, const std::string& expected, const std::string& received )
00096           : whicharg( w ), expected_(expected), received_(received)
00097       {
00098         std::stringstream a;
00099         a << "In argument "<<w<<": wrong type of argument: Expected type ";
00100         a << expected_;
00101         a << ", received type ";
00102         a << received_ << ".";
00103         whatstr = a.str();
00104       }
00105 
00106     wrong_types_of_args_exception::~wrong_types_of_args_exception() throw() {}
00107 
00108 
00109     const char* wrong_types_of_args_exception::what() const throw() {
00110         return whatstr.c_str();
00111     }
00112 
00113     non_lvalue_args_exception::non_lvalue_args_exception( int w, const std::string& received )
00114           : whicharg( w ), received_(received)
00115       {
00116         std::stringstream a;
00117         a << "In argument "<<w<<": can not assign value to non-lvalue ";
00118         a << received_ << ".";
00119         whatstr = a.str();
00120       }
00121 
00122     non_lvalue_args_exception::~non_lvalue_args_exception() throw() {}
00123 
00124     const char* non_lvalue_args_exception::what() const throw() {
00125         return whatstr.c_str();
00126     }
00127 
00128 
00129 }