SEPIA
Software documentation for the APEX SEPIA receivers
inireader.h
Go to the documentation of this file.
1 /* Copyright 2017 Michael Olberg <michael.olberg@chalmers.se> */
2 #ifndef SETTINGSREADER_H
3 #define SETTINGSREADER_H
4 
5 #include <QObject>
6 #include <QFile>
7 #include <QMap>
8 
9 #include "../constants.h"
10 
11 typedef quint32 DWORD;
12 
22 struct Entry
23 {
24  enum Type { UNDEF=0, MCFLAG=1, MCWORD=2, MCFLOAT=4 };
25  Entry(DWORD a, Type t, int g, char u, bool flag, float lo, float hi);
26 
27  DWORD address;
28  Type type;
29  int gain;
30  char unit;
31  bool writable;
32  float min;
33  float max;
34 };
35 
41 {
42  public:
43  explicit IniFileReader(Sepia::Channel channel = Sepia::NONE);
44  explicit IniFileReader(const QString &filename);
45 
51  DWORD address(QString shortName) const;
52  Entry::Type type(QString shortName) const;
53  QString name(DWORD addr) const;
54  char unit(QString shortName) const;
55  int gain(QString shortName) const;
56  bool isSettable(QString shortName) const;
57  float hardMinimum(QString shortName) const;
58  float hardMaximum(QString shortName) const;
59  bool parse();
60 
61  public slots:
62  void dump();
63 
64  private:
65  Sepia::Channel m_channel;
66  QMap<QString, Entry *> map;
67  QFile iniFile;
68 };
69 
70 #endif // SETTINGSREADER_H
int gain
the gain associated with an entry.
Definition: inireader.h:29
char unit
the physical unit associated with an entry.
Definition: inireader.h:30
DWORD address
the address associated with an entry.
Definition: inireader.h:27
A class to parse Andrey Ermakov&#39;s ini file.
Definition: inireader.h:40
float max
hard maximum value for SET parameter.
Definition: inireader.h:33
Type type
the data type of an entry
Definition: inireader.h:28
Channel
An enumeration for the three SEPIA channels (cartridges).
Definition: constants.h:66
float min
hard minimum value for SET parameter.
Definition: inireader.h:32
bool writable
true for SET type, false for GET type of parameter.
Definition: inireader.h:31
A class to represent an entry in Andrey Ermakov&#39;s ini file.
Definition: inireader.h:22