|
1 | 1 | #pragma once
|
2 |
| -#include "rider.hpp" |
3 |
| -#include "driver.hpp" |
4 |
| - |
5 |
| -//This class basically has all the info that will be used by strategy |
6 |
| -//# strategy and Driver Matching strategy will need data |
7 |
| -//Even if more data is needed, only this class needs to be updated |
| 2 | +#include "location.hpp" |
| 3 | +#include "common.hpp" |
8 | 4 |
|
| 5 | +// We can add more data (if needed) here, required to make decisions of # and DriverMatchign strategy |
9 | 6 | class TripMetaData {
|
10 |
| - Location* srcLoc; |
11 |
| - Location* dstLoc; |
12 |
| - RATING riderRating; |
13 |
| - RATING driverRating; |
| 7 | + shared_ptr<Location> srcLoc; |
| 8 | + shared_ptr<Location> dstLoc; |
| 9 | + RATING riderRating; |
| 10 | + RATING driverRating; |
14 | 11 | public:
|
15 |
| - TripMetaData(Location* pSrcLoc, Location* pDstLoc, RATING pRiderRating) : |
16 |
| - srcLoc(pSrcLoc), dstLoc(pDstLoc), riderRating(pRiderRating) { |
17 |
| - driverRating = RATING::UNASSIGNED; |
18 |
| - } |
19 |
| - //getters and setters should be in cpp guys, I am just lazy to that |
20 |
| - RATING getRiderRating() { |
21 |
| - return riderRating; |
22 |
| - } |
23 |
| - RATING getDriverRating() { |
24 |
| - return driverRating; |
25 |
| - } |
26 |
| - void setDriverRating(RATING pDriverRating) { |
27 |
| - driverRating = pDriverRating; |
28 |
| - } |
| 12 | + TripMetaData(shared_ptr<Location> pSrcLoc, shared_ptr<Location> pDstLoc, RATING pRiderRating) : |
| 13 | + srcLoc(std::move(pSrcLoc)), dstLoc(std::move(pDstLoc)), riderRating(pRiderRating), driverRating(RATING::UNASSIGNED) {} |
| 14 | + |
| 15 | + RATING getRiderRating() const { |
| 16 | + return riderRating; |
| 17 | + } |
| 18 | + |
| 19 | + RATING getDriverRating() const { |
| 20 | + return driverRating; |
| 21 | + } |
| 22 | + |
| 23 | + void setDriverRating(RATING pDriverRating) { |
| 24 | + driverRating = pDriverRating; |
| 25 | + } |
| 26 | + |
| 27 | + virtual ~TripMetaData() = default; // Added virtual destructor |
29 | 28 | };
|
0 commit comments