#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();
|
}
|
}
|
}
|