almost all internals done after i fix segfault

This commit is contained in:
MassiveAtoms
2019-07-01 14:23:15 -03:00
parent 450ffc9588
commit 5fa84e866f
10 changed files with 127 additions and 96 deletions

View File

@ -3,7 +3,6 @@
#include <array>
#include <thread>
/*
Code strucure like this:
class declarations zijn in /headers/class_naam.h, en definitions van de member
@ -19,6 +18,9 @@ record die zegt dat een customer voor x tijd geparkeert heeft bij spot x, enz.
De client clockt in en uit bij een spot.
*/
void Wait(int sec)
/*
a wait function where 1 sec represents 1 hour irl.
@ -27,35 +29,29 @@ a wait function where 1 sec represents 1 hour irl.
std::this_thread::sleep_for(seconds{sec});
}
Customer* get_customer_ptr_for_parkspot(int id);
int main() {
class Customer sagar {
"query", Verhicle_type::bike
};
sagar.update_db();
Park_spot p1;
p1.clock(&sagar); // in
Wait(2);
p1.clock(&sagar);
Wait(2);
p1.clock(&sagar); // in
Wait(2);
p1.clock(&sagar);
Wait(2);
p1.clock(&sagar); // in
Wait(2);
p1.clock(&sagar);
Wait(2);
query_all_parking_spots();
vector<Customer> test = query_customer_with_name("query");
if (!test.size()){
cout << "No customers with this name found;";
}
else if (test.size()==1) {
cout << "1 customer found;";
}
else {
cout << "MORE customers found?";
}
Customer p0 = query_customer_with_name("Shaquile")[0];
Customer p1 = query_customer_with_name("Sagar Ramsaransing")[0];
Customer p2 = query_customer_with_name("Joshua karto")[0];
Customer p3 = query_customer_with_name("Stefan udit")[0];
parking_spots[2].clock(&p1);
Wait(2);
parking_spots[2].clock(&p1);
Wait(1);
parking_spots[0].clock(&p2);
Wait(1);
parking_spots[1].clock(&p3);
Wait(1);
parking_spots[0].clock(&p2);
parking_spots[1].clock(&p3);
Wait(1);
parking_spots[1].clock(&p3);
}
}