#ifndef CONSTCACHE_H
#define CONSTCACHE_H

#include <QObject>
#include <QMap>
#include <QList>
#include <QJsonObject>

#include "CounterDevice.h"
#include "CounterChannel.h"

class CounterDevice;

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;
    }

    QMap<QString, QString> deviceTypes;

    QMap<QString, CounterDevice *> deviceMap; // 计数器对象集合 key=deviceId
    QList<QString> deviceIdLoopA; // A路计数器对象集合 key=deviceId
    QList<QString> deviceIdLoopB; // B路计数器对象集合 key=deviceId
    QMap<QString, CounterChannel *> channelMap; // 通道对象集合 key=deviceId-channelNo

private:
    ConstCache() {};

};

#endif // CONSTCACHE_H
