CSCI3081W Drone Delivery System
PackageDecorator.h
1 #ifndef PACKAGE_DECORATOR_H_
2 #define PACKAGE_DECORATOR_H_
3 
4 #include "IEntityDecorator.h"
5 #include "Package.h"
6 #include "Robot.h"
7 
13 class PackageDecorator : public IEntityDecorator<Package> {
14  public:
20 
25  virtual Vector3 getDestination() const { return sub->getDestination(); }
26 
32  virtual std::string getStrategyName() const { return sub->getStrategyName(); }
33 
39  virtual Robot* getOwner() const { return sub->getOwner(); }
40 
46  virtual bool requiresDelivery() const { return sub->requiresDelivery(); }
47 
53  virtual void setStrategyName(std::string strategyName_) {
54  return sub->setStrategyName(strategyName_);
55  }
56 
62  virtual void initDelivery(Robot* owner) { return sub->initDelivery(owner); }
63 
67  virtual void handOff() {
68  if (getOwner()) getOwner()->receive(this);
69  }
70 };
71 
72 #endif
Base class decorator for all entities that implements each specific entity in a template,...
Definition: IEntityDecorator.h:15
Base class decorator for Package that implements IEntityDecorator Package template,...
Definition: PackageDecorator.h:13
virtual std::string getStrategyName() const
Returns the name of the strategy for this package.
Definition: PackageDecorator.h:32
virtual Robot * getOwner() const
Returns the owner of the package.
Definition: PackageDecorator.h:39
virtual void handOff()
Gives the robot/owner this package.
Definition: PackageDecorator.h:67
PackageDecorator(Package *p)
Constructor for PackageDecorator, calls IEntityDecorator constructor.
Definition: PackageDecorator.h:19
virtual Vector3 getDestination() const
Gets the Package's destination.
Definition: PackageDecorator.h:25
virtual void initDelivery(Robot *owner)
Sets the attributes for delivery.
Definition: PackageDecorator.h:62
virtual bool requiresDelivery() const
Returns whether or not the package needs to be delivered.
Definition: PackageDecorator.h:46
virtual void setStrategyName(std::string strategyName_)
Set the Strategy Name.
Definition: PackageDecorator.h:53
Represents a package in a physical system. Packages move using euler integration based on a specified...
Definition: Package.h:17
Represents a robot in a physical system.
Definition: Robot.h:19
void receive(Package *p)
Receives the passed in package.
a simple class used for vector math, most function are self explanatory
Definition: vector3.h:12