OTSPeak.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #include "stdafx.h"
  2. #include "OTSPeak.h"
  3. // CIntRange
  4. namespace OTSDATA
  5. {
  6. // constructor
  7. COTSPeak::COTSPeak()
  8. {
  9. // initialization
  10. Init();
  11. }
  12. // copy constructor
  13. COTSPeak::COTSPeak(const COTSPeak& a_oSource)
  14. {
  15. // can't copy itself
  16. if (&a_oSource == this)
  17. {
  18. return;
  19. }
  20. // copy data over
  21. Duplicate(a_oSource);
  22. }
  23. // copy constructor
  24. COTSPeak::COTSPeak(COTSPeak* a_poSource)
  25. {
  26. // input check
  27. ASSERT(a_poSource);
  28. if (!a_poSource)
  29. {
  30. return;
  31. }
  32. // can't copy itself
  33. if (a_poSource == this)
  34. {
  35. return;
  36. }
  37. // copy data over
  38. Duplicate(*a_poSource);
  39. }
  40. // =operator
  41. COTSPeak& COTSPeak::operator=(const COTSPeak& a_oSource)
  42. {
  43. // cleanup
  44. Cleanup();
  45. // copy the class data over
  46. Duplicate(a_oSource);
  47. // return class
  48. return *this;
  49. }
  50. // ==operator
  51. BOOL COTSPeak::operator==(const COTSPeak& a_oSource)
  52. {
  53. // return test result
  54. return m_nPosition == a_oSource.m_nPosition &&
  55. m_nHeight == a_oSource.m_nHeight &&
  56. m_oRange == a_oSource.m_oRange;
  57. }
  58. // detractor
  59. COTSPeak::~COTSPeak()
  60. {
  61. Cleanup();
  62. }
  63. // COTSPeak member functions
  64. // public
  65. // serialization
  66. //void COTSPeak::Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode)
  67. //{
  68. // xmls::xLong xnPosition;
  69. // xmls::xLong xnHeight;
  70. // xmls::Slo slo;
  71. // slo.Register("Position", &xnPosition);
  72. // slo.Register("Height", &xnHeight);
  73. //// this->Register("Range", m_oRange.getClassName());
  74. //
  75. // if (isStoring)
  76. // {
  77. // xnPosition = m_nPosition;
  78. // xnHeight = m_nHeight;
  79. //
  80. // slo.Serialize(true, classDoc, rootNode);
  81. // }
  82. // else
  83. // {
  84. // slo.Serialize(false, classDoc, rootNode);
  85. // m_nPosition = xnPosition.value();
  86. // m_nHeight = xnHeight.value();
  87. // }
  88. //}
  89. // protected
  90. // cleanup
  91. void COTSPeak::Cleanup()
  92. {
  93. // nothing needs to be done at the moment
  94. }
  95. // initialization
  96. void COTSPeak::Init()
  97. {
  98. m_nPosition = 0;
  99. m_nHeight = 0;
  100. m_oRange = CIntRange();
  101. }
  102. // duplication
  103. void COTSPeak::Duplicate(const COTSPeak& a_oSource)
  104. {
  105. // initialization
  106. Init();
  107. // copy data over
  108. m_nPosition = a_oSource.m_nPosition;
  109. m_nHeight = a_oSource.m_nHeight;
  110. m_oRange = a_oSource.m_oRange;
  111. }
  112. }