CSCI3081W Drone Delivery System
Public Member Functions | Protected Attributes | List of all members
Package Class Reference

Represents a package in a physical system. Packages move using euler integration based on a specified velocity and direction. More...

#include <Package.h>

Inheritance diagram for Package:
Inheritance graph
[legend]
Collaboration diagram for Package:
Collaboration graph
[legend]

Public Member Functions

 Package (const JsonObject &obj)
 Constructor. More...
 
virtual Vector3 getDestination () const
 Gets the Package's destination. More...
 
virtual std::string getStrategyName () const
 Returns the name of the strategy for this package. More...
 
virtual RobotgetOwner () const
 Returns the owner of the package. More...
 
virtual bool requiresDelivery () const
 Returns whether or not the package needs to be delivered. More...
 
virtual void setStrategyName (std::string strategyName_)
 Set the Strategy Name. More...
 
virtual void update (double dt)
 Updates the Package. More...
 
virtual void initDelivery (Robot *owner)
 Sets the attributes for delivery. More...
 
virtual void handOff ()
 Gives the robot/owner this package.
 
- Public Member Functions inherited from IEntity
 IEntity ()
 Constructor that assigns a unique ID to the entity.
 
 IEntity (const JsonObject &details)
 Constructor with JsonObject details to define the entity. More...
 
virtual ~IEntity ()
 Virtual destructor for IEntity.
 
virtual void linkModel (SimulationModel *model)
 Links this entity to a simulation model, giving it access to the model's public variables and functions. More...
 
virtual int getId () const
 Gets the ID of the entity. More...
 
virtual Vector3 getPosition () const
 Gets the position of the entity. More...
 
virtual Vector3 getDirection () const
 Gets the direction of the entity. More...
 
virtual const JsonObjectgetDetails () const
 Gets the details of the entity. More...
 
virtual std::string getColor () const
 Gets the color of the entity. More...
 
virtual std::string getName () const
 Gets the name of the entity. More...
 
virtual double getSpeed () const
 Gets the speed of the entity. More...
 
virtual void setPosition (Vector3 pos_)
 Sets the position of the entity. More...
 
virtual void setDirection (Vector3 dir_)
 Set the direction of the entity. More...
 
virtual void setColor (std::string col_)
 Sets the color of the entity. More...
 
virtual void rotate (double angle)
 Rotate the entity around y axis. More...
 
virtual SimulationModelgetModel () const
 
- Public Member Functions inherited from IPublisher
void addObserver (const IObserver *o)
 adds an observer to the simulation More...
 
void removeObserver (const IObserver *o)
 removes an observer in the simulation More...
 
void notifyObservers (const std::string &message) const
 notifies all observers with a specific message More...
 

Protected Attributes

bool requiresDelivery_ = true
 
Vector3 destination
 
std::string strategyName
 
Robotowner = nullptr
 
- Protected Attributes inherited from IEntity
SimulationModelmodel = nullptr
 
int id = -1
 
JsonObject details
 
Vector3 position
 
Vector3 direction
 
std::string color
 
std::string name
 
double speed = 0
 

Detailed Description

Represents a package in a physical system. Packages move using euler integration based on a specified velocity and direction.

Constructor & Destructor Documentation

◆ Package()

Package::Package ( const JsonObject obj)

Constructor.

Parameters
objJSON object containing the package's information

Member Function Documentation

◆ getDestination()

virtual Vector3 Package::getDestination ( ) const
virtual

Gets the Package's destination.

Returns
The Package's destination

◆ getOwner()

virtual Robot* Package::getOwner ( ) const
virtual

Returns the owner of the package.

Returns
pointer to Robot owning the package

◆ getStrategyName()

virtual std::string Package::getStrategyName ( ) const
virtual

Returns the name of the strategy for this package.

Returns
String name of strategy

◆ initDelivery()

virtual void Package::initDelivery ( Robot owner)
virtual

Sets the attributes for delivery.

Parameters
ownerRobot for the package to be delivered to

◆ requiresDelivery()

virtual bool Package::requiresDelivery ( ) const
virtual

Returns whether or not the package needs to be delivered.

Returns
boolean value of the above statement

◆ setStrategyName()

virtual void Package::setStrategyName ( std::string  strategyName_)
virtual

Set the Strategy Name.

Parameters
strategyName_Strategy name

◆ update()

virtual void Package::update ( double  dt)
virtual

Updates the Package.

Parameters
dtdifference in time since last update

Implements IEntity.


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