CSCI 3081 - Drone Delivery System
carrier.h
Go to the documentation of this file.
1 
8 #ifndef INC_CARRIER_H_
9 #define INC_CARRIER_H_
10 
11 /*******************************************************************************
12  * Includes
13  ******************************************************************************/
14 #include "entity_base.h"
15 #include <vector> // Used for vector like vector3D and vector2D
16 #include <string>
17 #include <iostream>
18 #include "battery.h"
19 #include "package.h"
20 #include "route_strategy.h"
21 
22 namespace csci3081 {
23 /*******************************************************************************
24  * Class Definitions
25  ******************************************************************************/
32  public:
38  bool BatteryDead();
39 
45  bool BatteryFull();
46 
50  float GetBattery();
51 
55  float GetMaxBattery();
56 
64  bool Charging(float);
65 
72  bool HavePackage();
73 
79 
88  bool AddPackage(Package* arg);
89 
97 
103  void SetPosition(std::vector<float> v);
104 
110  void SetSpeed(float);
111 
115  float GetSpeed();
116 
122  void SetRoute(std::vector<vector<float>>);
123 
128  std::vector<float> NextPosition();
129 
134  void PopPosition();
135 
143  void GetStatus();
144 
150 
156  bool IsCurrentlyCharging();
162 
167  void SetChargingStatus(bool b);
168 
174  void SetDroneStatusWhenBatteryDies(std::string status);
175 
180  std::string GetDroneStatusWhenBatteryDies();
181 
187  void GoDownToGround();
188 
196  void Update(float dt);
197 
198  protected:
199  Battery battery;
200  Package* package;
201  float speed;
202  std::vector<std::vector<float>> route;
203  std::string droneStatusWhenBatteryDies = "not dead yet";
204  bool ChargingStatus = false;
205  RouteStrategy* routeStrategy = NULL;
206 };
207 
208 }
209 
210 #endif /* INC_CARRIER_H_ */
float GetMaxBattery()
This returns the battery maximum capacity.
Definition: carrier.cc:19
A representation of a Package, inherited from EntityBase It stores the Package&#39;s name, ID, version, position, direction, and dynamic mode.
Definition: package.h:27
void GetStatus()
Overwritten GetStatus from ASubject. This function creates the arguments required by Notify function ...
Definition: carrier.cc:98
Battery * GetBatteryObj()
This function will return the Battery object.
Definition: carrier.cc:178
bool Charging(float)
This function is used to charge the battery of the carrier for a certain amount of time in seconds...
Definition: carrier.cc:23
std::string GetDroneStatusWhenBatteryDies()
This function gets the battery status (alive, dead on ground, or dead in the air) ...
Definition: carrier.cc:126
bool HavePackage()
This checks if the carrier is already linked to a package.
Definition: carrier.cc:27
Definition: battery.h:26
Package * DropPackage()
This releases the link of the package from the carrier, making the package pointer of the carrier NUL...
Definition: carrier.cc:49
void SetDroneStatusWhenBatteryDies(std::string status)
This function sets the battery status when the battery dies (alive, dead on ground, or dead in the air)
Definition: carrier.cc:122
Definition: asubject.cc:3
Package * GetPackage()
This returns a Package pointer to the package that the carrier is linking to, and returns NULL if the...
Definition: carrier.cc:35
float GetBattery()
This returns the time in secs left in the carrier&#39;s battery.
Definition: carrier.cc:16
bool AddPackage(Package *arg)
This links a package object to the carrier if the carrier is not already linking to another package (...
Definition: carrier.cc:39
void Update(float dt)
This is an inherited method from EntityBase to use for DeliverySimulation. This updates the position ...
Definition: carrier.cc:182
bool BatteryFull()
This function checks if the battery is full.
Definition: carrier.cc:13
void SetPosition(std::vector< float > v)
This function uses to set the new position of the carrier. However, carrier only moves in simulation ...
Definition: carrier.cc:58
void SetChargingStatus(bool b)
This function sets the carrier battery status.
Definition: carrier.cc:118
void SetRoute(std::vector< vector< float >>)
This function adds a full route to route attribute of the carrier This is useful when use for the Get...
Definition: carrier.cc:73
The base class for creating entities.
Definition: entity_base.h:27
A representation of a carrier An abstract base class for delivery transportation clases like Drone or...
Definition: carrier.h:31
float GetSpeed()
return the current speed of the carrier
Definition: carrier.cc:69
bool IsCurrentlyCharging()
This function checks if the carrier battery is currently charging.
Definition: carrier.cc:114
std::vector< float > NextPosition()
This function returns the next position in std::vector<float> in the queue that the carrier needs to ...
Definition: carrier.cc:78
RouteStrategy * GetRouteStrategy()
return the Route Strategy that the carrier uses, such as Smart Route, Beeline, or Parabolic Route ...
Definition: carrier.cc:110
void GoDownToGround()
This function sends the carrier down (if on the air) to the ground when the battery is dead...
Definition: carrier.cc:130
This is the Route Strategy class where we can use the interface to decide which type of route behavio...
Definition: route_strategy.h:24
void PopPosition()
This function pops the first element/position in the position queue of the carrier.
Definition: carrier.cc:89
void SetSpeed(float)
This sets the speed of the carrier. Change the speed of the carrier if the argument is a non-negative...
Definition: carrier.cc:63
This is the Abstract Subject class from which our subjects will inherit Implements the Observer/subje...
Definition: asubject.h:22
bool BatteryDead()
This checks if the carrier is out of battery.
Definition: carrier.cc:10