MFile.h
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 MFILE_H
28 #define MFILE_H
29 
30 #include <vector>
31 #include <string>
32 #include "kalman/ktypes.hpp"
33 #include "kalman/kvector.hpp"
34 #include "kalman/kmatrix.hpp"
35 
36 namespace Kalman {
37 
38 #define LINE_MAX_LENGTH 65536
39 #define ROW_VECTOR 0
40 #define COLUMN_VECTOR 1
41 
43 {
44  unsigned int Index;
45  unsigned int Rows;
46  unsigned int Cols;
47  std::string Name;
48  MFileElement();
49  MFileElement(const MFileElement& tmp);
50  ~MFileElement();
51  MFileElement& operator=(const MFileElement& tmp);
52 };
53 
54 
55 class MFile {
56  public:
57 
58  MFile();
59  ~MFile();
60 
61  int read(char *filename);
62  int save(char *filename);
63  void print();
64 
65 template<typename T, K_UINT_32 BEG, bool DBG>
66 inline int get(std::string name, Kalman::KVector<T,BEG,DBG>& tmpvector);
67 
68 template<typename T, K_UINT_32 BEG, bool DBG>
69  inline int get(std::string name, Kalman::KMatrix<T,BEG,DBG>& tmpmatrix);
70 
71 template<typename T, K_UINT_32 BEG, bool DBG>
72  inline int add(std::string name, Kalman::KVector<T,BEG,DBG>& tmpvector, int type=ROW_VECTOR);
73 
74 template<typename T, K_UINT_32 BEG, bool DBG>
75  inline int add(std::string name, Kalman::KMatrix<T,BEG,DBG>& tmpmatrix);
76 
77  private:
78 
79  bool add_double(std::string &tmpstr);
80 
81  std::vector<MFileElement> VectorMFileElement;
82  std::vector<double> Data;
83 };
84 
85 }
86 
87 #include "MFile_impl.hpp"
88 
89 #endif
Minimalist vector template class.
Definition: kvector.hpp:72
int save(char *filename)
Definition: MFile.cpp:182
int read(char *filename)
Definition: MFile.cpp:45
unsigned int Rows
Definition: MFile.h:45
std::vector< double > Data
Definition: MFile.h:82
unsigned int Index
Definition: MFile.h:44
int add(std::string name, Kalman::KVector< T, BEG, DBG > &tmpvector, int type=ROW_VECTOR)
Definition: MFile_impl.hpp:74
unsigned int Cols
Definition: MFile.h:46
void print()
Definition: MFile.cpp:159
MFileElement & operator=(const MFileElement &tmp)
Definition: MFile.cpp:27
std::vector< MFileElement > VectorMFileElement
Definition: MFile.h:81
std::string Name
Definition: MFile.h:47
Minimalist matrix template class.
Definition: kmatrix.hpp:72
bool add_double(std::string &tmpstr)
Definition: MFile.cpp:167
#define ROW_VECTOR
Definition: MFile.h:39


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