| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- #include "stdafx.h"
- #include "TriTempFileClr.h"
- namespace OTSINTERFACE {
- CTriTempFileClr::CTriTempFileClr() // constructor
- {
- m_LpTempFile = new CTriTempFilePtr(new CTriTempFile());
- }
- CTriTempFileClr::CTriTempFileClr(CTriTempFilePtr a_pTriTempFile) // copy constructor
- {
- if (a_pTriTempFile == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("CTriTempFileClr: invalid pointer"));
- return;
- }
- m_LpTempFile = new CTriTempFilePtr(a_pTriTempFile);
- }
- CTriTempFileClr::!CTriTempFileClr()
- {
- if (m_LpTempFile != nullptr)
- {
- delete m_LpTempFile;
- m_LpTempFile = nullptr;
- }
- }
- CTriTempFileClr::~CTriTempFileClr()
- {
- if (m_LpTempFile != nullptr)
- {
- delete m_LpTempFile;
- m_LpTempFile = nullptr;
- }
- }
- CTriTempFilePtr CTriTempFileClr::GetTriTempFilePtr()
- {
- return *m_LpTempFile;
- }
-
- bool CTriTempFileClr::Init()
- {
- if (m_LpTempFile == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("Init:empty pointer."));
- return false;
- }
-
- CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- ASSERT(pTriTempFile);
- if (!pTriTempFile)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("Init: invalide pointer."));
- return false;
- }
- return true;
- }
- // name
- String^ CTriTempFileClr::GetName()
- {
- if (m_LpTempFile == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetName: current CLR point is invalid."));
- return nullptr;
- }
- CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- ASSERT(pTriTempFile);
- if (!pTriTempFile)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetName:invalid pointer."));
- return nullptr;
- }
- CString sTriTemp = pTriTempFile->GetName();
- String^ sTriTempClr = gcnew String(sTriTemp);
- return sTriTempClr;
- }
- void CTriTempFileClr::SetName(String^ a_strName)
- {
- if (m_LpTempFile == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetName: current CLR point is invalid."));
- return;
- }
- CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- ASSERT(a_strName);
- if (!pTriTempFile)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetName:invalid pointer."));
- return;
- }
- ASSERT(a_strName);
- if (!a_strName)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetName:invalid pointer."));
- return;
- }
- pTriTempFile->SetName(a_strName);
- }
- // version
- String^ CTriTempFileClr::GetVersion()
- {
- if (m_LpTempFile == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetVersion: current CLR point is invalid."));
- return nullptr;
- }
- CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- ASSERT(pTriTempFile);
- if (!pTriTempFile)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetVersion:invalid pointer."));
- return nullptr;
- }
- CString sVersion = pTriTempFile->GetVersion();
- String^ sVersionClr = gcnew String(sVersion);
- return sVersionClr;
- }
- void CTriTempFileClr::SetVersion(String^ a_strVersion)
- {
- if (m_LpTempFile == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetVersion: current CLR point is invalid."));
- return;
- }
- CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- ASSERT(pTriTempFile);
- if (!pTriTempFile)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetVersion:invalid pointer."));
- return;
- }
- ASSERT(a_strVersion);
- if (!a_strVersion)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetVersion:invalid pointer."));
- return;
- }
- pTriTempFile->SetVersion(a_strVersion);
- }
- // triangle template list
- CTriTempItemListClr^ CTriTempFileClr::GetTriTempItemList()
- {
- if (m_LpTempFile == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetTriTempList:empty pointer."));
- return nullptr;
- }
- CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- ASSERT(pTriTempFile);
- if (!pTriTempFile)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetTriTempList: invalide pointer."));
- return nullptr;
- }
- CTriTempItemList listTriTempItem = pTriTempFile->GetTriTempItemList();
- CTriTempItemListClr^ listTriTempItemClr = gcnew CTriTempItemListClr();
- for (auto pTriTempItem: listTriTempItem)
- {
- CTriTempItemClr^ TriTempItemClr = gcnew CTriTempItemClr(pTriTempItem);
- listTriTempItemClr->Add(TriTempItemClr);
- }
- return listTriTempItemClr;
- }
- void CTriTempFileClr::SetTriTempItemList(CTriTempItemListClr^ a_listTriTemp, bool a_bClear)
- {
- if (m_LpTempFile == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetTriTempList:empty pointer."));
- return;
- }
- CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- ASSERT(pTriTempFile);
- if (!pTriTempFile)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetTriTempList: invalide pointer."));
- return;
- }
- ASSERT(a_listTriTemp);
- if (!a_listTriTemp)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetTriTempList: invalid listTriTemp pointer."));
- return;
- }
- CTriTempItemList listTriTempItem;
- int nSize = a_listTriTemp->Count;
- for (int i = 0; i < nSize; i++)
- {
- CTriTempItemPtr pTriTempItem = a_listTriTemp[i]->GetTriTempItemPtr();
- ASSERT(pTriTempItem);
- if (!pTriTempItem)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetTriTempList: invalid TriTemp pointer."));
- return;
- }
- listTriTempItem.push_back(pTriTempItem);
- }
- pTriTempFile->SetTriTempItemList(listTriTempItem, a_bClear);
- }
- //CTriTempItemClr^ CTriTempFileClr::GetTriTempByIndex(int a_nIndex)
- //{
- // if (m_LpTempFile == nullptr)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetTriTempByIndex:empty pointer."));
- // return nullptr;
- // }
- //
- // CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- //
- // ASSERT(pTriTempFile);
- // if (!pTriTempFile)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetTriTempByIndex: invalide pointer."));
- // return nullptr;
- // }
- //
- // CTriTempItemPtr pTriTempItem = pTriTempFile->GetTriTempByIndex(a_nIndex);
- // ASSERT(pTriTempItem);
- // if (!pTriTempItem)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetTriTempByIndex: invalide triangle template item pointer."));
- // return nullptr;
- // }
- // CTriTempItemClr^ pTriTemItemClr = gcnew CTriTempItemClr(pTriTempItem);
- // return pTriTemItemClr;
- //}
- //CTriTempItemClr^ CTriTempFileClr::GetTriTempByName(String^ a_strPartSizeName)
- //{
- // if (m_LpTempFile == nullptr)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetTriTempByName:empty pointer."));
- // return nullptr;
- // }
- // ASSERT(a_strPartSizeName);
- // if (!a_strPartSizeName)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetTriTempByName:empty pointer."));
- // return nullptr;
- // }
- // CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- // ASSERT(pTriTempFile);
- // if (!pTriTempFile)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetTriTempByName: invalide pointer."));
- // return nullptr;
- // }
- // CTriTempItemPtr pTriTempItem = pTriTempFile->GetTriTempByName(a_strPartSizeName);
- // ASSERT(pTriTempItem);
- // if (!pTriTempItem)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetTriTempByName: invalide triangle template item pointer."));
- // return nullptr;
- // }
- // CTriTempItemClr^ pTriTemItemClr = gcnew CTriTempItemClr(pTriTempItem);
- // return pTriTemItemClr;
- //}
- //CPartSTDDataClr^ CTriTempFileClr::GetPartSTDData()
- //{
- // if (m_LpTempFile == nullptr)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetPartSTDData:empty pointer."));
- // return nullptr;
- // }
- // CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- // ASSERT(pTriTempFile);
- // if (!pTriTempFile)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetPartSTDData: invalide pointer."));
- // return nullptr;
- // }
- // CPartSTDDataPtr pPartSTD = pTriTempFile->GetPartSTDData();
- // CPartSTDDataClr^ pPartSTDClr = gcnew CPartSTDDataClr(pPartSTD);
- // return pPartSTDClr;
- //
- //}
- //// part STD data
- //void CTriTempFileClr::SetPartSTDData(CPartSTDDataClr^ a_pPartSTDData)
- //{
- // if (m_LpTempFile == nullptr)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("SetPartSTDData:empty pointer."));
- // return;
- // }
- // CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- // ASSERT(pTriTempFile);
- // if (!pTriTempFile)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("SetPartSTDData: invalide pointer."));
- // return;
- // }
- // ASSERT(a_pPartSTDData);
- // if (!a_pPartSTDData)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("SetPartSTDData: invalid PartSTDData pointer."));
- // return;
- // }
- //
- // CPartSTDDataPtr pPartSTDData = a_pPartSTDData->GetPartSTDDataPtr();
- // ASSERT(pPartSTDData);
- // if (!pPartSTDData)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("SetPartSTDData: invalid PartSTDData pointer."));
- // return;
- // }
- // pTriTempFile->SetPartSTDData(pPartSTDData);
- //}
- //bool CTriTempFileClr::GetPartNameList(List<String^>^% a_listPartName)
- //{
- // if (m_LpTempFile == nullptr)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetPartNameList:empty pointer."));
- // return false;
- // }
- // CTriTempFilePtr pTriTempFile = GetTriTempFilePtr();
- // ASSERT(pTriTempFile);
- // if (!pTriTempFile)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetPartNameList: invalide pointer."));
- // return false;
- // }
- // std::vector<CString> listPartName;
- // BOOL bRet = pTriTempFile->GetPartNameList(listPartName);
- // if (!bRet)
- // {
- // LogErrorTrace(__FILE__, __LINE__, _T("GetPartNameList: failed to get part name list."));
- // return false;
- // }
- // for (auto strPartName : listPartName)
- // {
- // String^ strPartNameClr = gcnew String(strPartName);
- // a_listPartName->Add(strPartNameClr);
- // }
- // return true;
- //}
- }
|