-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathRideService.hpp
41 lines (33 loc) · 1.16 KB
/
RideService.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef RIDE_SERVICE_HPP
#define RIDE_SERVICE_HPP
#include <vector>
#include <string>
#include "User.hpp"
#include "Ride.hpp"
class RideService {
private:
std::vector<User*> users;
std::vector<Ride*> rides;
int userIdCounter;
int rideIdCounter;
public:
RideService();
~RideService();
User* registerUser(const std::string& name, const std::string& phone,
UserType type, Location* location);
void removeUser(const std::string& userId);
Ride* requestRide(const std::string& riderId, Location* pickup, Location* dropoff);
bool assignDriver(const std::string& rideId, const std::string& driverId);
bool updateRideStatus(const std::string& rideId, RideStatus status);
bool rateUser(const std::string& userId, double rating);
void displayUsers() const;
void displayRides() const;
void displayUserHistory(const std::string& userId) const;
private:
User* findUser(const std::string& userId) const;
Ride* findRide(const std::string& rideId) const;
User* findNearestDriver(const Location& pickup) const;
std::string generateUserId();
std::string generateRideId();
};
#endif