You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.6 KiB
C++
50 lines
1.6 KiB
C++
#include "FITKProgramTaskManager.h"
|
|
#include "FITKProgramDriverFactory.h"
|
|
|
|
namespace AppFrame
|
|
{
|
|
void FITKProgramTaskManeger::startProgram(const int type, const QString& programName, FITKProgramInputInfo* info)
|
|
{
|
|
auto fac = FITKProgramDriverFactory::getInstance();
|
|
auto fun = fac->getDriverCreateFun(type, programName);
|
|
if (fun == nullptr) return;
|
|
|
|
FITKAbstractProgramerDriver* driver = fun();
|
|
if (driver == nullptr) return;
|
|
driver->setInputInfo(info);
|
|
driver->start();
|
|
this->appendDataObj(driver);
|
|
}
|
|
|
|
//创建第三方驱动程序 返回值不能手动销毁,由第三方程序执行任务管理器统一管理
|
|
FITKAbstractProgramerDriver* FITKProgramTaskManeger::createProgram(const int type, const QString & programName, FITKProgramInputInfo * info)
|
|
{
|
|
auto fac = FITKProgramDriverFactory::getInstance();
|
|
auto fun = fac->getDriverCreateFun(type, programName);
|
|
//获取构造函数指针
|
|
if (fun == nullptr) return nullptr;
|
|
//调用构造
|
|
FITKAbstractProgramerDriver* driver = fun();
|
|
if (driver == nullptr) return nullptr;
|
|
driver->setInputInfo(info);
|
|
this->appendDataObj(driver);
|
|
return driver;
|
|
}
|
|
|
|
void FITKProgramTaskManeger::killAll()
|
|
{
|
|
const int n = this->getDataCount();
|
|
for (int i = 0; i < n; ++i)
|
|
{
|
|
FITKAbstractProgramerDriver* d = this->getDataByIndex(i);
|
|
if (d == nullptr) continue;
|
|
d->stop();
|
|
delete d;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|