/**
 * 集装箱第一步过滤Engine
 * */

#ifndef FILTERCHKDATESTEPONEENGINE_H
#define FILTERCHKDATESTEPONEENGINE_H

#include "AppCommon.h"
#include "MyYaml.h"
#include "EngineBase.h"
#include "EngineFactory.h"

class FilterContainerStepOneEngine : public ai_matrix::EngineBase
{
public:
    FilterContainerStepOneEngine();
    ~FilterContainerStepOneEngine();

    APP_ERROR Init() override;
    APP_ERROR DeInit() override;
    APP_ERROR Process() override;

private:
    //参数初始化(列车结束时需调用)
    void InitParam();
    //push数据到队列，队列满时则休眠一段时间再push
    void PushData(const std::string &strPort, const std::shared_ptr<ProcessData> &pProcessData);
    //根据当前帧数据，处理上一帧数据
    void DealProcessDataPre(std::shared_ptr<ProcessData> pProcessData);


    std::string strPort0_;

    std::map<int, std::shared_ptr<ProcessData>> mapProcessDataPre_; //[key-数据源id, value-上一帧处理数据]
    std::map<int, int> mapContainerContCnt_;                        //[key-数据源id, value-集装箱连续识别个数]
    std::map<int, int> mapTopSpaceContCnt_;                         //[key-数据源id, value-顶部间隔连续识别个数]
    std::map<int, bool> mapDataSourceIsEnd_;                        //[key-数据源id, value-数据是否结束]
};

ENGINE_REGIST(FilterContainerStepOneEngine)

#endif
