123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- // SEMDataGnr.cpp : implementation file
- //
- #include "stdafx.h"
- //#include "OTSData.h"
- #include "SEMDataGnr.h"
- namespace OTSDATA {
- // CSEMDataGnr
-
- // constructor
- CSEMDataGnr::CSEMDataGnr()
- {
- // initialization
- Init();
- }
- // copy constructor
- CSEMDataGnr::CSEMDataGnr(const CSEMDataGnr& a_oSource)
- {
- // can't copy itself
- if (&a_oSource == this)
- {
- return;
- }
- // copy data over
- Duplicate(a_oSource);
- }
- // copy constructor
- CSEMDataGnr::CSEMDataGnr(CSEMDataGnr* a_poSource)
- {
- // can't copy itself
- if (a_poSource == this)
- {
- return;
- }
- // copy data over
- Duplicate(*a_poSource);
- }
- // =operator
- CSEMDataGnr& CSEMDataGnr::operator=(const CSEMDataGnr& a_oSource)
- {
- // cleanup
- Cleanup();
- // copy the class data over
- Duplicate(a_oSource);
- // return class
- return *this;
- }
- // destructor
- CSEMDataGnr::~CSEMDataGnr()
- {
- // cleanup
- Cleanup();
- }
- // ==operator
- BOOL CSEMDataGnr::operator==(const CSEMDataGnr& a_oSource)
- {
- return abs(m_dKV - a_oSource.m_dKV) < MIN_DOUBLE_VALUE &&
- abs(m_dBrightness - a_oSource.m_dBrightness) < MIN_DOUBLE_VALUE &&
- abs(m_dContrast - a_oSource.m_dContrast) < MIN_DOUBLE_VALUE;
- }
- // CSEMDataMsr member functions
- // public
- // serialization
-
- void CSEMDataGnr::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode)
- {
- xmls::xDouble xdKV;
- xmls::xDouble xdBrightness;
- xmls::xDouble xdConstrast;
- xmls::Slo slo;
- slo.Register("KV", &xdKV);
- slo.Register("Brightness", &xdBrightness);
- slo.Register("Constrast", &xdConstrast);
- if (isStoring)
- {
- xdKV = m_dKV;
- xdBrightness = m_dBrightness;
- xdConstrast = m_dContrast;
- slo.Serialize(true, classDoc, rootNode);
- }
- else
- {
- slo.Serialize(false, classDoc, rootNode);
- m_dKV = xdKV.value();
- m_dBrightness = xdBrightness.value();
- m_dContrast = xdConstrast.value();
- }
- }
- // protected
- // cleanup
- void CSEMDataGnr::Cleanup()
- {
- // need to do nothing at the moment
- }
- // initialization
- void CSEMDataGnr::Init()
- {
- m_dKV = MIN_DOUBLE_VALUE;
- m_dBrightness = MIN_DOUBLE_VALUE;
- m_dContrast = MIN_DOUBLE_VALUE;
- }
- // duplication
- void CSEMDataGnr::Duplicate(const CSEMDataGnr& a_oSource)
- {
- // initialization
- Init();
- // copy data over
- m_dKV = a_oSource.m_dKV;
- m_dBrightness = a_oSource.m_dBrightness;
- m_dContrast = a_oSource.m_dContrast;
- }
- }
|