RoomChangeHistory RoomChangeHistory::searchRoomHistoryForPatient(Patient p) { RoomChangeHistory result; for (int i = 0; i<count; i++) { if (room_change_history[i].patient_id == p.patient_id) { result.insertRoomChange(room_change_history[i]); } } return result; }
void FileHandler::loadRoomChangeHistory(string fname, RoomChangeHistory& rc_history) { // open file ifstream fin; fin.open(fname); if (!fin) { cerr << "\n" << "can't open " << fname << "!!"; return; } // read data from file RoomChange rc; while (!fin.eof()) // read data { fin >> rc.patient_id >> rc.change_date >> rc.before_room >> rc.after_room; rc_history.insertRoomChange(rc); } // close file fin.close(); }