From e42e8364112e97d89eeaecd13f043dff42179949 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 27 五月 2025 17:19:02 +0800
Subject: [PATCH] 1.enum修改为enum class, 理顺CLoadPort各成员变量在调度中的判定作用;
---
SourceCode/Bond/Servo/CGlass.cpp | 88 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 85 insertions(+), 3 deletions(-)
diff --git a/SourceCode/Bond/Servo/CGlass.cpp b/SourceCode/Bond/Servo/CGlass.cpp
index a21bd7b..77e292f 100644
--- a/SourceCode/Bond/Servo/CGlass.cpp
+++ b/SourceCode/Bond/Servo/CGlass.cpp
@@ -6,9 +6,16 @@
CGlass::CGlass()
{
m_pPath = nullptr;
+ m_type = MaterialsType::G1;
+ m_pBuddy = nullptr;
}
CGlass::~CGlass()
+ {
+
+ }
+
+ void CGlass::reset()
{
CPath* pPath = m_pPath;
while (pPath != nullptr) {
@@ -17,6 +24,10 @@
pPath = pTemp;
}
m_pPath = nullptr;
+
+ if (m_pBuddy != nullptr) {
+ m_pBuddy->release();
+ }
}
std::string& CGlass::getClassName()
@@ -33,6 +44,16 @@
strText += "]";
return strText;
+ }
+
+ MaterialsType CGlass::getType()
+ {
+ return m_type;
+ }
+
+ void CGlass::setType(MaterialsType type)
+ {
+ m_type = type;
}
void CGlass::setID(const char* pszID)
@@ -79,25 +100,86 @@
if (ar.IsStoring())
{
Lock();
+ ar << (int)m_type;
WriteString(ar, m_strID);
ar << (ULONGLONG)m_pPath;
if (m_pPath != nullptr) {
m_pPath->serialize(ar);
}
+ char temp[JOBDATAS_SIZE] = { 0 };
+ m_jobDataB.serialize(temp, JOBDATAB_SIZE);
+ ar.Write(temp, JOBDATAB_SIZE);
+ m_jobDataS.serialize(temp, JOBDATAS_SIZE);
+ ar.Write(temp, JOBDATAS_SIZE);
+ ar << (ULONGLONG)m_pBuddy;
+ WriteString(ar, m_strBuddyId);
Unlock();
}
else
{
- Lock();
- ReadString(ar, m_strID);
ULONGLONG ullPath;
+ int type;
+
+ Lock();
+ ar >> type;
+ m_type = (MaterialsType)type;
+ ReadString(ar, m_strID);
ar >> ullPath;
if (ullPath != 0) {
m_pPath = new CPath();
m_pPath->serialize(ar);
}
-
+ char temp[JOBDATAS_SIZE];
+ ar.Read(temp, JOBDATAB_SIZE);
+ m_jobDataB.unserialize(temp, JOBDATAB_SIZE);
+ ar.Read(temp, JOBDATAS_SIZE);
+ m_jobDataS.unserialize(temp, JOBDATAS_SIZE);
+ ar >> ullPath; // 这是m_pBuddy, 用不上
+ ReadString(ar, m_strBuddyId);
Unlock();
}
}
+
+ void CGlass::setJobDataB(CJobDataB* pJobDataB)
+ {
+ m_jobDataB.copy(pJobDataB);
+ }
+
+ CJobDataB* CGlass::getJobDataB()
+ {
+ return &m_jobDataB;
+ }
+
+ void CGlass::setJobDataS(CJobDataS* pJobDataS)
+ {
+ m_jobDataS.copy(pJobDataS);
+ }
+
+ CJobDataS* CGlass::getJobDataS()
+ {
+ return &m_jobDataS;
+ }
+
+ BOOL CGlass::setBuddy(CGlass* pGlass)
+ {
+ if (m_pBuddy != nullptr) return FALSE;
+ if (pGlass->getType() == this->getType()) return FALSE;
+ m_pBuddy = pGlass;
+ if (m_type == MaterialsType::G1) {
+ m_pBuddy->addRef();
+ }
+ m_strBuddyId = m_pBuddy->getID();
+
+ return TRUE;
+ }
+
+ CGlass* CGlass::getBuddy()
+ {
+ return m_pBuddy;
+ }
+
+ std::string& CGlass::getBuddyId()
+ {
+ return m_strBuddyId;
+ }
}
--
Gitblit v1.9.3