diff options
Diffstat (limited to 'src/T2DLL/T2ToolDefList.cpp')
-rw-r--r-- | src/T2DLL/T2ToolDefList.cpp | 171 |
1 files changed, 140 insertions, 31 deletions
diff --git a/src/T2DLL/T2ToolDefList.cpp b/src/T2DLL/T2ToolDefList.cpp index ef41d49..cb2e25b 100644 --- a/src/T2DLL/T2ToolDefList.cpp +++ b/src/T2DLL/T2ToolDefList.cpp @@ -1,79 +1,188 @@ +#include "T2TempPluginComparator.h" +#include "T2TenantDef.h" +#include "T2ToolDef.h" #include "T2ToolDefList.h" -T2ToolDefDB::T2ToolDefDB(const T2ToolDefDB&) { -} - -T2ToolDefDB& T2ToolDefDB::operator=(const T2ToolDefDB&) { -} - -T2ToolDefDB::T2ToolDefDB() { +T2ToolDefDB::T2ToolDefDB() + : LArray(sizeof(T2ToolDefList *)) +{ } /*virtual*/ T2ToolDefDB::~T2ToolDefDB() { } void T2ToolDefDB::AllClear() { + RemoveItemsAt(mItemCount, 1); } -void T2ToolDefDB::Regist(T2ToolDef*) { -} +void T2ToolDefDB::Regist(T2ToolDef* inToolDef) { + if (!inToolDef) + return; -void T2ToolDefDB::Add(T2ToolDefList*) { -} + int categoryNo = inToolDef->GetCategory(); + int n = 1; + LArrayIterator iterator(*this); + T2ToolDefList *theToolDefList; + BOOL added = false; -T2ToolDefList* T2ToolDefDB::GetToolDefList(int) { -} + while (!added && iterator.Next(&theToolDefList)) { + int thisCategory = theToolDefList->GetCategory(); + if (thisCategory == categoryNo) { + theToolDefList->Add(inToolDef); + added = true; + } else { + if (thisCategory > categoryNo) + break; + } -T2TenantDef* T2ToolDefDB::FindFloor() { -} + n++; + } -int T2ToolDefList::GetCategory() { + if (!added) { + theToolDefList = new T2ToolDefList(categoryNo); + theToolDefList->Add(inToolDef); + InsertItemsAt(1, n, &theToolDefList); + } } -int T2ToolDefList::GetCurrentItem() { -} +void T2ToolDefDB::Add(T2ToolDefList* inToolDefList) { + LArrayIterator iterator(*this); + T2ToolDefList *theToolDefList; + BOOL added = false; -void T2ToolDefList::SetCurrentItem(int) { -} + while (!added && iterator.Next(&theToolDefList)) { + if (theToolDefList->GetCategory() == inToolDefList->GetCategory()) { + LArrayIterator toolDefIterator(*inToolDefList); + T2ToolDef *theToolDef; -int T2ToolDefList::GetCurrentVariant() { -} + while (toolDefIterator.Next(&theToolDef)) + theToolDefList->Add(theToolDef); -void T2ToolDefList::SetCurrentVariant(int) { + added = true; + } + } + + if (!added) + InsertItemsAt(1, mItemCount + 1, &inToolDefList); } -T2ToolDefList::T2ToolDefList(const T2ToolDefList&) { +T2ToolDefList* T2ToolDefDB::GetToolDefList(int inCategory) { + LArrayIterator iterator(*this); + T2ToolDefList *theToolDefList; + + while (iterator.Next(&theToolDefList)) { + if (theToolDefList->GetCategory() == inCategory) + return theToolDefList; + } + + return NULL; } -T2ToolDefList& T2ToolDefList::operator=(const T2ToolDefList&) { +T2TenantDef* T2ToolDefDB::FindFloor() { + LArrayIterator iterator(*this); + T2ToolDefList *theToolDefList; + T2TenantDef *theFloor = NULL; + + while (iterator.Next(&theToolDefList)) { + theFloor = theToolDefList->FindFloor(); + if (theFloor) + return theFloor; + } + + return NULL; } -T2ToolDefList::T2ToolDefList(int) { + + +T2ToolDefList::T2ToolDefList(int inCategory) + : LArray(sizeof(T2TemplatePlugin *)) +{ + mCategory = inCategory; + + SetComparator(T2TempPluginComparator::GetComparator()); + mOwnsComparator = false; + SetKeepSorted(true); + + mCurrentItem = 1; + mCurrentVariant = 0; } /*virtual*/ T2ToolDefList::~T2ToolDefList() { } void T2ToolDefList::AllClear() { + RemoveItemsAt(mItemCount, 1); } -void T2ToolDefList::Regist(T2ToolDef*) { +void T2ToolDefList::Regist(T2ToolDef* inToolDef) { + InsertItemsAt(1, mItemCount + 1, &inToolDef); } -void T2ToolDefList::Add(T2ToolDef*) { +void T2ToolDefList::Add(T2ToolDef* inToolDef) { + if (!inToolDef) + return; + + LArrayIterator iterator(*this); + T2ToolDef *theToolDef; + BOOL done = false; + int n = 1; + + while (!done && iterator.Next(&theToolDef)) { + if (theToolDef->GetToolNo() < inToolDef->GetToolNo()) { + InsertItemsAt(1, n, &inToolDef); + done = true; + } + n++; + } + + if (!done) + InsertItemsAt(1, n, &inToolDef); } unsigned int T2ToolDefList::GetItemCount() { + return GetCount(); } -T2ToolDef* T2ToolDefList::GetItemAt(int) { +T2ToolDef* T2ToolDefList::GetItemAt(int inIndex) { + T2ToolDef *theToolDef; + if (FetchItemAt(inIndex, &theToolDef)) + return theToolDef; + else + return NULL; } T2TenantDef* T2ToolDefList::FindFloor() { + T2ToolDef *theTool; + LArrayIterator iterator(*this); + + while (iterator.Next(&theTool)) { + if (theTool->IsTenant() && ((T2TenantDef *) theTool)->IsFloor()) + return (T2TenantDef *) theTool; + } + + return NULL; } -T2TenantDef* T2ToolDefList::FindTenantDef(int) { +T2TenantDef* T2ToolDefList::FindTenantDef(int inToolType) { + T2ToolDef *theTool; + LArrayIterator iterator(*this); + + while (iterator.Next(&theTool)) { + if (theTool->IsTenant() && theTool->GetToolType() == inToolType) + return (T2TenantDef *) theTool; + } + + return NULL; } -T2MoverDef* T2ToolDefList::FindMoverDef(int) { +T2MoverDef* T2ToolDefList::FindMoverDef(int inToolType) { + T2ToolDef *theTool; + LArrayIterator iterator(*this); + + while (iterator.Next(&theTool)) { + if (theTool->IsMover() && theTool->GetToolType() == inToolType) + return (T2MoverDef *) theTool; + } + + return NULL; } |