123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #pragma once
- #include "basic_struct_private.h"
- #include "..\Identifier\schema_struct.h"
- #include "scan_common.h"
- #include "feeder.h"
- class CIdentifyTask;
- /*表示一个识别任务的【结果管理】*/
- class CResultManager{
- enum
- {
- max_result_buffer_count = 6
- };
- public:
- CResultManager(int buffer_len = max_result_buffer_count);
- ~CResultManager();
- void reset();
- void open();
- identify::result::OMR_RESULT * getNextResult();
- identify::result::OMR_RESULT * GetResult(BOOL wait);
- void FreeResult(identify::result::OMR_RESULT * &result);
- result_buffer_state * getBufferstate(void * result);
- void setIdentifyComplete(bool iscomplete);
- private:
- bool identify_complete;
- int m_buffer_len;
- std::vector<identify::result::OMR_RESULT> m_result_buffer;
- std::vector<identify::result::OMR_RESULT *> result;
- std::vector<result_buffer_state> m_buffer_state;
- int m_next_result_index;
- };
- #define MAX_UNHANDLED_PAGE 12
- struct UnhandledPage{
- bool identified;
- int page_index;
- std::string student_code;
- std::string student_id;
- identify::result::OMR_RESULT * omr_result;
- };
- struct UnhandledPageInfo{
- UnhandledPage unhandled_pages[MAX_UNHANDLED_PAGE];
- int first_unhandled_page_index;
- int unhandled_page_count;
- bool m_stop;
- CIdentifyTask* task;
- CResultManager* result;
- bool bOnlineCard; // 是否是在线答题卡
- int nSubjectID;
- };
- /*表示一个 【识别任务】*/
- class CIdentifyTask{
- public:
- CIdentifyTask();
- ~CIdentifyTask();
- CResultManager * getResultBufferManager();
- UnhandledPageInfo * getUnhandledPageManager();
- IFeeder * GetFeeder();
- void SetFeeder(IFeeder * feeder);
- private:
- IFeeder * feeder;
- CResultManager result;
- UnhandledPageInfo unhandleds;
- };
- /*表示一个 【识别任务管理】*/
- class CIdentifyTaskManager{
- public:
- CIdentifyTaskManager();
- ~CIdentifyTaskManager();
- //创建扫描任务
- CIdentifyTask* createTask();
- //执行任务
- void ExcuTask(CIdentifyTask* task);
- //设置主要任务
- void setMainTask(CIdentifyTask* task);
- //获取主要任务
- CIdentifyTask* MainTask();
- //获取当前正在识别的任务
- CIdentifyTask* getCurrentIdentifyTask();
- //获取下一个识别的任务
- CIdentifyTask* getNextIdentifyTask();
- //获取当前需要处理结果的任务
- CIdentifyTask* getCurrentHandleTask();
- //完成(销毁扫描任务)
- void doneTask(CIdentifyTask* task);
- private:
- //主要任务(task)
- CIdentifyTask* main_task;
- int idenfity_task_index;
- int handle_task_index;
- //存储所有需要执行的task
- std::vector<CIdentifyTask* > tasks;
- //存储所有已经创建的task
- std::vector<CIdentifyTask* > tasks0;
- };
|