67 lines
1.8 KiB
C
67 lines
1.8 KiB
C
|
|
#pragma once
|
|||
|
|
/**
|
|||
|
|
* @file RICS_alg.h
|
|||
|
|
* @brief 从 DsmMapConfig::TableName(ZONE10)共享文件 读取 start end tags
|
|||
|
|
* 查ihd获取数据,保存文件
|
|||
|
|
* @author your name (you@domain.com)
|
|||
|
|
* @version 0.1
|
|||
|
|
* @date 2025-10-10
|
|||
|
|
*
|
|||
|
|
* Copyright: Baosight Co. Ltd.
|
|||
|
|
* DO NOT COPY/USE WITHOUT PERMISSION
|
|||
|
|
*
|
|||
|
|
*/
|
|||
|
|
#include <RICS/item2chinese.hpp>
|
|||
|
|
#include <RICS/public.h>
|
|||
|
|
#include <common/Macro.h>
|
|||
|
|
#include <glob/SingletonTemplate.h>
|
|||
|
|
#include <log4cplus/LOG.h>
|
|||
|
|
#include <memory>
|
|||
|
|
#include <nlohmann/json.hpp>
|
|||
|
|
#include <string>
|
|||
|
|
#include <vector>
|
|||
|
|
#include <zlib/MemCachedClient.h> ///MemCachedClient
|
|||
|
|
#include <zlib/MemVar.h>
|
|||
|
|
#include <zlib/zoneDef.h>
|
|||
|
|
using json = nlohmann::json;
|
|||
|
|
using namespace baosight;
|
|||
|
|
class RICSAlg {
|
|||
|
|
private:
|
|||
|
|
std::unique_ptr<LOG> logger_;
|
|||
|
|
std::map<int, CfgRuleInfo> alg_rule_info_; ///<规则信息 ruleid-RuleInfo
|
|||
|
|
std::map<string, string> key2values;
|
|||
|
|
std::map<int, int> alg_2_tagMax; ///<算法 对应 tagMax
|
|||
|
|
MemCachedClient m_memclient; ///< MemCachedClient
|
|||
|
|
const vector<int> AlgId = {1, 2, 3, 4, 5, 6, 7, 8,
|
|||
|
|
12, 13, 14, 15, 16, 17, 18};
|
|||
|
|
string unitNo_ = string(CMemVar::Const()->UnitNo); ///<机组号
|
|||
|
|
public:
|
|||
|
|
RICSAlg();
|
|||
|
|
~RICSAlg();
|
|||
|
|
/**
|
|||
|
|
* @brief 根据算法好处理数据
|
|||
|
|
* @param ruleid My Param doc
|
|||
|
|
*/
|
|||
|
|
void alg_handle(int algid);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 定时保存数据
|
|||
|
|
* 1. 获取所有的ruleid
|
|||
|
|
* 2.遍历ruleid,检测共享内存是否有ruleid的key
|
|||
|
|
* 3.调用RICS_handle
|
|||
|
|
*/
|
|||
|
|
void timed_task();
|
|||
|
|
|
|||
|
|
void dispose(int event_no, const ::Ice::ByteSeq &);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief 分算法号 处理信息 表达式 参数
|
|||
|
|
* @param param My Param doc
|
|||
|
|
* @param ruleInfo My Param doc
|
|||
|
|
*/
|
|||
|
|
void exp_handle(json &funciton_param, RuleInfo &ruleInfo, int algid);
|
|||
|
|
|
|||
|
|
string get_json_by_algid(int algid);
|
|||
|
|
|
|||
|
|
bool write_memcaced(string jkey, string jvalue);
|
|||
|
|
};
|