-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathuserFileLoader.h
57 lines (42 loc) · 1.23 KB
/
userFileLoader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef USERFILELOADER_H
#define USERFILELOADER_H
#include <QObject>
#include <QFile>
#include <QTextStream>
#include <QList>
#include "userFileStructure.h"
/**
* @file userFileLoader.h
*
* Implementation of UserFileLoader class.
* Used to read user properties from the file.
* The first should be read information about DOFs,
* and after information aboud sensor-motor conformity.
*/
class UserFileLoader : public UserFileStructure
{
public:
UserFileLoader(const QString &fileName);
bool isFileCorrect() const { return mIsFileCorrect; }
bool isFileEnd() const { return mIsFileEnd; }
bool isDOFRead() const { return mIsDOFData && isFileCorrect(); }
bool isConformityRead() const { return mIsConformityData && isFileCorrect(); }
/// Returns QList of 2 elements, min and max values of DOF.
QList<int> DOFList();
/// Returns QList of unknown size. Each value mean motor number.
QList<int> conformityList();
protected:
void beginParse();
void readDOF();
void readConformity();
/// DOF must lie in the interval from 0 to 1023.
bool isDOFcorrect(const int &min, const int &max);
private:
bool mIsDOFData;
bool mIsConformityData;
bool mIsFileCorrect;
bool mIsFileEnd;
QFile mFile;
QTextStream mStream;
};
#endif // USERFILELOADER_H