almost done

This commit is contained in:
2019-07-01 21:51:23 -03:00
parent 601f6c92bc
commit 9ae95aef1c
8 changed files with 134 additions and 14 deletions

View File

@@ -46,10 +46,5 @@ class Customer {
int auto_increment_db();
};
static vector<Customer> park_customers;
// save the customers that are parked in here
// parking_spot uses pointers, so it's better to save the parked customers here
// where we know they'll be destroyed at the end of this scope, instead of too
// early and end up with dangling pointers
#endif // CUSTOMER_H

View File

@@ -1,5 +1,8 @@
#include "Customer.h"
#ifndef PARK_SPOT_H
#define PARK_SPOT_H
#pragma once
#include "Customer.h"
/*
db representation:
int id not null
@@ -16,7 +19,7 @@ class Park_spot {
bool taken;
int parked_customer;
Park_spot();
Park_spot(int id_, bool taken_, Customer& parked);
Park_spot(int id_, bool taken_, int parked);
void clock(Customer& c_customer);
private:
@@ -25,5 +28,4 @@ class Park_spot {
void delete_db();
int auto_increment_db();
};
static vector<Park_spot> parking_spots; // to save the parking spots in memory
#endif // CUSTOMER_H

21
headers/Query.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef QUERY_H
#define QUERY_H
#pragma once
#include "Park_spot.h"
#include <array>
vector<Park_time> query_parktimes_for_customer(int cid);
vector<Customer> query_customer_with_name(string name);
Customer query_customer_with_id(int id);
vector<Park_spot> query_all_parking_spots(); // used for initializing the parking spots at start of the program
static vector<Park_spot> parking_spots = query_all_parking_spots(); // to save the parking spots in memory
static vector<Customer> park_customers;
// save the customers that are parked in here
#endif // CUSTOMER_H

View File

@@ -6,6 +6,7 @@
namespace data {
SQLite::Database start_db();
static SQLite::Database db = start_db();
} // namespace data