LAPTOP-SNT8I5JK\Boounion
2025-05-15 48d848201d91187c21d015ed54c0e5e81ceb2c66
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include "stdafx.h"
#include "CGlass.h"
 
 
namespace SERVO {
    CGlass::CGlass()
    {
        m_pPath = nullptr;
        m_type = MaterialsType::G1;
    }
 
    CGlass::~CGlass()
    {
        CPath* pPath = m_pPath;
        while (pPath != nullptr) {
            CPath* pTemp = pPath->getNext();
            delete pPath;
            pPath = pTemp;
        }
        m_pPath = nullptr;
    }
 
    std::string& CGlass::getClassName()
    {
        static std::string strName = "CGlass";
        return strName;
    }
 
    std::string CGlass::toString()
    {
        std::string strText;
        strText += "CGlass[";
        strText += ("ID:" + m_strID + ";");
        strText += "]";
 
        return strText;
    }
 
    MaterialsType CGlass::getType()
    {
        return m_type;
    }
 
    void CGlass::setType(MaterialsType type)
    {
        m_type = type;
    }
 
    void CGlass::setID(const char* pszID)
    {
        m_strID = pszID;
    }
 
    std::string& CGlass::getID()
    {
        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);
            }
            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);
            Unlock();
        }
        else
        {
            Lock();
            ReadString(ar, m_strID);
            ULONGLONG ullPath;
            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);
            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;
    }
}