2015-01-15 20:05:44 +08:00
|
|
|
#ifndef LOADMAPPING_H
|
|
|
|
|
#define LOADMAPPING_H
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QHash>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QFile>
|
|
|
|
|
#include <QTextStream>
|
2015-01-15 21:56:30 +08:00
|
|
|
#include <QRegExp>
|
|
|
|
|
#include <QSharedPointer>
|
2015-01-16 21:21:29 +08:00
|
|
|
#include <QTime>
|
|
|
|
|
#include <QList>
|
2015-01-15 21:56:30 +08:00
|
|
|
|
2015-01-15 20:05:44 +08:00
|
|
|
#include "recursedir.h"
|
2015-01-15 21:56:30 +08:00
|
|
|
#include "loadinfo.h"
|
2015-01-16 16:27:05 +08:00
|
|
|
#include "loadmatchexception.h"
|
2015-01-15 20:05:44 +08:00
|
|
|
//这是一个单例
|
|
|
|
|
class LoadMapping
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
LoadMapping();
|
|
|
|
|
~LoadMapping();
|
2015-01-16 21:21:29 +08:00
|
|
|
bool broadcastUpdateByTime(const QTime& time);
|
2015-01-20 13:19:28 +08:00
|
|
|
QSharedPointer<LoadInfo> getALoad(const QString& id);
|
|
|
|
|
QVector<QSharedPointer<LoadInfo> > getSubstationLoad(const QString& id);
|
2015-01-15 22:06:19 +08:00
|
|
|
bool load(const QString& loadDir, const QString &matchdDir, const QString &exceptionFile);
|
2015-01-20 13:48:58 +08:00
|
|
|
|
2015-01-20 13:19:28 +08:00
|
|
|
|
2015-01-15 20:05:44 +08:00
|
|
|
private:
|
|
|
|
|
class CG // 它的唯一工作就是在析构函数中删除CSingleton的实例
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
~CG()
|
|
|
|
|
{
|
2015-01-16 21:21:29 +08:00
|
|
|
if (LoadMapping::loadsToLoadInfo)
|
|
|
|
|
delete LoadMapping::loadsToLoadInfo;
|
|
|
|
|
if (LoadMapping::loads)
|
|
|
|
|
delete LoadMapping::loads;
|
2015-01-15 20:05:44 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
static CG Garbo; // 定义一个静态成员,在程序结束时,系统会调用它的析构函数
|
2015-01-20 13:48:58 +08:00
|
|
|
bool readLoads(const QString& dir);
|
|
|
|
|
bool readMatch(const QString& dir);
|
2015-01-16 21:21:29 +08:00
|
|
|
// static QHash<QString,QVector<double> > *ht;//
|
|
|
|
|
static QHash<QString,QVector<QSharedPointer<LoadInfo> > > *loads;//保存的是一个Substation下面的所有负荷信息
|
|
|
|
|
static QHash<QString,QSharedPointer<LoadInfo> > *loadsToLoadInfo;
|
2015-01-16 16:27:05 +08:00
|
|
|
LoadMatchException loadMatchException;
|
2015-01-15 20:05:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // LOADMAPPING_H
|