00001 // Copyright (C) 2013 Stephen Roderick <kiwi dot net at mac dot com> 00002 00003 // This library is free software; you can redistribute it and/or 00004 // modify it under the terms of the GNU Lesser General Public 00005 // License as published by the Free Software Foundation; either 00006 // version 2.1 of the License, or (at your option) any later version. 00007 00008 // This library is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 // Lesser General Public License for more details. 00012 00013 // You should have received a copy of the GNU Lesser General Public 00014 // License along with this library; if not, write to the Free Software 00015 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00016 00017 #ifndef __SOLVERI_HPP 00018 #define __SOLVERI_HPP 00019 00020 namespace KDL { 00021 00084 class SolverI 00085 { 00086 public: 00087 enum { 00089 E_DEGRADED = +1, 00091 E_NOERROR = 0, 00093 E_NO_CONVERGE = -1, 00095 E_UNDEFINED = -2 00096 }; 00097 00099 SolverI() : 00100 error(E_NOERROR) 00101 {} 00102 00103 virtual ~SolverI() 00104 {} 00105 00107 virtual int getError() const { return error; } 00108 00113 virtual const char* strError(const int error) const 00114 { 00115 if (E_NOERROR == error) return "No error"; 00116 else if (E_NO_CONVERGE == error) return "Failed to converge"; 00117 else if (E_UNDEFINED == error) return "Undefined value"; 00118 else if (E_DEGRADED == error) return "Converged but degraded solution"; 00119 else return "UNKNOWN ERROR"; 00120 } 00121 00122 protected: 00124 int error; 00125 }; 00126 00127 } // namespaces 00128 00129 #endif