2019-02-25 08:32:15 +01:00
|
|
|
#ifndef ABSTRACTDATA_H
|
|
|
|
#define ABSTRACTDATA_H
|
|
|
|
|
2019-02-25 08:36:58 +01:00
|
|
|
#include <QString>
|
|
|
|
#include <QByteArray>
|
|
|
|
#include "hpusb.h"
|
2019-03-02 20:20:23 +01:00
|
|
|
#include "matrixdata.h"
|
2019-02-25 08:36:58 +01:00
|
|
|
|
|
|
|
enum hp_DataType{
|
|
|
|
HP_MAIN=0,
|
|
|
|
HP_APP=1,
|
|
|
|
HP_CAS=2,
|
|
|
|
HP_COMPLEX=3,
|
|
|
|
HP_LIST=4,
|
|
|
|
HP_MATRIX=5,
|
|
|
|
HP_NOTE=6,
|
|
|
|
HP_PROG=7,
|
|
|
|
HP_REAL=8,
|
|
|
|
HP_VAR=9,
|
2019-03-09 15:39:38 +01:00
|
|
|
HP_SCREEN=10,
|
|
|
|
HP_SETTINGS=10
|
2019-02-25 08:36:58 +01:00
|
|
|
};
|
2019-02-25 08:32:15 +01:00
|
|
|
|
2019-03-02 20:20:23 +01:00
|
|
|
struct m_Size {
|
|
|
|
int row;
|
|
|
|
int column;
|
|
|
|
};
|
|
|
|
|
2019-02-25 08:32:15 +01:00
|
|
|
class AbstractData
|
|
|
|
{
|
2019-02-25 08:36:58 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
QString name;
|
|
|
|
hp_DataType type;
|
|
|
|
hp_pkt_type file_code;
|
2019-03-02 20:20:23 +01:00
|
|
|
|
|
|
|
protected:
|
2019-02-25 08:36:58 +01:00
|
|
|
QByteArray data;
|
|
|
|
|
|
|
|
public:
|
|
|
|
AbstractData(QString, hp_DataType);
|
|
|
|
inline bool operator ==(AbstractData& lhs);
|
|
|
|
bool equivalent(QString, hp_DataType);
|
|
|
|
void setName(QString);
|
|
|
|
QString getName();
|
|
|
|
void setType(hp_DataType);
|
|
|
|
hp_DataType getType();
|
|
|
|
void setFileCode(hp_pkt_type);
|
|
|
|
hp_pkt_type getFileCode();
|
2019-04-02 21:14:31 +02:00
|
|
|
virtual void setData(QByteArray);
|
2019-09-15 17:23:44 +02:00
|
|
|
virtual QByteArray getData(); //data extract
|
2019-03-02 20:20:23 +01:00
|
|
|
virtual void parseData();
|
2019-04-02 21:14:31 +02:00
|
|
|
virtual void parseData(QDataStream& in);
|
2019-09-15 17:23:44 +02:00
|
|
|
virtual QByteArray fileOut(); //full data out in file transmittable format
|
|
|
|
virtual ~AbstractData();
|
2019-02-25 08:36:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-02-25 19:28:45 +01:00
|
|
|
class Application: public AbstractData
|
|
|
|
{
|
2019-03-02 20:20:23 +01:00
|
|
|
private:
|
|
|
|
void parseData();
|
2019-02-25 19:28:45 +01:00
|
|
|
public:
|
|
|
|
Application(QString, hp_DataType);
|
|
|
|
};
|
|
|
|
|
2019-03-02 20:20:23 +01:00
|
|
|
class Real: public AbstractData
|
2019-02-25 08:36:58 +01:00
|
|
|
{
|
2019-03-02 20:20:23 +01:00
|
|
|
private:
|
2019-03-09 21:11:43 +01:00
|
|
|
QList <itemData>values;
|
2019-03-02 20:20:23 +01:00
|
|
|
void parseData();
|
2019-02-25 08:36:58 +01:00
|
|
|
public:
|
|
|
|
Real(QString, hp_DataType);
|
2019-03-09 21:11:43 +01:00
|
|
|
itemData getListItem(int);
|
|
|
|
void setListItem(int, itemData);
|
|
|
|
QString getItem(int);
|
|
|
|
void setItem(int, QString);
|
|
|
|
void setItem(int, QString, double);
|
|
|
|
int getListSize();
|
2019-02-25 08:36:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class Complex: public AbstractData
|
|
|
|
{
|
2019-03-02 20:20:23 +01:00
|
|
|
private:
|
2019-03-16 20:34:09 +01:00
|
|
|
QList <itemData>values;
|
2019-03-02 20:20:23 +01:00
|
|
|
void parseData();
|
2019-02-25 08:32:15 +01:00
|
|
|
public:
|
2019-02-25 08:36:58 +01:00
|
|
|
Complex(QString, hp_DataType);
|
2019-03-16 20:34:09 +01:00
|
|
|
itemData getListItem(int);
|
|
|
|
void setListItem(int, itemData);
|
|
|
|
QString getItem(int);
|
|
|
|
void setItem(int, QString);
|
|
|
|
void setItem(int, QString, double);
|
|
|
|
int getListSize();
|
2019-02-25 08:32:15 +01:00
|
|
|
};
|
|
|
|
|
2019-03-02 20:20:23 +01:00
|
|
|
|
|
|
|
class List: public AbstractData
|
2019-02-25 08:36:58 +01:00
|
|
|
{
|
2019-03-02 20:20:23 +01:00
|
|
|
private:
|
|
|
|
QList <itemData>values;
|
|
|
|
void parseData();
|
2019-02-25 08:36:58 +01:00
|
|
|
public:
|
|
|
|
List(QString, hp_DataType);
|
2019-03-02 20:20:23 +01:00
|
|
|
QByteArray getData();
|
|
|
|
itemData getListItem(int);
|
|
|
|
void setListItem(int, itemData);
|
|
|
|
QString getItem(int);
|
|
|
|
void setItem(int, QString);
|
|
|
|
void setItem(int, QString, double);
|
|
|
|
int getListSize();
|
2019-02-25 08:36:58 +01:00
|
|
|
};
|
|
|
|
|
2019-03-02 20:20:23 +01:00
|
|
|
class Matrix: public AbstractData
|
2019-02-25 08:36:58 +01:00
|
|
|
{
|
2019-03-02 20:20:23 +01:00
|
|
|
private:
|
|
|
|
MatrixData mdata;
|
|
|
|
void parseData();
|
2019-02-25 08:36:58 +01:00
|
|
|
public:
|
|
|
|
Matrix(QString, hp_DataType);
|
2019-03-02 20:20:23 +01:00
|
|
|
itemData getListItem(int row, int column);
|
|
|
|
void setListItem(int, int, itemData);
|
|
|
|
QString getItem(int row, int column);
|
|
|
|
void setItem(int, int, QString);
|
|
|
|
void setItem(int, int, QString, double);
|
|
|
|
m_Size getMatrixSize();
|
|
|
|
int getMatrixRows();
|
|
|
|
int getMatrixColumns();
|
2019-02-25 08:36:58 +01:00
|
|
|
};
|
|
|
|
|
2019-03-02 20:20:23 +01:00
|
|
|
class Program: public AbstractData
|
2019-02-25 08:36:58 +01:00
|
|
|
{
|
|
|
|
private:
|
2019-02-26 20:56:39 +01:00
|
|
|
QString text;
|
2019-04-02 21:14:31 +02:00
|
|
|
|
2019-02-25 08:36:58 +01:00
|
|
|
public:
|
|
|
|
Program(QString, hp_DataType, QString);
|
|
|
|
void setProg(QString);
|
|
|
|
QString getProg();
|
2019-04-02 21:14:31 +02:00
|
|
|
void parseData();
|
|
|
|
virtual void parseData(QDataStream& in);
|
2019-09-15 17:23:44 +02:00
|
|
|
virtual QByteArray fileOut();
|
2020-01-18 19:27:42 +01:00
|
|
|
virtual ~Program();
|
2019-02-25 08:36:58 +01:00
|
|
|
};
|
|
|
|
|
2019-03-02 20:20:23 +01:00
|
|
|
class Notes: public AbstractData
|
2019-02-25 08:36:58 +01:00
|
|
|
{
|
2019-02-26 20:56:39 +01:00
|
|
|
private:
|
|
|
|
QString text;
|
2019-03-02 20:20:23 +01:00
|
|
|
QString format;
|
|
|
|
void parseData();
|
2019-02-25 08:36:58 +01:00
|
|
|
public:
|
2019-02-26 20:56:39 +01:00
|
|
|
Notes(QString, hp_DataType, QString);
|
|
|
|
void setNote(QString);
|
|
|
|
QString getNote();
|
2019-02-25 08:36:58 +01:00
|
|
|
};
|
|
|
|
|
2019-03-09 15:39:38 +01:00
|
|
|
class Variables: public AbstractData
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
QString text;
|
|
|
|
QString format;
|
|
|
|
void parseData();
|
|
|
|
public:
|
|
|
|
Variables(QString, hp_DataType);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CASVariables: public AbstractData
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
QString text;
|
|
|
|
QString format;
|
|
|
|
void parseData();
|
|
|
|
public:
|
|
|
|
CASVariables(QString, hp_DataType);
|
|
|
|
};
|
2019-02-25 08:36:58 +01:00
|
|
|
|
2019-03-09 15:39:38 +01:00
|
|
|
class Settings: public AbstractData
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
QString text;
|
|
|
|
QString format;
|
|
|
|
void parseData();
|
2019-04-02 21:14:31 +02:00
|
|
|
|
2019-03-09 15:39:38 +01:00
|
|
|
public:
|
|
|
|
Settings(QString, hp_DataType);
|
2019-04-02 21:14:31 +02:00
|
|
|
virtual void setData(QByteArray);
|
2019-03-09 15:39:38 +01:00
|
|
|
};
|
2019-02-25 08:36:58 +01:00
|
|
|
|
|
|
|
#endif // ABSTRACTDATA_H
|