From e51c6d1360f9679dd8e4dd3379ce0db1886badbf Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 28 七月 2025 17:36:57 +0800
Subject: [PATCH] Merge branch 'EAPSimulator' into clh
---
SourceCode/Bond/Servo/CReport.cpp | 98 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 98 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/CReport.cpp b/SourceCode/Bond/Servo/CReport.cpp
new file mode 100644
index 0000000..1ab15fa
--- /dev/null
+++ b/SourceCode/Bond/Servo/CReport.cpp
@@ -0,0 +1,98 @@
+#include "stdafx.h"
+#include "CReport.h"
+
+
+namespace SERVO {
+ CReport::CReport()
+ {
+ m_nReportId = 0;
+ }
+
+ CReport::CReport(unsigned int reportId, std::vector<unsigned int>& vids)
+ {
+ m_nReportId = reportId;
+ for (auto vid : vids) {
+ m_vids.push_back(vid);
+ }
+ }
+
+ CReport::~CReport()
+ {
+
+ }
+
+ unsigned int CReport::getReportId()
+ {
+ return m_nReportId;
+ }
+
+ BOOL CReport::addVariable(CVariable* pVariable)
+ {
+ ASSERT(pVariable);
+ if (getVariable(pVariable->getVarialbleId()) != nullptr) {
+ return FALSE;
+ }
+
+ m_variabels.push_back(pVariable);
+ return TRUE;
+ }
+
+ BOOL CReport::deleteVarialble(unsigned int nVarialbleId)
+ {
+ BOOL bDelete = FALSE;
+ for (auto iter = m_variabels.begin(); iter != m_variabels.end(); ++iter) {
+ if (nVarialbleId == (*iter)->getVarialbleId()) {
+ m_variabels.erase(iter);
+ bDelete = TRUE;
+ break;
+ }
+ }
+
+ return bDelete;
+ }
+
+ CVariable* CReport::getVariable(unsigned int nVarialbleId)
+ {
+ for (auto item : m_variabels) {
+ if (nVarialbleId == item->getVarialbleId()) {
+ return item;
+ }
+ }
+
+ return nullptr;
+ }
+
+ std::vector<CVariable*>& CReport::getVariables()
+ {
+ return m_variabels;
+ }
+
+ std::string CReport::getVariablesIdsText()
+ {
+ std::string strResult, strName;
+ for (int i = 0; i < m_vids.size(); i++) {
+ strResult += std::to_string(m_vids[i]);
+ strResult += "(";
+ strResult += (getVariableName(m_vids[i], strName) ?
+ strName : _T("null"));
+ strResult += ")";
+ if (i != m_vids.size() - 1) {
+ strResult += ",";
+ }
+ }
+
+ return strResult;
+ }
+
+ bool CReport::getVariableName(unsigned int vid, std::string& strName)
+ {
+ for (auto item : m_variabels) {
+ if (item->getVarialbleId() == vid) {
+ strName = item->getName();
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
--
Gitblit v1.9.3