ktypes.hpp
Go to the documentation of this file.
1 // This file is part of kfilter.
2 // kfilter is a C++ variable-dimension extended kalman filter library.
3 //
4 // Copyright (C) 2004 Vincent Zalzal, Sylvain Marleau
5 // Copyright (C) 2001, 2004 Richard Gourdeau
6 // Copyright (C) 2004 GRPR and DGE's Automation sector
7 // École Polytechnique de Montréal
8 //
9 // Code adapted from algorithms presented in :
10 // Bierman, G. J. "Factorization Methods for Discrete Sequential
11 // Estimation", Academic Press, 1977.
12 //
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2.1 of the License, or (at your option) any later version.
17 //
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 
27 #ifndef KTYPES_HPP
28 #define KTYPES_HPP
29 
35 
36 #include <stdexcept>
37 #include <string>
38 
39 // Patch for MSVC++ 6.0 lack of support for templates sstream
40 #if (defined(_MSC_VER) && _MSC_VER <= 1200)
41 
42 #define KTYPENAME
43 #define KSSTREAM_HEADER <strstream>
44 #define KOSTRINGSTREAM std::ostrstream
45 #define KEND_OF_STREAM << '\0'
46 
47 #else
48 
49 #define KTYPENAME typename
50 #define KSSTREAM_HEADER <sstream>
51 #define KOSTRINGSTREAM std::ostringstream
52 #define KEND_OF_STREAM
53 
54 #endif
55 
57 
63 namespace Kalman {
64 
65  typedef short int K_INT_16;
66  typedef unsigned short int K_UINT_16;
67  typedef long int K_INT_32;
68  typedef unsigned long int K_UINT_32;
69  typedef float K_REAL_32;
70  typedef double K_REAL_64;
71 
73  struct KalmanError : public std::logic_error {
74 
76 
80  explicit KalmanError(const std::string& message)
81  : logic_error(message) {}
82  };
83 
85  struct OutOfBoundError : public KalmanError {
86 
88  explicit OutOfBoundError(const std::string& message)
89  : KalmanError(message) {}
90  };
91 
93  namespace Util {
94 
96 
103  template <typename T>
104  inline void swap(T& a, T& b) {
105  T tmp = a;
106  a = b;
107  b = tmp;
108  }
109 
110  }
111 
112 }
113 
114 #endif
KalmanError(const std::string &message)
Constructor taking an error message.
Definition: ktypes.hpp:80
OutOfBoundError(const std::string &message)
Constructor taking an error message.
Definition: ktypes.hpp:88
long int K_INT_32
Signed 32-bits integral type.
Definition: ktypes.hpp:67
Base class for all exceptions thrown in the Kalman namespace.
Definition: ktypes.hpp:73
void swap(T &a, T &b)
Swaps objects a and b.
Definition: ktypes.hpp:104
float K_REAL_32
32-bits floating point type
Definition: ktypes.hpp:69
double K_REAL_64
64-bits floating point type
Definition: ktypes.hpp:70
short int K_INT_16
Signed 16-bits integral type.
Definition: ktypes.hpp:65
unsigned short int K_UINT_16
Unsigned 16-bits integral type.
Definition: ktypes.hpp:66
unsigned long int K_UINT_32
Unsigned 32-bits integral type.
Definition: ktypes.hpp:68
Exception class for access to out-of-bound elements.
Definition: ktypes.hpp:85


kfilter
Author(s): Jorge Almeida, Vincent Zalzal, Sylvain Marleau, Richard Gourdeau
autogenerated on Mon Mar 2 2015 01:31:45