static void delete_jobs(JobList& list) { for (each<JobList> i = list; i; ++i) { if (i->m_owned) delete i->m_job; } list.clear(); }
void read_input() { freopen("jobs.txt", "r", stdin); cin >> num_jobs; jobs.clear(); for (int idx = 0; idx < num_jobs; ++idx) { int weight, length; cin >> weight >> length; jobs.push_back(make_pair(weight, length)); } fclose(stdin); }
void NUPlatform::process(JobList* jobs, NUIO* m_io) { static list<Job*>::iterator it; // the iterator over the jobs for (it = jobs->camera_begin(); it != jobs->camera_end();) { //debug << "NUPlatform::Process - Processing Job" << endl; if ((*it)->getID() == Job::CAMERA_CHANGE_SETTINGS) { // process a camera settings job CameraSettings settings; static ChangeCameraSettingsJob* job; job = (ChangeCameraSettingsJob*) (*it); settings = job->getSettings(); #if DEBUG_NUPLATFORM_VERBOSITY > 4 debug << "NUPlatform::process(): Processing a camera job." << endl; #endif if( settings.p_exposure.get() == 0 && settings.p_contrast.get() == 0 && settings.p_gain.get() == 0 ) { #if DEBUG_NUPLATFORM_VERBOSITY > 4 debug << "NUPlatform::Process - Send CAMERASETTINGS Request Recieved: " << endl; #endif JobList toSendList; ChangeCameraSettingsJob newJob(m_camera->getSettings()); #if DEBUG_NUPLATFORM_VERBOSITY > 4 debug << "About to send: " << m_camera->getSettings(); #endif toSendList.addCameraJob(&newJob); (*m_io) << toSendList; toSendList.clear(); } else { m_camera->setSettings(settings); } it = jobs->removeCameraJob(it); } else { ++it; } } }