AnalysisSystemForRadionucli.../analyseflow.cpp

55 lines
1.4 KiB
C++

#include "analyseflow.h"
#include <QDebug>
//FlowThread::FlowThread(PHDFile *phd, QMap<QString, NuclideLines> mapNucLines, stdvec vc, QString strPath, ThrCallBack callFunc, QObject *parent)
// : QThread(parent), m_phd(phd), m_mapNucLines(mapNucLines),m_vCount(vc)
FlowThread::FlowThread(DataStore *store, QString strPath, ThrCallBack callFunc, QObject *parent)
: QThread(parent)
{
m_store = store;
m_phd = store->m_phd;
m_mapNucLines = store->GetNuclideLines();
m_vCount = store->m_vCount;
m_strPath = strPath;
m_callFunc = callFunc;
qDebug() << "123";
}
FlowThread::~FlowThread()
{
delete alg;
}
void FlowThread::run()
{
alg = new GammaAnalyALG();
alg->setFilePath(m_strPath+"/setup");
alg->AnalyseSpectrum(m_phd, m_mapNucLines);
if(m_callFunc)
{
m_callFunc();
}
}
AnalyseFlow::AnalyseFlow(DataStore *store, QString strPath, ThrCallBack callFunc, QObject *parent) : m_bUpdate(store->m_phd->setting.bUpdateCal && !store->m_phd->bAnalyed)
{
m_store = store;
// 创建线程并启动
// m_flowThread = new FlowThread(store->m_phd, store->GetNuclideLines(),store->m_vCount, strPath, callFunc);
m_flowThread = new FlowThread(store, strPath, callFunc);
m_flowThread->start();
}
AnalyseFlow::~AnalyseFlow()
{
if(m_flowThread->isRunning())
{
m_flowThread->quit();
m_flowThread->wait();
}
m_flowThread->deleteLater();
}