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/EAPSimulator/CCollectionEvent.cpp | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 110 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp b/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp
new file mode 100644
index 0000000..abb12d4
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp
@@ -0,0 +1,110 @@
+#include "pch.h"
+#include "CCollectionEvent.h"
+
+
+namespace SERVO {
+ CCollectionEvent::CCollectionEvent()
+ {
+ m_nCEID = 0;
+ }
+
+ CCollectionEvent::CCollectionEvent(unsigned int id, const char* pszName, const char* pszDescription, std::vector<unsigned int>& prtids)
+ {
+ m_nCEID = id;
+ m_strName = pszName;
+ m_strDescription = pszDescription;
+ for (auto item : prtids) {
+ m_rptids.push_back(item);
+ }
+ }
+
+ CCollectionEvent::~CCollectionEvent()
+ {
+
+ }
+
+ unsigned int CCollectionEvent::getEventId()
+ {
+ return m_nCEID;
+ }
+
+ std::string& CCollectionEvent::getName()
+ {
+ return m_strName;
+ }
+
+ std::string& CCollectionEvent::getDescription()
+ {
+ return m_strDescription;
+ }
+
+ BOOL CCollectionEvent::addReport(CReport* pReport)
+ {
+ ASSERT(pReport);
+ if (getReport(pReport->getReportId()) != nullptr) {
+ return FALSE;
+ }
+
+ m_reports.push_back(pReport);
+ return TRUE;
+ }
+
+ BOOL CCollectionEvent::deleteReport(unsigned int nReportId)
+ {
+ BOOL bDelete = FALSE;
+ for (auto iter = m_reports.begin(); iter != m_reports.end(); ++iter) {
+ if (nReportId == (*iter)->getReportId()) {
+ m_reports.erase(iter);
+ bDelete = TRUE;
+ break;
+ }
+ }
+
+ return bDelete;
+ }
+
+ CReport* CCollectionEvent::getReport(unsigned int nReportId)
+ {
+ for (auto item : m_reports) {
+ if (nReportId == item->getReportId()) {
+ return item;
+ }
+ }
+
+ return nullptr;
+ }
+
+ void CCollectionEvent::setReport(unsigned int nReportId)
+ {
+ m_rptids.clear();
+ if (nReportId != 0) {
+ m_rptids.push_back(nReportId);
+ }
+ }
+
+ std::vector<CReport*>& CCollectionEvent::getReports()
+ {
+ return m_reports;
+ }
+
+ std::vector<unsigned int>& CCollectionEvent::getReportIds()
+ {
+ return m_rptids;
+ }
+
+ std::string CCollectionEvent::getReportIdsText()
+ {
+ std::string strResult, strName;
+ for (int i = 0; i < m_rptids.size(); i++) {
+ strResult += std::to_string(m_rptids[i]);// (getReport(m_rptids[i]) ?
+ if (nullptr == getReport(m_rptids[i])) {
+ strResult += "";
+ }
+ if (i != m_rptids.size() - 1) {
+ strResult += ",";
+ }
+ }
+
+ return strResult;
+ }
+}
--
Gitblit v1.9.3