#ifndef GLOBALCONFIG_H #define GLOBALCONFIG_H #include /* ==================================================================================== * ************************** GlobalConfig成员函数 ****************************** * ====================================================================================*/ /** * @brief 读取配置文件 * */ class GlobalConfig { public: GlobalConfig(); ~GlobalConfig() = default; /* 读取配置文件 */ bool readConfig(const QString& strConfigFile); /* 打印读取到的值 */ void printValue(); int AppUpdateOnWorkTimeInterval;/* 更新在岗信息的时间间隔 */ int AppPeopleOnWork; /* 离岗时间 */ int Contraband; /* 违禁物品出现的时间 */ int AppBadMan; /* 非法入侵 */ int AppTired; /* 疲劳检测时间 */ int AppPeopleCont; /* 区域人员统计 */ int AppPlayPhone; /* 玩手机识别 */ int AppMouse; /* 老鼠识别 */ int AppMask; /* 戴口罩识别 */ int CheckSet; /* 服务端多久检测一次配置 */ int EventTimeValid; /* 事件时间有效期 */ int ThreadSleepMS; /* 任务线程休眠时间,单位是ms */ std::string Key; /* Key */ std::string Secret; /* Secret */ }; extern GlobalConfig g_config; /* ==================================================================================== * ************************ GlobalThreadInfo成员函数 ***************************** * ====================================================================================*/ #define GThreadInfo GlobalThreadInfo::getInstance() class GlobalThreadInfo { GlobalThreadInfo(); ~GlobalThreadInfo() {} GlobalThreadInfo(const GlobalThreadInfo& other) = delete; GlobalThreadInfo& operator=(const GlobalThreadInfo& other) = delete; public: static GlobalThreadInfo& getInstance() { static GlobalThreadInfo instance; return instance; } /* 获取线程运行标志位 */ inline bool getRunning() const; /* 设置线程运行标志位 */ inline void setRunning(bool bRunning); private: std::atomic_bool m_bRunning; /* 线程运行状态 */ }; #endif /* GLOBALCONFIG_H */