diff options
Diffstat (limited to 'src/T2DLL/T2RegistedTenantIterator.cpp')
-rw-r--r-- | src/T2DLL/T2RegistedTenantIterator.cpp | 65 |
1 files changed, 62 insertions, 3 deletions
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; } |