|
@@ -18,7 +18,30 @@
|
|
|
extern int g_eventTimeVaild;
|
|
|
|
|
|
|
|
|
+/* 线程运行时的状态 */
|
|
|
+enum class RunTimeState
|
|
|
+{
|
|
|
+ RUN_STATE_INIT = 0, /* 初始化 */
|
|
|
+ RUN_STATE_RUN, /* 运行 */
|
|
|
+ RUN_STATE_STOP, /* 停止 */
|
|
|
+ RUN_STATE_ERROR, /* 错误 */
|
|
|
+ RUN_STATE_NONE /* 无状态 */
|
|
|
+};
|
|
|
|
|
|
+/* 应用功能 */
|
|
|
+enum class AppFunction
|
|
|
+{
|
|
|
+ APP_NONE = 0, /* 无功能 */
|
|
|
+ APP_ONWORK = 1, /* 人员在岗识别 */
|
|
|
+ APP_CONTRABAND, /* 违禁品识别 */
|
|
|
+ APP_ILLEGAL, /* 非法入侵检测 */
|
|
|
+ APP_FATIGUE, /* 疲劳检测 */
|
|
|
+ APP_REGIONAL, /* 区域人员检测 */
|
|
|
+ APP_MOUSE, /* 老鼠识别 */
|
|
|
+ APP_PLAYPHONE, /* 玩手机识别 */
|
|
|
+ APP_NOMASK, /* 无口罩识别 */
|
|
|
+ APP_ALLDOWN, /* 摔倒识别 */
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
@@ -245,15 +268,11 @@ struct RoomCameraInfo
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-/* 线程运行时的状态 */
|
|
|
-enum class RunTimeState
|
|
|
-{
|
|
|
- RUN_STATE_INIT = 0, /* 初始化 */
|
|
|
- RUN_STATE_RUN, /* 运行 */
|
|
|
- RUN_STATE_STOP, /* 停止 */
|
|
|
- RUN_STATE_ERROR, /* 错误 */
|
|
|
- RUN_STATE_NONE /* 无状态 */
|
|
|
-};
|
|
|
+/* ====================================================================================
|
|
|
+ * **************************** 线程功能需要的结构体 *****************************
|
|
|
+ * ====================================================================================*/
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @brief 单个算法信息,包括包含的摄像机,房间、频率信息
|
|
@@ -270,46 +289,10 @@ struct ActionInfo
|
|
|
std::string strRoomName; /* 房间名称 */
|
|
|
std::string strActionName; /* 算法名称,这个是自定义的,不需要对比 */
|
|
|
|
|
|
- ActionInfo() {
|
|
|
- RunState = RunTimeState::RUN_STATE_INIT;
|
|
|
- ChannelID = -1;
|
|
|
- RoomID = -1;
|
|
|
- CameraID = -1;
|
|
|
- RoomType = -1;
|
|
|
- ActionID = "";
|
|
|
- strRoomName = "";
|
|
|
- strActionName = "";
|
|
|
- }
|
|
|
- ActionInfo& operator=(const ActionInfo& other) {
|
|
|
- if (this != &other) {
|
|
|
- ChannelID = other.ChannelID;
|
|
|
- RoomID = other.RoomID;
|
|
|
- CameraID = other.CameraID;
|
|
|
- ActionID = other.ActionID;
|
|
|
- strRoomName = other.strRoomName;
|
|
|
- RoomType = other.RoomType;
|
|
|
- }
|
|
|
- return *this;
|
|
|
- }
|
|
|
+ ActionInfo();
|
|
|
+ ActionInfo& operator=(const ActionInfo& other);
|
|
|
/* 对比是否相等,这个需要完全相等,包括算法信息和摄像机信息 */
|
|
|
- bool operator==(const ActionInfo& other) const {
|
|
|
- if(ChannelID != other.ChannelID) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(RoomID != other.RoomID) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(CameraID != other.CameraID) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(ActionID != other.ActionID) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(RoomType != other.RoomType) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
+ bool operator==(const ActionInfo& other);
|
|
|
/* 对比除摄像机外的基础信息是否相等 */
|
|
|
bool isEqualBaseInfo(const ActionInfo& other);
|
|
|
|
|
@@ -427,6 +410,64 @@ public:
|
|
|
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * @brief 房间内的摄像机和算法关联信息
|
|
|
+ *
|
|
|
+ */
|
|
|
+ struct RoomCamActInfo
|
|
|
+ {
|
|
|
+ int RoomID; /* 房间ID */
|
|
|
+ int RoomType; /* 房间类型 */
|
|
|
+ std::multimap<int, std::string> mapCameraAction; /* 摄像机ID和算法ID关联信息 */
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief 按照功能分类的线程信息,一个实例就是一个功能,
|
|
|
+ 比如区域入侵检测,需要多个算法多个摄像机共同配合
|
|
|
+ *
|
|
|
+ */
|
|
|
+ struct FuncActionInfo
|
|
|
+ {
|
|
|
+ int ChannelID; /* 通道ID */
|
|
|
+ AppFunction appFunction; /* 任务功能 */
|
|
|
+ RunTimeState RunState; /* 线程运行状态 */
|
|
|
+ std::string strFunctionName; /* 功能名称 */
|
|
|
+ std::chrono::system_clock::time_point StartTime; /* 开始时间 */
|
|
|
+ std::chrono::system_clock::time_point EndTime; /* 结束时间 */
|
|
|
+ std::list<RoomCamActInfo> listRoomCamActInfo; /* 房间内的摄像机和算法关联信息 */
|
|
|
+
|
|
|
+ FuncActionInfo();
|
|
|
+ FuncActionInfo& operator=(FuncActionInfo& other);
|
|
|
+ /* 添加算法信息 */
|
|
|
+ bool addActionInfo(const ActionInfo& info);
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+/**
|
|
|
+ * @brief
|
|
|
+ *
|
|
|
+ */
|
|
|
+ struct ListFuncActInfo
|
|
|
+ {
|
|
|
+ ListFuncActInfo() = default;
|
|
|
+
|
|
|
+ /* 添加功能信息 */
|
|
|
+ bool addFuncActionInfo(FuncActionInfo* pInfo);
|
|
|
+ /* 添加算法信息 */
|
|
|
+ bool addActionInfo(const ActionInfo& info);
|
|
|
+ /* 清空无用的功能信息 */
|
|
|
+ void clearNoneFuncActionInfo();
|
|
|
+ /* 查找功能信息 */
|
|
|
+ FuncActionInfo* findFuncActionInfo(const std::string& strFunctionName);
|
|
|
+ /* 获取容器 */
|
|
|
+ std::list<FuncActionInfo*>& getData() {
|
|
|
+ return listFuncActionInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ std::list<FuncActionInfo*> listFuncActionInfo; /* 功能信息列表 */
|
|
|
+ };
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @brief 读取配置文件
|