extern "C" int BootstrapRunLibrary(int argc, const char **argv) #endif { Simulator *lpSim = NULL; try { Simulator *lpSim = Simulator::CreateSimulator(argc, argv); lpSim->Load(); lpSim->Initialize(argc, argv); lpSim->VisualSelectionMode(SIMULATION_SELECTION_MODE); lpSim->StartSimulation(); lpSim->Simulate(); if(lpSim) delete lpSim; return 0; } catch(CStdErrorInfo oError) { if(lpSim) delete lpSim; printf("Error occurred: %s\n", oError.m_strError.c_str()) ; return (int) oError.m_lError; } catch(...) { if(lpSim) delete lpSim; printf("An Unknown Error occurred.\n") ; return -1; } }
int main() { FileHandler* fh = FileHandler::GetInstance(); vector<Passenger*> passengers; fh->ReadPassengers(passengers); cout << "FIFO simulation start" << endl; Simulator* simulator = Simulator::GetInstance(); Strategy* strategy = new FIFO(); vector<Passenger*> servedPassengers = simulator->Simulate(strategy, passengers); simulator->GetEverageTicketingWaitingTime(servedPassengers); fh->WritePassengers(servedPassengers, "result1.txt"); cout << "\nLTFO simulation start" << endl; fh->ReadPassengers(passengers); strategy = new LTFO(); servedPassengers = simulator->Simulate(strategy, passengers); simulator->GetEverageTicketingWaitingTime(servedPassengers); fh->WritePassengers(servedPassengers, "result2.txt"); return 0; }