CSCI 3081 - Drone Delivery System
Public Member Functions | List of all members
csci3081::ChargingStation Class Reference

A representation of a ChargingStation, inherited from EntityBase It stores the ChargingStation's name, ID, version, position, direction, and dynamic mode. More...

#include <charging_station.h>

Inheritance diagram for csci3081::ChargingStation:
Inheritance graph

Public Member Functions

 ChargingStation (const picojson::object &val)
 
 ChargingStation (ChargingStation &chargingStation)
 Copy Constructor. This creates a new instance of ChargingStation that has the same content as the chargingStation argument. More...
 
void AddDeadCarrier (Carrier *carrier)
 This adds a new dead carrier to a deadCarriers vector. More...
 
void PopDeadCarrier ()
 This removes the first dead carrier from a deadCarriers vector. This is due to a recharging drone that is heading towards a dead carrier to charge its battery.
 
bool HasDeadCarrier (Carrier *carrier)
 This function checks if the charging station has already stored the dead carrier. More...
 
bool AddChargingDrone (RechargeDrone *chargingDrone)
 This adds a unique charging drone to the charging station only if the distance between the two is close together. More...
 
void RemoveChargingDrone (RechargeDrone *chargingDrone)
 This removes a charging drone from the charging station. This is due to a charging drone leaving the station to charge for a dead carrier. More...
 
void Update (float dt)
 This is an inherited method from EntityBase to use for DeliverySimulation. This updates the position of the carrier on the simulation if the position changes and its dynamic is set to true. In addition, this function also checks if the carrier is in within distance with the package to pick it up, or within distance with the customer to drop off the package.
 
- Public Member Functions inherited from csci3081::EntityBase
const picojson::object & GetDetails ()
 
int GetId () const
 
const std::string & GetName ()
 
const std::vector< float > & GetPosition () const
 
const std::vector< float > & GetDirection () const
 
float GetRadius () const
 
int GetVersion () const
 
bool IsDynamic () const
 
float DistanceBetween (IEntity *another)
 
bool IsWithin (IEntity *another)
 
std::string GetType ()
 
- Public Member Functions inherited from entity_project::IEntity
virtual ~IEntity ()
 The destructor.
 

Additional Inherited Members

- Protected Attributes inherited from csci3081::EntityBase
std::string name
 
int ID
 
std::vector< float > position
 
std::vector< float > direction
 
bool dynamic
 
int version
 
float radius
 
std::string type
 
picojson::object details
 

Detailed Description

A representation of a ChargingStation, inherited from EntityBase It stores the ChargingStation's name, ID, version, position, direction, and dynamic mode.

Constructor & Destructor Documentation

◆ ChargingStation() [1/2]

csci3081::ChargingStation::ChargingStation ( const picojson::object &  val)

Constructor param[in] val: the json object of the ChargingStation

◆ ChargingStation() [2/2]

csci3081::ChargingStation::ChargingStation ( ChargingStation chargingStation)

Copy Constructor. This creates a new instance of ChargingStation that has the same content as the chargingStation argument.

Parameters
[in]chargingStationchargingStation instance that wants to be copied

Member Function Documentation

◆ AddChargingDrone()

bool csci3081::ChargingStation::AddChargingDrone ( RechargeDrone chargingDrone)

This adds a unique charging drone to the charging station only if the distance between the two is close together.

Parameters
[in]chargingDroneA charging drone to be added to the charging station.
Returns
bool Returns true if the charging drone was successfully added. False otherwise.

◆ AddDeadCarrier()

void csci3081::ChargingStation::AddDeadCarrier ( Carrier carrier)

This adds a new dead carrier to a deadCarriers vector.

Parameters
[in]carrierA new carrier to be added to deadCarriers vector.

◆ HasDeadCarrier()

bool csci3081::ChargingStation::HasDeadCarrier ( Carrier carrier)

This function checks if the charging station has already stored the dead carrier.

Parameters
[in]carrierDead carrier to be checked if noted in the charging station
Returns
bool True if the charging station has already stored the dead carrier. False otherwise.

◆ RemoveChargingDrone()

void csci3081::ChargingStation::RemoveChargingDrone ( RechargeDrone chargingDrone)

This removes a charging drone from the charging station. This is due to a charging drone leaving the station to charge for a dead carrier.

Parameters
[in]chargingDroneA charging drone to be removed from the charging station.

The documentation for this class was generated from the following files: