A representation of a Package, inherited from EntityBase It stores the Package's name, ID, version, position, direction, and dynamic mode.
More...
#include <package.h>
|
| Package (const picojson::object &detail) |
|
| Package (Package &package) |
| Copy Constructor. This creates a new instance of Package that has the same content as the Package argument. More...
|
|
void | SetOwner (Customer *) |
| This links a customer object to the package object if the package has not already had a customer. More...
|
|
Customer * | GetOwner () |
| This returns a customer object of the package object if there is one, return NULL otherwise.
|
|
void | SetPosition (std::vector< float > agr) |
| This function uses to set the new position of the package. However, package only moves in simulation if its dynamic attribute is set to true. More...
|
|
void | SetCarrier (IEntity *) |
| This links a carrier Entity object (drone, truck, robot, etc) to the package object if the package has not already had a one. More...
|
|
IEntity * | GetCarrier () |
| This returns the pointer that points to the carrier carrying the package if there is one; return NULL otherwise.
|
|
void | SetDynamic (bool n) |
| This changes the dynamic of the drone. Note that for the drone to move on the simulation, dynamic of the drone must be set to true. More...
|
|
void | Deliver () |
| This sets the deliverd attribute of the package to true, signaling that the package has already been delivered. Change the carrier of the package to NULL. Change the position of the package to out of the camera of the simulation to "teleport" out of the scene when delivered.
|
|
bool | IsDelivered () |
| This returns a TRUE if the package has been delivered, FALSE otherwise.
|
|
void | GetStatus () |
| Overwritten GetStatus from ASubject. This function creates the arguments required by Notify function and makes call to Notify function. This function should be called when path is added to the package is schedule to deliver, en route (picked up) or delivered.
|
|
void | Update (float dt) |
| This is an inherited method from EntityBase to use for DeliverySimulation. This updates the position of the package on the simulation if the position changes and its dynamic is set to true.
|
|
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 () |
|
virtual | ~IEntity () |
| The destructor.
|
|
void | Attach (entity_project::IEntityObserver *observer) |
| Adds an observer to the list of observers for this subject. More...
|
|
void | Detach (entity_project::IEntityObserver *observer) |
| Deletes an observer from the list of observers for this subject. More...
|
|
std::vector< entity_project::IEntityObserver * > | GetList () |
| Getter function for the list of observers (mostly used in testing) More...
|
|
void | Notify (picojson::value &event, const entity_project::IEntity &entity) |
| Sends out Notification to the observer watching this subject. More...
|
|
|
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 |
|
std::vector< entity_project::IEntityObserver * > | list |
| List of pointers to the observers for this subject.
|
|
A representation of a Package, inherited from EntityBase It stores the Package's name, ID, version, position, direction, and dynamic mode.
◆ Package() [1/2]
csci3081::Package::Package |
( |
const picojson::object & |
detail | ) |
|
Constructor, creates a Package object param[in] detail a picojson::object object that has the detail of the package including name, position, direction, and radius
◆ Package() [2/2]
csci3081::Package::Package |
( |
Package & |
package | ) |
|
Copy Constructor. This creates a new instance of Package that has the same content as the Package argument.
- Parameters
-
[in] | package | Package instance that wants to be copied |
◆ SetCarrier()
void csci3081::Package::SetCarrier |
( |
IEntity * |
ve | ) |
|
This links a carrier Entity object (drone, truck, robot, etc) to the package object if the package has not already had a one.
- Parameters
-
◆ SetDynamic()
void csci3081::Package::SetDynamic |
( |
bool |
n | ) |
|
This changes the dynamic of the drone. Note that for the drone to move on the simulation, dynamic of the drone must be set to true.
- Parameters
-
[in] | n | True if the drone is actively moving in the simulation False otherwise |
◆ SetOwner()
void csci3081::Package::SetOwner |
( |
Customer * |
o | ) |
|
This links a customer object to the package object if the package has not already had a customer.
- Parameters
-
◆ SetPosition()
void csci3081::Package::SetPosition |
( |
std::vector< float > |
agr | ) |
|
This function uses to set the new position of the package. However, package only moves in simulation if its dynamic attribute is set to true.
- Parameters
-
agr | a std::vector<float> that has the new position of the package |
The documentation for this class was generated from the following files:
- /home/user/repo/project/include/package.h
- /home/user/repo/project/src/package.cc