#include "stdafx.h" //#include "OTSData.h" #include "MsrThreadStatus.h" namespace OTSMODEL { using namespace OTSDATA; // constructor CMsrThreadStatus::CMsrThreadStatus() { // initialization Init(); } // copy constructor CMsrThreadStatus::CMsrThreadStatus(const CMsrThreadStatus& a_oSource) { // can't copy itself if (&a_oSource == this) { return; } // copy data over Duplicate(a_oSource); } // copy constructor CMsrThreadStatus::CMsrThreadStatus(CMsrThreadStatus* a_poSource) { // input check ASSERT(a_poSource); if (!a_poSource) { return; } // can't copy itself if (a_poSource == this) { return; } // copy data over Duplicate(*a_poSource); } // =operator CMsrThreadStatus& CMsrThreadStatus::operator=(const CMsrThreadStatus& a_oSource) { // cleanup Cleanup(); // copy the class data over Duplicate(a_oSource); // return class return *this; } // destructor CMsrThreadStatus::~CMsrThreadStatus() { // cleanup Cleanup(); } // ==operator BOOL CMsrThreadStatus::operator==(const CMsrThreadStatus& a_oSource) { int nSize = (int)m_listCpldSamples.size(); if (nSize != (int)a_oSource.m_listCpldSamples.size()) { return FALSE; } // return FALSE if any of the samples are different for (int i = 0; i < nSize; ++i) { if (!(*(m_listCpldSamples[i].get()) == *(a_oSource.m_listCpldSamples[i].get()))) { return FALSE; } } return m_nStatus == a_oSource.m_nStatus && m_timeStart == a_oSource.m_timeStart && m_timeUsed == a_oSource.m_timeUsed && m_timeStart == a_oSource.m_timeStart; } // CMsrThreadStatus member functions // public // serialization void CMsrThreadStatus::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode) { xmls::xInt xnStatus; xmls::xOleDateTime xtimeStart; xmls::xOleDateTimeSpan xtimeUsed; xmls::xOleDateTime xtimeEnd; xmls::Collection xSamples; xmls::Slo slo; slo.Register("CompletedFields", &xnStatus); slo.Register("timeStart", &xtimeStart); slo.Register("timeUsed", &xtimeUsed); slo.Register("timeEnd", &xtimeEnd); if (isStoring) { xnStatus = (int)m_nStatus; xtimeStart = m_timeStart; xtimeUsed = m_timeUsed; xtimeEnd = m_timeEnd; xSamples.Clear(); for (auto pSample : m_listCpldSamples) { xSamples.addItem(pSample.get()); } slo.Serialize(true, classDoc, rootNode); } else { slo.Serialize(false, classDoc, rootNode); m_nStatus = (OTS_MSR_THREAD_STATUS)xnStatus.value(); m_timeStart = xtimeStart.value (); m_timeUsed = xtimeUsed.value (); m_timeEnd = xtimeEnd.value (); m_listCpldSamples.clear(); for (unsigned int i=0;i