#include "stdafx.h" #include "OTSImageScanParam.h" #include namespace OTSIMGPROC { // constructor COTSImageScanParam::COTSImageScanParam() { Init(); } // copy constructor COTSImageScanParam::COTSImageScanParam(const COTSImageScanParam& a_oSource) { // can't copy itself if (&a_oSource == this) { return; } // copy data over Duplicate(a_oSource); } // copy constructor COTSImageScanParam::COTSImageScanParam(COTSImageScanParam* 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 COTSImageScanParam& COTSImageScanParam::operator=(const COTSImageScanParam& a_oSource) { // cleanup Cleanup(); // copy the class data over Duplicate(a_oSource); // return class return *this; } // ==operator BOOL COTSImageScanParam::operator==(const COTSImageScanParam& a_oSource) { // return test result return((m_nStopMode == a_oSource.m_nStopMode) && (m_nStopParamMeasTime == a_oSource.m_nStopParamMeasTime) && (m_nStopParamFields == a_oSource.m_nStopParamFields) && (m_nStopParamParticles == a_oSource.m_nStopParamParticles) && (m_nSatrtImageMode == a_oSource.m_nSatrtImageMode) && (m_nImagePixelSize == a_oSource.m_nImagePixelSize)); } // detractor COTSImageScanParam::~COTSImageScanParam() { Cleanup(); } // COTSStageData member functions // serialization void COTSImageScanParam::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode) { xmls::xString xnStopMode; xmls::xInt xnStopParamMeasTime; xmls::xInt xnStopParamFields; xmls::xInt xnStopParamParticles; xmls::xString xnSatrtImageMode; xmls::xString xnScanImageSpeed; xmls::xString xnImageResolution; xmls::Slo slo; slo.Register("StopMode", &xnStopMode); slo.Register("StopParamMeasTime", &xnStopParamMeasTime); slo.Register("StopParamFields", &xnStopParamFields); slo.Register("StopParamParticles", &xnStopParamParticles); slo.Register("SatrtImageMode", &xnSatrtImageMode); slo.Register("ScanImageSpeed", &xnScanImageSpeed); slo.Register("ImageResolution", &xnImageResolution); if (isStoring) { /*xnStopMode = std::to_string((int)m_nStopMode); xnStopParamMeasTime = m_nStopParamMeasTime; xnStopParamFields = m_nStopParamFields; xnStopParamParticles = m_nStopParamParticles; xnSatrtImageMode = (int)m_nSatrtImageMode; xnScanImageSpeed = (int)m_nScanImageSpeed; xnImagePixelSize = (int)m_nImagePixelSize; slo.Serialize(true, classDoc, rootNode);*/ } else { slo.Serialize(false, classDoc, rootNode); m_nStopMode = (OTS_MEASURE_STOP_MODE)stoi(xmls::SplitString(xnStopMode.value(),":")[0]); m_nStopParamMeasTime = xnStopParamMeasTime.value(); m_nStopParamFields = xnStopParamFields.value(); m_nSatrtImageMode = (OTS_GET_IMAGE_MODE)stoi(xmls::SplitString(xnSatrtImageMode.value(),":")[0]); m_nScanImageSpeed = (OTS_THREE_TIES_OPTIONS)stoi(xmls::SplitString(xnScanImageSpeed.value(),":")[0]); m_nImagePixelSize = (OTS_FIVE_TIES_OPTIONS)stoi(xmls::SplitString(xnImageResolution.value(), ":")[0]); } } // cleanup void COTSImageScanParam::Cleanup() { // nothing needs to be done at the moment } // initialization void COTSImageScanParam::Init() { m_nStopMode = DEFUALT_MEASURE_STOP_MODE; //测量终止方式 m_nStopParamMeasTime = DEFUALT_PARAM_TIME; //测量时间 m_nStopParamFields = DEFUALT_PARAM_FIELD; //帧图数 m_nStopParamParticles = DEFUALT_PARAM_PARTICLE; //夹杂物数 m_nSatrtImageMode = DEFAULT_IMAGEMODE; //取图方式 m_nScanImageSpeed = DEFAULE_SCAN_SPEED; m_nImagePixelSize = DEFAULE_IMAGE_SIZE; } // duplication void COTSImageScanParam::Duplicate(const COTSImageScanParam& a_oSource) { // initialization Init(); // copy data over m_nStopMode = a_oSource.m_nStopMode; m_nStopParamMeasTime = a_oSource.m_nStopParamMeasTime; m_nStopParamFields = a_oSource.m_nStopParamFields; m_nStopParamParticles = a_oSource.m_nStopParamParticles; m_nSatrtImageMode = a_oSource.m_nSatrtImageMode; m_nImagePixelSize = a_oSource.m_nImagePixelSize; m_nScanImageSpeed = a_oSource.m_nScanImageSpeed; } }