From c0c336500955a23e344651e5412c9d9d441ef4ee Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 28 Jun 2023 22:22:32 +0100 Subject: first pass of T2DLL --- src/T2DLL/T2RegistedTenantIterator.cpp | 65 ++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-) (limited to 'src/T2DLL/T2RegistedTenantIterator.cpp') diff --git a/src/T2DLL/T2RegistedTenantIterator.cpp b/src/T2DLL/T2RegistedTenantIterator.cpp index ee47955..c9597c0 100644 --- a/src/T2DLL/T2RegistedTenantIterator.cpp +++ b/src/T2DLL/T2RegistedTenantIterator.cpp @@ -1,13 +1,72 @@ +#include "T2EquipPtrList.h" +#include "T2RegistedTenantDB.h" #include "T2RegistedTenantIterator.h" +#include "T2RouteNavigator.h" +#include "T2Tenant.h" -T2RegistedTenantIterator::T2RegistedTenantIterator(const T2RegistedTenantDB*, unsigned int, const T2RouteNavigator*, POINT) { +T2RegistedTenantIterator::T2RegistedTenantIterator(const T2RegistedTenantDB* db, unsigned int registID, const T2RouteNavigator* routeNavigator, POINT point) { + mEquipPtrList = db->GetList(registID); + mRouteNavigator = routeNavigator; + + if (mEquipPtrList && mRouteNavigator) { + mIndex = 0; + mPoint = point; + } else { + mIndex = -2; + } } T2RegistedTenantIterator::~T2RegistedTenantIterator() { } -int T2RegistedTenantIterator::Next(T2Tenant*&) { +BOOL T2RegistedTenantIterator::Next(T2Tenant*& pTenant) { + BOOL result = false; + BOOL done = false; + T2Tenant *tenant = NULL; + + while (!done) { + mIndex++; + + if (mIndex > 0 && mEquipPtrList->FetchItemAt(mIndex, &tenant)) { + int status = tenant->GetStatus(); + if (status > 9 && status < 10000) { + POINT entrancePt = tenant->GetEntrancePt(); + if (mRouteNavigator->CheckRoute(mPoint, entrancePt, tenant->GetCustomerSearchScore())) { + pTenant = tenant; + result = true; + done = true; + } + } + } else { + done = true; + } + } + + return result; } -int T2RegistedTenantIterator::NextJob(T2Tenant*&) { +BOOL T2RegistedTenantIterator::NextJob(T2Tenant*& pTenant) { + BOOL result = false; + BOOL done = false; + T2Tenant *tenant = NULL; + + while (!done) { + mIndex++; + + if (mIndex > 0 && mEquipPtrList->FetchItemAt(mIndex, &tenant)) { + int status = tenant->GetStatus(); + if (status > 9 && status < 10000) { + POINT entrancePt = tenant->GetEntrancePt(); + if (mRouteNavigator->CheckRoute(mPoint, entrancePt, tenant->GetEmployeeSearchScore())) { + pTenant = tenant; + result = true; + done = true; + } + } + } else { + done = true; + } + } + + return result; } -- cgit v1.2.3