#pragma once /** * @file proxy_py.h * @brief c++与python 交互数据结构 * @author your name (you@domain.com) * @version 0.1 * @date 2025-10-15 * * Copyright: Baosight Co. Ltd. * DO NOT COPY/USE WITHOUT PERMISSION * */ #include "mix_cc/json.h" #include #include #include #include #include #include struct ProxPyMapConfig { static inline constexpr char TableName[] = "ZONE20"; static constexpr int MapMaxSize = 499; static constexpr int dataMaxLen = 2000; }; class ProxPy { private: /** * @brief 共享内存 数据结构 sizeof 16008 */ struct GlithData { double data[ProxPyMapConfig::dataMaxLen]; int data_szie = 0; int flag = 0; void update(std::array datax, int dataSize) { std::copy(datax.begin(), datax.end(), std::begin(data)); data_szie = dataSize; flag = data_szie - 2; } }; private: std::map prox_py_ptrs_; std::unique_ptr logger_; std::unique_ptr> ruleid_CMemMap_; const int CMemMapMaxSize = ProxPyMapConfig::MapMaxSize; const string table_name = ProxPyMapConfig::TableName; public: ProxPy(); ~ProxPy(); bool insert(std::string ruleid, std::array datax, int dataSize); bool send2py(std::string module_name, string content); void add_module(std::string module_name); };