Newer
Older
ZXSSCJ / PhaseCompAcq / common / ConstCache.h
#ifndef CONSTCACHE_H
#define CONSTCACHE_H

#include <QObject>
#include <QMap>
#include <QList>
#include <QJsonObject>
#include "PhaseDevice.h"

class ConstCache : public QObject
{
    Q_OBJECT
public:
    ~ConstCache() {}
    ConstCache(const ConstCache&)=delete;
    ConstCache& operator=(const ConstCache&)=delete;

    static ConstCache& getInstance() {
        static ConstCache instance;
        return instance;
    }

    // 最近的主路应用心跳时间戳
    qulonglong latestHeartTs = 0;

    // 设备列表  从接口返回的  JSON对象形式
    QList<QJsonObject> deviceList;

    // 存储所有设备的Map  key=deviceId
    QMap<QString, PhaseDevice *> deviceMap;

    // 存储所有通道的Map  key=channelId value=deviceId-no
    QMap<QString, QString> channelMap;

private:
    ConstCache() {}

};

#endif // CONSTCACHE_H