123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #pragma once
- // 下列 ifdef 块是创建使从 DLL 导出更简单的
- // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 DRIVERTHREAD_EXPORTS
- // 符号编译的。在使用此 DLL 的
- // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
- // DRIVERTHREAD_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
- // 符号视为是被导出的。
- #ifndef DRIVERTHREAD_EXPORTS
- #ifdef _WIN64
- #ifdef _DEBUG
- #pragma comment(lib, "DriverThreadX64D.lib")
- #else
- #pragma comment(lib, "DriverThreadX64.lib")
- #endif
- #else
- #ifdef _DEBUG
- #pragma comment(lib, "DriverThreadD.lib")
- #else
- #pragma comment(lib, "DriverThread.lib")
- #endif
- #endif
- #endif
- #ifdef DRIVERTHREAD_EXPORTS
- #define DRIVERTHREAD_API __declspec(dllexport)
- #else
- #define DRIVERTHREAD_API __declspec(dllimport)
- #endif
- #include "MsgMap.h"
- #include "MsgVector.h"
- #include "DiosThread.h"
- #include "LogicDevice.h"
- class DRIVERTHREAD_API Driver_Thread : public Work_Thread
- {
- protected:
- bool HandleClientRequest();
- bool HandleDeviceNotify();
- MsgMap<UINT64, LogicDeviceSysIF*> *m_pDeviceSysIFMap;
- MsgVector<LogicDeviceSysIF*> *m_pDeviceSysIFVec;
- virtual bool Exec();
- virtual bool OnEndThread();
- virtual bool OnStartThread();
- public:
- Driver_Thread(void);
- virtual ~Driver_Thread(void);
- //work
- //IF
- void RegistSysIFObject(LogicDeviceSysIF* pobj);
- bool UnRegistSysIFObject(LogicDeviceSysIF* pobj);
- };
- class DRIVERTHREAD_API Notify_Driver_Thread : public Driver_Thread
- {
- public:
- Notify_Driver_Thread(void);
- virtual ~Notify_Driver_Thread(void);
- protected:
- int WaitForEvent();//Req,NotifyPacket,NotifyEvt
- virtual bool Exec();
- bool ProcessDeviceEvent(size_t Idx);
- };
- class DRIVERTHREAD_API Dual_Driver_Thread
- {
- Driver_Thread *m_pReqThread;
- Driver_Thread *m_pResThread;
- public:
- Dual_Driver_Thread(void);
- virtual ~Dual_Driver_Thread(void);
- //IF
- void InitDriverThread(Driver_Thread *pReq, Driver_Thread *pRes);
- bool HasThread(DWORD Tid);
- bool StartThread(bool Sync = true, bool Inherit = true);
- bool StopThread(DWORD timeperiod = 10000);
- bool PushReqDataObject(ResDataObject &obj);
- bool PushResDataObject(ResDataObject &obj);
- void RegistSysIFObject(LogicDeviceSysIF* pobj);
- bool UnRegistSysIFObject(LogicDeviceSysIF* pobj);
- void SetLogger(PVOID pLogger);
- };
|