generated from zhangwei/Matrixai
1 line
2.2 KiB
C++
1 line
2.2 KiB
C++
#include "Step1MergeEngine.h"
|
|
|
|
using namespace ai_matrix;
|
|
|
|
Step1MergeEngine::Step1MergeEngine() {}
|
|
|
|
Step1MergeEngine::~Step1MergeEngine() {}
|
|
|
|
APP_ERROR Step1MergeEngine::Init()
|
|
{
|
|
strPort0_ = engineName_ + "_" + std::to_string(engineId_) + "_0";
|
|
strPort1_ = engineName_ + "_" + std::to_string(engineId_) + "_1";
|
|
|
|
this->baseConfig_ = Config::getins()->getBaseConfig();
|
|
this->identifyConfig_ = Config::getins()->getIdentifyConfig();
|
|
|
|
this->multiTypeQueue_ = new ai_matrix::MultiTypeQueue(2);
|
|
LogInfo << "MergeEngine Init ok";
|
|
return APP_ERR_OK;
|
|
}
|
|
|
|
APP_ERROR Step1MergeEngine::DeInit()
|
|
{
|
|
LogInfo << "MergeEngine DeInit ok";
|
|
return APP_ERR_OK;
|
|
}
|
|
|
|
APP_ERROR Step1MergeEngine::Process()
|
|
{
|
|
int iRet = APP_ERR_OK;
|
|
while (!isStop_)
|
|
{
|
|
std::shared_ptr<void> pVoidData0 = nullptr;
|
|
inputQueMap_[strPort0_]->pop(pVoidData0);
|
|
if (nullptr == pVoidData0)
|
|
{
|
|
usleep(1000); //1ms
|
|
continue;
|
|
}
|
|
|
|
this->multiTypeQueue_->PushData(0, pVoidData0);
|
|
|
|
std::shared_ptr<void> pVoidData1 = nullptr;
|
|
inputQueMap_[strPort0_]->pop(pVoidData1);
|
|
if (nullptr == pVoidData1)
|
|
{
|
|
usleep(1000); //1ms
|
|
continue;
|
|
}
|
|
|
|
this->multiTypeQueue_->PushData(1, pVoidData1);
|
|
|
|
if (!this->multiTypeQueue_->PopAllData(pVoidData0, pVoidData1))
|
|
{
|
|
usleep(1000); //1ms
|
|
continue;
|
|
}
|
|
|
|
std::shared_ptr<VStep2OutputData> pVStep2OutputData =
|
|
std::static_pointer_cast<VStep2OutputData>(pVoidData0);
|
|
std::shared_ptr<VStep2OutputData> pVStep2OutputData_container =
|
|
std::static_pointer_cast<VStep2OutputData>(pVoidData1);
|
|
|
|
for (auto it = pVStep2OutputData_container->vecStep2ResultData.begin();
|
|
it != pVStep2OutputData_container->vecStep2ResultData.end();
|
|
++it)
|
|
{
|
|
pVStep2OutputData->vecStep2ResultData.emplace_back(*it);
|
|
}
|
|
|
|
outputQueMap_[strPort0_]->push(std::static_pointer_cast<void>(pVStep2OutputData), true);
|
|
outputQueMap_[strPort1_]->push(std::static_pointer_cast<void>(pVStep2OutputData), true);
|
|
}
|
|
return APP_ERR_OK;
|
|
}
|
|
|
|
|
|
|
|
|