Cleaned 66 files across all eqpalg subdirectories: - Removed commented-out dead code - Removed redundant Chinese inline comments that restate variable/function names - Removed trailing ///< annotations on self-explanatory fields - Removed namespace closing comments - Preserved all file headers, Doxygen documentation, and logic explanations - No code changes — only comment removal
58 lines
1.9 KiB
C++
58 lines
1.9 KiB
C++
#include <eqpalg/utility/proxy_py.h>
|
||
|
||
ProxPy::ProxPy() {
|
||
prox_py_ptrs_["glitch"] = ProxyMag::GetAppICEPrx("baosight/glitch");
|
||
logger_ = std::make_unique<LOG>("ProxyPy");
|
||
if (ruleid_CMemMap_ == nullptr) {
|
||
ruleid_CMemMap_ = std::make_unique<CMemMap<std::string, GlithData>>(
|
||
table_name, CMemMapMaxSize);
|
||
}
|
||
}
|
||
ProxPy::~ProxPy() {}
|
||
bool ProxPy::insert(std::string ruleid, std::array<double, 2000> datax,
|
||
int dataSize) {
|
||
try {
|
||
auto res = ruleid_CMemMap_->operator[](ruleid);
|
||
if (res == nullptr) {
|
||
logger_->Error() << "ruleid:" << ruleid
|
||
<< ",ruleid_CMemMap_->operator[](ruleid) return false!"
|
||
<< std::endl;
|
||
}
|
||
|
||
GlithData now_data;
|
||
now_data.update(datax, dataSize);
|
||
ruleid_CMemMap_->insert(ruleid, &now_data);
|
||
|
||
} catch (const std::exception &e) {
|
||
logger_->Error() << e.what() << std::endl;
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
bool ProxPy::send2py(std::string module_name, string content) {
|
||
try {
|
||
std::vector<unsigned char> seq((unsigned char *)content.c_str(),
|
||
(unsigned char *)content.c_str() +
|
||
content.length());
|
||
this->add_module(module_name);
|
||
prox_py_ptrs_[module_name]->SendDataShort(0, seq, content.length());
|
||
} catch (const std::exception &e) {
|
||
logger_->Error() << e.what() << std::endl;
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
void ProxPy::add_module(std::string module_name) {
|
||
try {
|
||
if (prox_py_ptrs_.find(module_name) != prox_py_ptrs_.end()) {
|
||
return;
|
||
}
|
||
string pre_name = "baosight/";
|
||
prox_py_ptrs_[module_name] =
|
||
ProxyMag::GetAppICEPrx((pre_name + module_name).c_str());
|
||
logger_->Debug() << "新增module:" << module_name << ","
|
||
<< pre_name + module_name << std::endl;
|
||
} catch (const std::exception &e) {
|
||
logger_->Error() << e.what() << std::endl;
|
||
}
|
||
} |