123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OTSDataType
- {
- // CElementRange command target
- public class CElementRange
- {
- // element
- protected CElement m_poElement = new CElement();
- // % x 100 range
- protected CIntRange m_poRange = new CIntRange();
- public CElementRange()
- {
- // initialization
- Init();
- }
- public CElementRange(CElementRange a_oSource) // copy constructor
- {
- // input check
- //ASSERT(a_oSource);
- if (a_oSource==null)
- {
- return;
- }
- // can't copy itself
- if (a_oSource == this)
- {
- return;
- }
- // copy data over
- Duplicate(a_oSource);
- }
- // ==operator
- public bool Equals(CElementRange a_oSource)
- {
- return m_poElement.Equals(a_oSource.m_poElement)&& m_poRange.Equals(a_oSource.m_poRange);
- }
- //无实际操作 virtual ~CElementRange(); // destructor
- // serialization
- //void Serialize(CArchive& ar);
- //void Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode);
- // element
- public CElement GetElement()
- {
- return m_poElement;
- }
- // element
- public void SetElement(CElement a_poElement)
- {
- //Debug.Assert(a_poElement);
- if (a_poElement == null)
- {
- m_poElement = new CElement();
- }
- else
- {
- m_poElement=new CElement(a_poElement);
- }
- }
- // % x 100 range
- public CIntRange GetRange()
- {
- return m_poRange;
- }
- public void SetRange(CIntRange a_poRange)
- {
- //Debug.Assert(a_poRange);
- if (a_poRange == null)
- {
- m_poRange = new CIntRange();
- }
- else
- {
- m_poRange = new CIntRange(a_poRange);
- }
- }
- // cleanup
- //protected void Cleanup()
- //{
- // // need to do nothing at the moment
- //}
- // initialization
- protected void Init()
- {
- // initialization
- m_poElement = new CElement();
- m_poRange = new CIntRange();
- }
- // duplication
- protected void Duplicate(CElementRange a_oSource)
- {
- m_poElement = new CElement(a_oSource.m_poElement);
- m_poRange = new CIntRange(a_oSource.m_poRange);
- }
- }
- }
|