|
lab_memory
Malevolent Memories
|
An allocator object to wrap the allocation of last-name letter groups to rooms. More...
#include "allocator.h"
Collaboration diagram for Allocator:Public Member Functions | |
| Allocator (const string &studentFile, const string &roomFile) | |
| Creates an Allocator object based on a list of students and a list of rooms. More... | |
| void | allocate () |
| Calls the solving routine to allocate student letter groups to rooms. More... | |
| void | printStudents (std::ostream &stream=std::cout) |
| Prints each letter and how many students there are for each one. More... | |
| void | printRooms (std::ostream &stream=std::cout) |
| Prints the room allocation determined by this Allocator. More... | |
Private Member Functions | |
| void | createLetterGroups () |
| Creates the array of letters. More... | |
| void | loadStudents (const string &file) |
| Reads the students from the students file and places them in their letter groups. More... | |
| void | loadRooms (const string &file) |
| Reads rooms from the rooms file and sets their capacities. More... | |
| int | solve () |
| Runs the algorithm on the set of rooms and students. More... | |
| Room * | largestOpening () |
| Return the room with the largest number of open seasts. More... | |
| int | minSpaceRemaining () |
| Returns the amount of seats remaining in the room with the fewest spare seats. More... | |
Private Attributes | |
| Letter * | alpha |
| Array of all letters (size 26) More... | |
| Room * | rooms |
| Array of all rooms. More... | |
| int | roomCount |
| Size of the rooms array. More... | |
| int | studentCount |
| Total number of students. More... | |
| int | totalCapacity |
| Total number of available seats across all rooms. More... | |
An allocator object to wrap the allocation of last-name letter groups to rooms.
Creates an Allocator object based on a list of students and a list of rooms.
| studentFile | Path to roster file |
| roomFile | Path to room list file |
| void Allocator::allocate | ( | ) |
Calls the solving routine to allocate student letter groups to rooms.
| void Allocator::printStudents | ( | std::ostream & | stream = std::cout | ) |
Prints each letter and how many students there are for each one.
| stream | Where to print the results to |
| void Allocator::printRooms | ( | std::ostream & | stream = std::cout | ) |
Prints the room allocation determined by this Allocator.
| stream | Where to print the results to |
|
private |
Creates the array of letters.
|
private |
Reads the students from the students file and places them in their letter groups.
| file | The file to read the student list from |
|
private |
Reads rooms from the rooms file and sets their capacities.
| file | The file to read the room list from |
|
private |
Runs the algorithm on the set of rooms and students.
|
private |
Return the room with the largest number of open seasts.
|
private |
Returns the amount of seats remaining in the room with the fewest spare seats.
|
private |
Array of all letters (size 26)
|
private |
Array of all rooms.
|
private |
Size of the rooms array.
|
private |
Total number of students.
|
private |
Total number of available seats across all rooms.