OnlineCardIdentifor.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. #include "Identifor.h"
  3. #include "OnlineCardIdentifyWorker.h"
  4. //////////////////////////////////////////////////////////////////////////
  5. // author liulang
  6. // date 2020-04-24
  7. //////////////////////////////////////////////////////////////////////////
  8. #ifdef _DEBUG
  9. #define ONLINE_WORKER_COUNT 1
  10. #else
  11. #define ONLINE_WORKER_COUNT 3
  12. #endif
  13. namespace OnLineCard{
  14. class COnlineCardIdentifor : public CIdentifor
  15. {
  16. #define max_result_buffer (1024*1024*10)
  17. #define max_result_buffer_count 6
  18. public:
  19. COnlineCardIdentifor();
  20. virtual ~COnlineCardIdentifor();
  21. public:
  22. void SetTemplate(PaperTemplate*pT){ m_template = pT; }
  23. PaperTemplate*GetTemplate(){ return m_template; }
  24. OMR_RESULT * GetResult(BOOL wait);
  25. void FreeResult(identify::result::OMR_RESULT * &result);
  26. virtual int GetMubanCount();
  27. protected:
  28. virtual ServiceState OnStarting(void) override;
  29. virtual ServiceState OnRunning(void) override;
  30. virtual ServiceState OnStoping(void) override;
  31. protected:
  32. COnlineCardIdentifyWorker m_Wordkers[ONLINE_WORKER_COUNT];
  33. void* m_result_buffer;
  34. void* result[max_result_buffer_count];
  35. int m_next_result_index;
  36. result_buffer_state m_buffer_state[max_result_buffer_count];
  37. PaperTemplate* m_template;
  38. CRITICAL_SECTION m_althom_rcs;
  39. CRITICAL_SECTION m_buffer_rcs;
  40. };
  41. }