#include "stdafx.h" #include "OTSSegmentClr.h" #include "OTSSegment.h" #include "../OTSLog/COTSUtilityDllFunExport.h" namespace OTSCLRINTERFACE { using namespace OTSDATA; COTSSegmentClr::COTSSegmentClr() { m_Segment = new COTSSegmentPtr(new COTSSegment()); } COTSSegmentClr::COTSSegmentClr(long a_nHeight, long a_nStart, long a_nLength) // constructor { m_Segment = new COTSSegmentPtr(new COTSSegment(a_nHeight, a_nStart, a_nLength)); } COTSSegmentClr::COTSSegmentClr(COTSSegmentPtr a_pSegment) // copy constructor { ASSERT(a_pSegment); if (!a_pSegment) { LogErrorTrace(__FILE__, __LINE__, _T("COTSParticleClr: Generate COTSParticleClr pointer failed.")); return; } m_Segment = new COTSSegmentPtr(a_pSegment); } COTSSegmentClr::COTSSegmentClr(COTSSegmentClr^ a_pSource) { auto src = a_pSource->GetOTSSegmentPtr(); m_Segment = new COTSSegmentPtr(new COTSSegment(src.get())); } COTSSegmentClr::COTSSegmentClr(COTSSegment* a_pSource) // copy constructor { ASSERT(a_pSource); if (!a_pSource) { LogErrorTrace(__FILE__, __LINE__, _T("COTSSegmentClr: Generate COTSSegmentClr pointer failed.")); return; } m_Segment = new COTSSegmentPtr(new COTSSegment(a_pSource)); } COTSSegmentPtr COTSSegmentClr::GetOTSSegmentPtr() { return *m_Segment; } COTSSegmentClr::~COTSSegmentClr() { if (m_Segment != nullptr) { delete m_Segment; m_Segment = nullptr; } } COTSSegmentClr::!COTSSegmentClr() { if (m_Segment != nullptr) { delete m_Segment; m_Segment = nullptr; } } long COTSSegmentClr::GetHeight() { long nHeight = -1; if (m_Segment != nullptr) { nHeight = m_Segment->get()->GetHeight(); } return nHeight; } void COTSSegmentClr::SetHeight(long a_nHeight) { if (m_Segment != nullptr) { m_Segment->get()->SetHeight(a_nHeight); } } long COTSSegmentClr::GetStart() { long nStart = -1; if (m_Segment != nullptr) { nStart =m_Segment->get()->GetStart(); } return nStart; } void COTSSegmentClr::SetStart(long a_nStart) { if (m_Segment != nullptr) { m_Segment->get()->SetStart(a_nStart); } } long COTSSegmentClr::GetLength() { long nLength = -1; if (m_Segment != nullptr) { nLength = m_Segment->get()->GetLength(); } return nLength; } void COTSSegmentClr::SetLength(long a_nLength) { if (m_Segment != nullptr) { m_Segment->get()->SetLength(a_nLength); } } long COTSSegmentClr::GetEnd() { long nEnd = -1; if (m_Segment != nullptr) { nEnd = m_Segment->get()->GetEnd(); } return nEnd; } void COTSSegmentClr::SetEnd(long end) { if (m_Segment != nullptr) { m_Segment->get()->SetEnd(end); } } void COTSSegmentClr::UpDownConection(COTSSegmentClr^ otherSeg) { auto seg = otherSeg->GetOTSSegmentPtr(); m_Segment->get()->UpDownConection(seg.get()); } }