eis/eqpalg/gb_item_memory.h

74 lines
1.7 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
/**
* @file gb_item_memory.h
* @brief 全局共享内存电文解析程序
* @author Cat (null.null.null@qq.com)
* @version 0.1
* @date 2021-10-08
*
* Copyright: Baosight Co. Ltd.
* DO NOT COPY/USE WITHOUT PERMISSION
*
*/
#include <eqpalg/define/public.h>
#include <glob/BinaryTele.h>
#include <log4cplus/LOG.h>
// #include <shm/RuleStatShm.h>
// #include <zlib/MemCachedClient.h>
#include <zlib/MemVar.h>
#include <zlib/zoneDef.h>
#include <array>
#include <numeric>
#include <shared_mutex>
#include <string>
#include <unordered_map>
#include <zlib/MemFix.hpp>
#include <zlib/MemTable.hpp>
/**
* @brief 全局内存单例实例
* 从共享内存中获取电文对应的数值信息
*/
struct GlobaltemSharedMemory {
friend class AlgorithmManager;
friend class EqpAlgICEI;
protected:
public:
// GlobaltemSharedMemory() = default;
GlobaltemSharedMemory();
~GlobaltemSharedMemory() = default;
public:
/**
* @brief 获得指定tag点名的数据
* @param tag_name tag点名需要加机组号前缀
* @return double
*/
double operator[](std::string tag_name);
/**
* @brief Get the data size object
* @return int
*/
int get_data_size();
private:
static int instanceCount; // 声明静态成员变量
public:
static int get_instanceCount();
std::string get_data_json();
private:
/**
* @brief 缓存数据,并且会增加机组号信息
* @return int
*/
int cache_data();
BinaryTele binary_tele{CMemVar::Const()->event_eis_start, "T_LOV_FDAAITEM"};
map<int, CMemFix<PLC_DATA>*> m_mapfix;
size_t data_size_ = 0; ///<数据点个数
std::unique_ptr<LOG> logger_; ///< 本地logger
};