bf17b82c2e
This is in no way finished. CHECK TODOs!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
45 lines
906 B
C++
45 lines
906 B
C++
#ifndef PARK_TIME_H
|
|
#define PARK_TIME_H
|
|
#pragma once
|
|
|
|
#include "data.h"
|
|
|
|
#include <chrono>
|
|
#include <ctime>
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
using namespace std::chrono;
|
|
using std::cout;
|
|
using std::string;
|
|
using std::to_string;
|
|
/*
|
|
|
|
|
|
Record of who parked at what park_spot and at what time.
|
|
*/
|
|
|
|
class Park_time {
|
|
public:
|
|
Park_time(int c_id, int s_id);
|
|
Park_time(int id_, int customer_id_, int spot_id_, int start_,
|
|
int duration_);
|
|
~Park_time();
|
|
int id;
|
|
int customer_id;
|
|
int spot_id;
|
|
int duration;
|
|
|
|
void clock_out(int c_id, int s_id);
|
|
friend std::ostream& operator<<(std::ostream& os, const Park_time& pt);
|
|
|
|
private:
|
|
high_resolution_clock::time_point start;
|
|
high_resolution_clock::time_point end;
|
|
void save_db();
|
|
void update_db();
|
|
int auto_increment_db(); // helper
|
|
int start_to_int(); // helper
|
|
};
|
|
|
|
#endif // Park_time
|