CSCI 3081 - Drone Delivery System
delivery_simulation.h
Go to the documentation of this file.
1 
4 #ifndef DELIVERY_SIMULATION_H_
5 #define DELIVERY_SIMULATION_H_
6 
7 /*******************************************************************************
8  * Includes
9  ******************************************************************************/
10 #include <EntityProject/facade/delivery_system.h>
11 #include <vector>
12 #include <string>
13 #include "composite_factory.h"
14 #include "drone_factory.h"
15 #include "customer_factory.h"
16 #include "package_factory.h"
17 #include "carrier_factory.h"
19 #include "recharge_drone_factory.h"
20 #include "carrier.h"
21 #include "package.h"
22 #include "customer.h"
23 #include "charging_station.h"
24 
25 namespace csci3081 {
26 
27 /*******************************************************************************
28  * Class Definitions
29  ******************************************************************************/
37 // DO NOT MODIFY (unless you really know what you are doing)
39  public:
44 
47 
71  IEntity* CreateEntity(const picojson::object& val);
72 
76  void AddFactory(IEntityFactory* factory);
77 
81  void AddEntity(IEntity* entity);
82 
88  void SetGraph(const IGraph* graph);
89 
97  void ScheduleDelivery(IEntity* package, IEntity* dest);
98 
100  void AddObserver(IEntityObserver* observer);
101 
103  void RemoveObserver(IEntityObserver* observer);
104 
108  const std::vector<IEntity*>& GetEntities() const;
109 
121  void Update(float dt);
122 
130  void RunScript(const picojson::array& script, IEntitySystem* system) const;
131 
137  Carrier* AvailableCarrier(IEntity* package);
138 
139  private:
140  // You don't strictly need to use the following variable, but it is probably
141  // the most straightforward way of storing the entities in the system.
142  // Feel free to use it as is or change it.
143  std::vector<IEntity*> entities_;
144  std::vector<IEntityObserver*> observers_;
145  std::vector<ASubject*> subjects_;
146  CompositeFactory* composite;
147  int numEntities;
148  const IGraph* graph;
149  ChargingStation* rechargeStation;
150 };
151 
152 } // namespace csci3081
153 
154 
155 #endif // DELIVERY_SIMULATION_H_
DeliverySimulation()
Constructor: this can do any setup your system necessitates.
Definition: delivery_simulation.cc:8
void RemoveObserver(IEntityObserver *observer)
Definition: delivery_simulation.cc:76
void SetGraph(const IGraph *graph)
Definition: delivery_simulation.cc:54
A representation of a ChargingStation, inherited from EntityBase It stores the ChargingStation&#39;s name...
Definition: charging_station.h:26
The abstract facade of a drone delivery subsystem.
Definition: delivery_system.h:13
An abstract class that represents an entity system that contains entities and updates over time...
Definition: entity_system.h:10
Definition: asubject.cc:3
~DeliverySimulation()
Desconstructor: This should free any memory that your program uses.
Definition: delivery_simulation.cc:18
Represents a read only graph object.
Definition: graph.h:12
void AddObserver(IEntityObserver *observer)
Definition: delivery_simulation.cc:65
This is the facade for the delivery system.
Definition: delivery_simulation.h:38
Definition: entity_factory.h:12
void AddFactory(IEntityFactory *factory)
Definition: delivery_simulation.cc:34
void ScheduleDelivery(IEntity *package, IEntity *dest)
Definition: delivery_simulation.cc:58
void RunScript(const picojson::array &script, IEntitySystem *system) const
You do not need to worry about this function.
Definition: delivery_simulation.cc:201
This is a derived class from IEntityFactory to manage all other factories (e.g. DroneFactory, PackageFactory, CustomerFactory...)
Definition: composite_factory.h:24
A representation of a carrier An abstract base class for delivery transportation clases like Drone or...
Definition: carrier.h:31
const std::vector< IEntity * > & GetEntities() const
Definition: delivery_simulation.cc:92
Carrier * AvailableCarrier(IEntity *package)
Return pointer to the most suitable available carrier (e.g. drone, robot, etc) to deliver a package...
Definition: delivery_simulation.cc:165
IEntity * CreateEntity(const picojson::object &val)
Definition: delivery_simulation.cc:26
A movable object in a scene. Entities have position, direction and size.
Definition: entity.h:15
void Update(float dt)
Definition: delivery_simulation.cc:96
Observers entity events when they occur.
Definition: entity_observer.h:14
void AddEntity(IEntity *entity)
Definition: delivery_simulation.cc:38