00001 // This file is part of kfilter. 00002 // kfilter is a C++ variable-dimension extended kalman filter library. 00003 // 00004 // Copyright (C) 2004 Vincent Zalzal, Sylvain Marleau 00005 // Copyright (C) 2001, 2004 Richard Gourdeau 00006 // Copyright (C) 2004 GRPR and DGE's Automation sector 00007 // École Polytechnique de Montréal 00008 // 00009 // Code adapted from algorithms presented in : 00010 // Bierman, G. J. "Factorization Methods for Discrete Sequential 00011 // Estimation", Academic Press, 1977. 00012 // 00013 // This library is free software; you can redistribute it and/or 00014 // modify it under the terms of the GNU Lesser General Public 00015 // License as published by the Free Software Foundation; either 00016 // version 2.1 of the License, or (at your option) any later version. 00017 // 00018 // This library is distributed in the hope that it will be useful, 00019 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 // Lesser General Public License for more details. 00022 // 00023 // You should have received a copy of the GNU Lesser General Public 00024 // License along with this library; if not, write to the Free Software 00025 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 00027 #ifndef KTYPES_HPP 00028 #define KTYPES_HPP 00029 00035 00036 #include <stdexcept> 00037 #include <string> 00038 00040 00046 namespace Kalman { 00047 00048 typedef short int K_INT_16; 00049 typedef unsigned short int K_UINT_16; 00050 typedef long int K_INT_32; 00051 typedef unsigned long int K_UINT_32; 00052 typedef float K_REAL_32; 00053 typedef double K_REAL_64; 00054 00056 struct KalmanError : public std::logic_error { 00057 00059 00063 explicit KalmanError(const std::string& message) 00064 : logic_error(message) {} 00065 }; 00066 00068 struct OutOfBoundError : public KalmanError { 00069 00071 explicit OutOfBoundError(const std::string& message) 00072 : KalmanError(message) {} 00073 }; 00074 00076 namespace Util { 00077 00079 00086 template <typename T> 00087 inline void swap(T& a, T& b) { 00088 T tmp = a; 00089 a = b; 00090 b = tmp; 00091 } 00092 00093 } 00094 00095 } 00096 00097 #endif