LAPTOP-SNT8I5JK\Boounion
2025-05-10 1e8e3473cb124f9e51dfc1ca35e5cb13b1668bdc
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
#include "stdafx.h"
#include "CGlass.h"
 
 
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()
    {
        static std::string strName = "CGlass";
        return strName;
    }
 
    std::string CGlass::toString()
    {
        std::string strText;
        strText += "CGlass[";
        strText += ("ID:" + m_strID + ";");
        strText += "]";
 
        return strText;
    }
 
    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);
            }
            Unlock();
        }
        else
        {
            Lock();
            ReadString(ar, m_strID);
            ULONGLONG ullPath;
            ar >> ullPath;
            if (ullPath != 0) {
                m_pPath = new CPath();
                m_pPath->serialize(ar);
            }
 
            Unlock();
        }
    }
}