kvector.hpp

Go to the documentation of this file.
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 KVECTOR_HPP
00028 #define KVECTOR_HPP
00029 
00032 
00033 #include <vector>
00034 #include <string>
00035 #include <iostream>
00036 
00037 #include "kalman/ktypes.hpp"
00038 
00039 namespace Kalman {
00040 
00042 
00071   template<typename T, K_UINT_32 BEG, bool DBG>
00072   class KVector {
00073   public:
00074 
00075     typedef T type;             
00076 
00077     enum { beg = BEG            
00078     };
00079 
00081 
00082 
00084     inline KVector();
00085 
00087     inline explicit KVector(K_UINT_32 n);
00088 
00090     inline KVector(K_UINT_32 n, const T& a);
00091 
00093     inline KVector(K_UINT_32 n, const T* v);
00094 
00096     inline KVector(const KVector& v);
00097 
00099     inline ~KVector();
00100 
00102 
00104 
00105 
00107     inline T& operator()(K_UINT_32 i);
00108 
00110     inline const T& operator()(K_UINT_32 i) const;
00111 
00113     inline K_UINT_32 size() const;
00114 
00116 
00118     inline void resize(K_UINT_32 n);
00119 
00121     inline KVector& operator=(const T& a);
00122 
00124     inline KVector& operator=(const KVector& v);
00125 
00127     inline void assign(K_UINT_32 n, const T* v);
00128 
00130     inline void swap(KVector& v);
00131 
00133 
00134 
00136     inline void get(std::istream& is);
00137 
00139     inline void put(std::ostream& os) const;
00140 
00142 
00143   private:
00144     std::vector<T> vimpl_;      
00145     
00147 
00151     T* v_;
00152     K_UINT_32 n_;               
00153   };
00154 
00156   template<typename T, K_UINT_32 BEG, bool DBG>
00157   inline std::istream& operator>>(std::istream& is, 
00158                                   KVector<T, BEG, DBG>& v);
00159 
00161   template<typename T, K_UINT_32 BEG, bool DBG>
00162   inline std::ostream& operator<<(std::ostream& os, 
00163                                   const KVector<T, BEG, DBG>& v);
00164 
00166   typedef unsigned short KVectorContext;
00167 
00169   extern KVectorContext DEFAULT_VECTOR_CONTEXT;
00170 
00172   KVectorContext createKVectorContext(std::string elemDelim = " ", 
00173                                       std::string startDelim = "", 
00174                                       std::string endDelim = "", 
00175                                       unsigned prec = 4);
00176 
00178   KVectorContext selectKVectorContext(KVectorContext c);
00179 }
00180 
00181 #include "kalman/kvector_impl.hpp"
00182 
00183 #endif

Generated on Sat Jan 28 21:02:01 2006 for KFilter by  doxygen 1.4.5