OTSSegmentClr.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #include "stdafx.h"
  2. #include "OTSSegmentClr.h"
  3. namespace OTSINTERFACE {
  4. COTSSegmentClr::COTSSegmentClr()
  5. {
  6. m_Segment = new COTSSegmentPtr(new COTSSegment());
  7. }
  8. COTSSegmentClr::COTSSegmentClr(long a_nHeight, long a_nStart, long a_nLength) // constructor
  9. {
  10. m_Segment = new COTSSegmentPtr(new COTSSegment(a_nHeight, a_nStart, a_nLength));
  11. }
  12. COTSSegmentClr::COTSSegmentClr(COTSSegmentPtr a_pSegment) // copy constructor
  13. {
  14. ASSERT(a_pSegment);
  15. if (!a_pSegment)
  16. {
  17. LogErrorTrace(__FILE__, __LINE__, _T("COTSParticleClr: Generate COTSParticleClr pointer failed."));
  18. return;
  19. }
  20. m_Segment = new COTSSegmentPtr(a_pSegment);
  21. }
  22. COTSSegmentClr::COTSSegmentClr(COTSSegment* a_pSource) // copy constructor
  23. {
  24. ASSERT(a_pSource);
  25. if (!a_pSource)
  26. {
  27. LogErrorTrace(__FILE__, __LINE__, _T("COTSSegmentClr: Generate COTSSegmentClr pointer failed."));
  28. return;
  29. }
  30. m_Segment = new COTSSegmentPtr(new COTSSegment(a_pSource));
  31. }
  32. COTSSegmentPtr COTSSegmentClr::GetOTSSegmentPtr()
  33. {
  34. return *m_Segment;
  35. }
  36. COTSSegmentClr::~COTSSegmentClr()
  37. {
  38. if (m_Segment != nullptr)
  39. {
  40. delete m_Segment;
  41. m_Segment = nullptr;
  42. }
  43. }
  44. COTSSegmentClr::!COTSSegmentClr()
  45. {
  46. if (m_Segment != nullptr)
  47. {
  48. delete m_Segment;
  49. m_Segment = nullptr;
  50. }
  51. }
  52. long COTSSegmentClr::GetHeight()
  53. {
  54. long nHeight = -1;
  55. if (m_Segment != nullptr)
  56. {
  57. nHeight = m_Segment->get()->GetHeight();
  58. }
  59. return nHeight;
  60. }
  61. void COTSSegmentClr::SetHeight(long a_nHeight)
  62. {
  63. if (m_Segment != nullptr)
  64. {
  65. m_Segment->get()->SetHeight(a_nHeight);
  66. }
  67. }
  68. long COTSSegmentClr::GetStart()
  69. {
  70. long nStart = -1;
  71. if (m_Segment != nullptr)
  72. {
  73. nStart =m_Segment->get()->GetStart();
  74. }
  75. return nStart;
  76. }
  77. void COTSSegmentClr::SetStart(long a_nStart)
  78. {
  79. if (m_Segment != nullptr)
  80. {
  81. m_Segment->get()->SetStart(a_nStart);
  82. }
  83. }
  84. long COTSSegmentClr::GetLength()
  85. {
  86. long nLength = -1;
  87. if (m_Segment != nullptr)
  88. {
  89. nLength = m_Segment->get()->GetLength();
  90. }
  91. return nLength;
  92. }
  93. void COTSSegmentClr::SetLength(long a_nLength)
  94. {
  95. if (m_Segment != nullptr)
  96. {
  97. m_Segment->get()->SetLength(a_nLength);
  98. }
  99. }
  100. }