From 1bc4fecb9cc1641ed3ad0a2fda30766fc06fb13e Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期二, 01 四月 2025 16:05:07 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang

---
 SourceCode/Bond/Servo/CGlass.cpp |   66 ++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/SourceCode/Bond/Servo/CGlass.cpp b/SourceCode/Bond/Servo/CGlass.cpp
index b7d05fe..a21bd7b 100644
--- a/SourceCode/Bond/Servo/CGlass.cpp
+++ b/SourceCode/Bond/Servo/CGlass.cpp
@@ -5,12 +5,18 @@
 namespace SERVO {
 	CGlass::CGlass()
 	{
-
+		m_pPath = nullptr;
 	}
 
 	CGlass::~CGlass()
 	{
-
+		CPath* pPath = m_pPath;
+		while (pPath != nullptr) {
+			CPath* pTemp = pPath->getNext();
+			delete pPath;
+			pPath = pTemp;
+		}
+		m_pPath = nullptr;
 	}
 
 	std::string& CGlass::getClassName()
@@ -38,4 +44,60 @@
 	{
 		return m_strID;
 	}
+
+	CPath* CGlass::getPathWithSiteID(unsigned int nSiteId)
+	{
+		CPath* pPath = m_pPath;
+		while (pPath != nullptr) {
+			if (nSiteId == pPath->getSiteID()) {
+				return pPath;
+			}
+			pPath = pPath->getNext();
+		}
+
+		return nullptr;
+	}
+
+	CPath* CGlass::getPath()
+	{
+		return m_pPath;
+	}
+
+	void CGlass::addPath(unsigned int nSiteId)
+	{
+		CPath* pPath = new CPath(nSiteId);
+		if (m_pPath == nullptr) {
+			m_pPath = pPath;
+		}
+		else {
+			m_pPath->addPath(pPath);
+		}
+	}
+
+	void CGlass::serialize(CArchive& ar)
+	{
+		if (ar.IsStoring())
+		{
+			Lock();
+			WriteString(ar, m_strID);
+			ar << (ULONGLONG)m_pPath;
+			if (m_pPath != nullptr) {
+				m_pPath->serialize(ar);
+			}
+			Unlock();
+		}
+		else
+		{
+			Lock();
+			ReadString(ar, m_strID);
+			ULONGLONG ullPath;
+			ar >> ullPath;
+			if (ullPath != 0) {
+				m_pPath = new CPath();
+				m_pPath->serialize(ar);
+			}
+
+			Unlock();
+		}
+	}
 }

--
Gitblit v1.9.3