#include "stdafx.h" #include "OTSImageProcessParam.h" namespace OTSIMGPROC { // constructor COTSImageProcessParam::COTSImageProcessParam() { Init(); } // copy constructor COTSImageProcessParam::COTSImageProcessParam(const COTSImageProcessParam& a_oSource) { // can't copy itself if (&a_oSource == this) { return; } // copy data over Duplicate(a_oSource); } // copy constructor COTSImageProcessParam::COTSImageProcessParam(COTSImageProcessParam* 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 COTSImageProcessParam& COTSImageProcessParam::operator=(const COTSImageProcessParam& a_oSource) { // cleanup Cleanup(); // copy the class data over Duplicate(a_oSource); // return class return *this; } // ==operator BOOL COTSImageProcessParam::operator==(const COTSImageProcessParam& a_oSource) { // return test result return m_oIncArea == a_oSource.m_oIncArea && m_oBGGray == a_oSource.m_oBGGray && m_oParticleGray == a_oSource.m_oParticleGray; } // detractor COTSImageProcessParam::~COTSImageProcessParam() { Cleanup(); } // COTSStageData member functions // serialization void COTSImageProcessParam::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode) { /*xmls::xBool xbShowAreaUp; xmls::xBool xbShowAreaDown; xmls::xBool xbShowBGGrayUp; xmls::xBool xbShowBGGrayDown; xmls::xBool xbShowParticleGrayUp; xmls::xBool xbShowParticleGrayDown;*/ xmls::Slo slo; slo.Register("IncArea", &m_oIncArea); slo.Register("BGGray", &m_oBGGray); slo.Register("ParticleGray", &m_oParticleGray); if (isStoring) { slo.Serialize(true, classDoc, rootNode); } else { slo.Serialize(false, classDoc, rootNode); } } // cleanup void COTSImageProcessParam::Cleanup() { // nothing needs to be done at the moment } // initialization void COTSImageProcessParam::Init() { m_oIncArea = CDoubleRange(DEFUALT_PARTICALE_AREA_MIN, DEFUALT_PARTICALE_AREA_MAX); m_oBGGray = CIntRange(DEFUALT_BG_GRAY_LEVEL_MIN, DEFUALT_BG_GRAY_LEVEL_MAX); m_oParticleGray = CIntRange(DEFUALT_PARTICLE_GRAY_LEVEL_MIN, DEFUALT_PARTICLE_GRAY_LEVEL_MAX); } // duplication void COTSImageProcessParam::Duplicate(const COTSImageProcessParam& a_oSource) { // initialization Init(); // copy data over m_oIncArea = a_oSource.m_oIncArea; m_oBGGray = a_oSource.m_oBGGray; m_oParticleGray = a_oSource.m_oParticleGray; } }