123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #pragma once
- #include <opencv\cv.h>
- #include <opencv\cxcore.h>
- #include <opencv2\opencv.hpp>
- using namespace cv;
- enum SCAN_TASK_TYPE{
- SCAN_TASK_TYPE_NORMAL,
- SCAN_TASK_TYPE_ADJUST_BATCH,
- SCAN_TASK_TYPE_ADJUST_EXAMINNE,
- };
- enum DATABASE_STATE{
- //创建
- DATABASE_STATE_CREATE,
- //扫描中
- DATABASE_STATE_SCANNING,
- //扫描完成
- DATABASE_STATE_SCAN_OVER,
- //放弃
- DATABASE_STATE_GIVEUP,
- //成绩上传中
- DATABASE_STATE_RESULT_UPLOADING,
- //成绩上传完成
- DATABASE_STATE_RESULT_UPLOADED,
- //图片上传中
- DATABASE_STATE_IMG_UPLOADING,
- //图片上传暂停
- DATABASE_STATE_IMG_PAUSED,
- //图片上传完成
- DATABASE_STATE_IMG_UPLOADED,
- //正在删除数据库
- DATABASE_STATE_DELETING,
- //数据库已经删除
- DATABASE_STATE_DELETED,
- //无效状态
- DATABASE_STATE_CREATE_INVALID=9999,
- };
- enum ServiceState{
- stoped,
- starting,
- running,
- pausing,
- paused,
- resuming,
- stoping
- };
- class IService{
- public:
- IService(void);
- ~IService(void);
- // 启动服务
- virtual BOOL Start(void);
- // 停止服务
- virtual BOOL Stop(void);
- // 暂停服务
- virtual BOOL Pause(void);
- // 恢复服务
- virtual BOOL Resume(void);
- // 是否支持暂停
- virtual BOOL SupportPause(void);
- //获取服务当前状态
- ServiceState GetServiceSate(void);
- //运行函数
- UINT Run0();
- protected:
- enum command{
- command_none,
- command_start,
- command_pause,
- command_resume,
- command_stop
- };
- command m_command;
- //服务状态
- ServiceState m_serviceState;
- //状态同步锁
- RTL_CRITICAL_SECTION m_state_lock;
- //在服务状态为oldState时,设置服务状态
- inline BOOL SetServiceSate(ServiceState newState,ServiceState oldState);
- // 服务执行方法
- virtual int Run(void);
- virtual ServiceState OnStarting(void);
- virtual ServiceState OnRunning(void);
- virtual ServiceState OnPausing(void);
- virtual ServiceState OnPaused(void);
- virtual ServiceState OnResuming(void);
- virtual ServiceState OnStoping(void);
- private:
- //服务线程
- CWinThread * m_serviceThread;
- };
|