LAPTOP-SNT8I5JK\Boounion
2025-06-21 088edcedd822070b6df3599aa87e08bea25a251d
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
#include "stdafx.h"
#include "Servo.h"
#include "CDoubleGlass.h"
#include "CGlassPool.h"
 
 
namespace SERVO {
    CDoubleGlass::CDoubleGlass()
    {
        m_pGlass1 = nullptr;
        m_pGlass2 = nullptr;
    }
 
    CDoubleGlass::CDoubleGlass(CGlass* pGlass1, CGlass* pGlass2)
    {
        m_pGlass1 = pGlass1;
        m_pGlass2 = pGlass2;
    }
 
    CDoubleGlass::~CDoubleGlass()
    {
 
    }
 
    std::string& CDoubleGlass::getClassName()
    {
        static std::string strName = "CDoubleGlass";
        return strName;
    }
 
    std::string CDoubleGlass::toString()
    {
        std::string strText;
        strText += "CGlass[";
        if (m_pGlass1 != nullptr) {
            strText += ("Glass1ID:" + m_pGlass1->getID() + ";");
        }
        if (m_pGlass2 != nullptr) {
            strText += ("Glass2ID:" + m_pGlass2->getID() + ";");
        }
        strText += "]";
 
        return strText;
    }
 
    CGlass* CDoubleGlass::getGlass1()
    {
        return m_pGlass1;
    }
 
    CGlass* CDoubleGlass::getGlass2()
    {
        return m_pGlass2;
    }
 
    void CDoubleGlass::serialize(CArchive& ar)
    {
        if (ar.IsStoring())
        {
            Lock();
            ar << (ULONGLONG)m_pGlass1;
            if (m_pGlass1 != nullptr) {
                m_pGlass1->serialize(ar);
            }
            ar << (ULONGLONG)m_pGlass2;
            if (m_pGlass2 != nullptr) {
                m_pGlass2->serialize(ar);
            }
            Unlock();
        }
        else
        {
            Lock();
            ULONGLONG ulGlass1;
            ar >> ulGlass1;
            if (ulGlass1 != 0) {
                m_pGlass1 = theApp.m_model.m_glassPool.allocaGlass();
                m_pGlass1->serialize(ar);
            }
            if (ulGlass1 != 0) {
                m_pGlass2 = theApp.m_model.m_glassPool.allocaGlass();
                m_pGlass2->serialize(ar);
            }
 
            Unlock();
        }
    }
}