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