// SEMStageData.cpp : implementation file // #include "stdafx.h" #include "SEMStageData.h" // CSEMStageData namespace OTSDATA { CSEMStageData::CSEMStageData() { Init(); } // copy constructor CSEMStageData::CSEMStageData(const CSEMStageData& a_oSource) { // can't copy itself if (&a_oSource == this) { return; } // copy data over Duplicate(a_oSource); } // copy constructor CSEMStageData::CSEMStageData(CSEMStageData* 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 CSEMStageData& CSEMStageData::operator=(const CSEMStageData& a_oSource) { // cleanup Cleanup(); // copy the class data over Duplicate(a_oSource); // return class return *this; } // ==operator BOOL CSEMStageData::operator==(const CSEMStageData& a_oSource) { // return test result return m_nScanFieldSize100 == a_oSource.m_nScanFieldSize100 && *(m_oXAxis.get()) == *(a_oSource.m_oXAxis.get()) && *(m_oYAxis.get()) == *(a_oSource.m_oYAxis.get()) && m_bXAxisDir == a_oSource.m_bXAxisDir && m_bYAxisDir == a_oSource.m_bYAxisDir && m_dMinMag == a_oSource.m_dMinMag; } // detractor CSEMStageData::~CSEMStageData() { Cleanup(); } // CSEMStageData member functions // serialization void CSEMStageData::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode) { xmls::xInt xscanFieldSize100; xmls::xInt xbXAxisDir; xmls::xInt xbYAxisDir; xmls::xDouble xMinMag; xmls::Slo slo; //Slo::Clear(); slo.Register("scanFieldSize", &xscanFieldSize100); slo.Register("xAxisDir", &xbXAxisDir); slo.Register("yAxisDir", &xbYAxisDir); slo.Register("MinMag", &xMinMag); slo.Register("XAxis", m_oXAxis.get()); slo.Register("YAxis", m_oYAxis.get()); if (isStoring) { xscanFieldSize100 = m_nScanFieldSize100; xbXAxisDir = (int)m_bXAxisDir; xbYAxisDir = (int)m_bYAxisDir; xMinMag = m_dMinMag; slo.Serialize(true, classDoc, rootNode); } else { slo.Serialize(false, classDoc, rootNode); m_nScanFieldSize100 = xscanFieldSize100.value(); m_bXAxisDir = (OTS_X_AXIS_DIRECTION)xbXAxisDir.value(); m_bYAxisDir = (OTS_Y_AXIS_DIRECTION)xbYAxisDir.value(); m_dMinMag = xMinMag.value(); } } // cleanup void CSEMStageData::Cleanup() { // nothing needs to be done at the moment } // initialization void CSEMStageData::Init() { m_nScanFieldSize100 = 0; m_bXAxisDir = OTS_X_AXIS_DIRECTION::LEFT_TOWARD; m_bYAxisDir = OTS_Y_AXIS_DIRECTION::UP_TOWARD; m_oXAxis = CIntRangePtr(new CIntRange(0, 0)); m_oYAxis = CIntRangePtr(new CIntRange(0, 0)); m_dMinMag = MAGNIFICATION_MIN; } // duplication void CSEMStageData::Duplicate(const CSEMStageData& a_oSource) { // initialization Init(); // copy data over m_nScanFieldSize100 = a_oSource.m_nScanFieldSize100; m_bXAxisDir = a_oSource.m_bXAxisDir; m_bYAxisDir = a_oSource.m_bYAxisDir; m_oXAxis = a_oSource.m_oXAxis; m_oYAxis = a_oSource.m_oYAxis; m_dMinMag = a_oSource.m_dMinMag; } }