예제 #1
0
void processEvents(LIST* evl, int tm) {
	cout << "\n \n" << "Processing events at time " << tm << "\n\n" << endl; 
	while (evl->getFirstEvent() != NULL) {
		EVENT* e = evl->getFirstEvent();
		int r = e->getprocessTime();

		if (evl->getFirstEvent()->getprocessTime() <= tm) {
			cout << "    Processing event:\n\n";
			evl->getFirstEvent()->display();
			evl->removeFirstEvent();
		}
		else {
			break;
		}
	}
	return;
};
예제 #2
0
void processEvents(LIST* evl, int tm) {
    cout << "\n \n" << "Processing events at time " << tm << "\n\n" << endl;
    while (evl->getFirstEvent() != NULL) {
        EVENT* e = evl->getFirstEvent();
        int r = e->getprocessTime();

        if (evl->getFirstEvent()->getprocessTime() <= tm) {
            cout << "    Processing event:\n\n";
            evl->getFirstEvent()->display();
            if (evl->getFirstEvent()->isThisMyDevice("Left Turn Signal")) {
                processLeftTurnSignal(e);
            }
            else if (evl->getFirstEvent()->isThisMyDevice("Right Turn Signal")) {
                processRightTurnSignal(e);
            }
            else if (evl->getFirstEvent()->isThisMyDevice("Brake")) {
                processBrake(e);
            }
            else if (evl->getFirstEvent()->isThisMyDevice("Accelerator")) {
                processAccelerator(e);
            }
            else if (evl->getFirstEvent()->isThisMyDevice("Left Turn Lamp")) {
                processLeftTurnLamp(e);
            }
            else if (evl->getFirstEvent()->isThisMyDevice("Right Turn Lamp")) {
                processRightTurnLamp(e);
            }

            evl->removeFirstEvent();
        }
        else {
            break;
        }
    }
    return;
};