| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 | // ElementRange.cpp : implementation file//#include "stdafx.h"//#include "OTSData.h"#include "ElementRange.h"namespace OTSDATA {	// CElementRange		// constructor		CElementRange::CElementRange()	{		// initialization		Init();	}	// copy constructor	CElementRange::CElementRange(const CElementRange& a_oSource)	{		// can't copy itself		if (&a_oSource == this)		{			return;		}		// copy data over		Duplicate(a_oSource);	}	// copy constructor	CElementRange::CElementRange(CElementRange* 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		CElementRange& CElementRange::operator=(const CElementRange& a_oSource)	{		// cleanup		Cleanup();		// copy the class data over		Duplicate(a_oSource);		// return class		return *this;	}	// ==operator	BOOL CElementRange::operator==(const CElementRange& a_oSource)	{		return *(m_poElement.get()) == *(a_oSource.m_poElement.get()) && *(m_poRange.get()) == *(a_oSource.m_poRange.get());	}	// destructor	CElementRange::~CElementRange()	{		// cleanup		Cleanup();	}	// CElementRange member functions	// public	// serialization		void CElementRange::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode)	{		xmls::Slo slo;		slo.Register("Element", m_poElement.get());		slo.Register("Range", m_poRange.get());		if (isStoring)		{			slo.Serialize(true, classDoc, rootNode);		}		else		{			slo.Serialize(false, classDoc, rootNode);		}	}	// element	void CElementRange::SetElement(CElementPtr a_poElement)	{		ASSERT(a_poElement);		if(!a_poElement)		{			m_poElement = CElementPtr(new CElement());		}		else		{			m_poElement = a_poElement;		}	}	// % x 100 range 	void CElementRange::SetRange(CIntRangePtr a_poRange)	{		ASSERT(a_poRange);		if(!a_poRange)		{			m_poRange = CIntRangePtr(new CIntRange());		}		else		{			m_poRange = a_poRange;		}	}	// protected	// cleanup 	void CElementRange::Cleanup()	{		// need to do nothing at the moment	}	// initialization	void CElementRange::Init()	{		// initialization		m_poElement = CElementPtr(new CElement());		m_poRange = CIntRangePtr(new CIntRange());	}	// duplication 	void CElementRange::Duplicate(const CElementRange& a_oSource)	{		// initialization		Init();		// copy data over		m_poElement = CElementPtr(a_oSource.m_poElement);		m_poRange = CIntRangePtr(a_oSource.m_poRange);	}}
 |