87 lines
2.0 KiB
C
87 lines
2.0 KiB
C
|
|
#pragma once
|
|||
|
|
/**
|
|||
|
|
* @file eqpalg/algorithm_manager.h
|
|||
|
|
* @brief 算法管理器,程序的主要管理器实现
|
|||
|
|
* @author Cat (null.null.null@qq.com)
|
|||
|
|
* @version 0.1
|
|||
|
|
* @date 2021-09-17
|
|||
|
|
*
|
|||
|
|
* Copyright: Baosight Co. Ltd.
|
|||
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
|||
|
|
* changelog:
|
|||
|
|
* 2021年9月22日 将多进程的处理机制下放到manager,减少冗余代码
|
|||
|
|
*/
|
|||
|
|
#include <common/Macro.h>
|
|||
|
|
#include <eqpalg/alg_base.h>
|
|||
|
|
#include <eqpalg/gb_item_memory.h>
|
|||
|
|
#include <eqpalg/threads/manager.h>
|
|||
|
|
#include <eqpalg/utility/item2chinese.hpp>
|
|||
|
|
#include <map>
|
|||
|
|
#include <memory>
|
|||
|
|
#include <stdlib.h>
|
|||
|
|
#include <string>
|
|||
|
|
#include <tuple>
|
|||
|
|
using namespace std;
|
|||
|
|
using namespace baosight;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 算法管理器类
|
|||
|
|
*/
|
|||
|
|
class AlgorithmManager {
|
|||
|
|
public:
|
|||
|
|
/**
|
|||
|
|
* @brief Construct a new Algorithm Manager object
|
|||
|
|
* 构建算法管理器,并载入所有的已配置算法
|
|||
|
|
*/
|
|||
|
|
AlgorithmManager();
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief Destroy the Algorithm Manager:: Algorithm Manager object
|
|||
|
|
* 释放所有创建的算法实例
|
|||
|
|
*/
|
|||
|
|
virtual ~AlgorithmManager();
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
/**
|
|||
|
|
* @brief 根据任务行为描述进行不同的操作
|
|||
|
|
* @param event_no 事件号
|
|||
|
|
* @param seq ice调用传递的二进制序列
|
|||
|
|
*/
|
|||
|
|
virtual void dispose(int event_no, const ::Ice::ByteSeq &);
|
|||
|
|
|
|||
|
|
// 缓存数据
|
|||
|
|
int cache_data();
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 记录模型启动时间
|
|||
|
|
*/
|
|||
|
|
int update_rule_start_time(std::string ruleId);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 记录模型修改时间
|
|||
|
|
* @param ruleId My Param doc
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int update_rule_modify_time(std::string ruleId);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 删除模型 更新trrt表中的记录
|
|||
|
|
* @param ruleId My Param doc
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int delete_trrt_record(std::string ruleId);
|
|||
|
|
|
|||
|
|
void rule_handelr(std::string data_info);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief Get the thread size object
|
|||
|
|
* @return int
|
|||
|
|
*/
|
|||
|
|
int get_thread_size();
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
std::unique_ptr<LOG> logger_; ///< logger类
|
|||
|
|
|
|||
|
|
threads::Manager thread_manager_; ///< 任务线程
|
|||
|
|
};
|