CSCI3081W Drone Delivery System
Public Member Functions | Protected Attributes | List of all members
IEntity Class Referenceabstract

Represents an entity in a physical system. More...

#include <IEntity.h>

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

Public Member Functions

 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 void update (double dt)=0
 Updates the entity's position in the physical system. 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

SimulationModelmodel = nullptr
 
int id = -1
 
JsonObject details
 
Vector3 position
 
Vector3 direction
 
std::string color
 
std::string name
 
double speed = 0
 

Detailed Description

Represents an entity in a physical system.

An IEntity object has a unique ID, a position, a direction, a destination, and details. It also has a speed, which determines how fast the entity moves in the physical system. Subclasses of IEntity can override the Update function to implement their own movement behavior.

Constructor & Destructor Documentation

◆ IEntity()

IEntity::IEntity ( const JsonObject details)

Constructor with JsonObject details to define the entity.

Parameters
detailsThe JsonObject to define the entity

Member Function Documentation

◆ getColor()

virtual std::string IEntity::getColor ( ) const
virtual

Gets the color of the entity.

Returns
The color of the entity

Reimplemented in IEntityDecorator< T >.

◆ getDetails()

virtual const JsonObject& IEntity::getDetails ( ) const
virtual

Gets the details of the entity.

Returns
The details of the entity.

Reimplemented in IEntityDecorator< T >.

◆ getDirection()

virtual Vector3 IEntity::getDirection ( ) const
virtual

Gets the direction of the entity.

Returns
The direction of the entity.

Reimplemented in IEntityDecorator< T >.

◆ getId()

virtual int IEntity::getId ( ) const
virtual

Gets the ID of the entity.

Returns
The ID of the entity.

Reimplemented in IEntityDecorator< T >.

◆ getName()

virtual std::string IEntity::getName ( ) const
virtual

Gets the name of the entity.

Returns
The name of the entity

Reimplemented in IEntityDecorator< T >.

◆ getPosition()

virtual Vector3 IEntity::getPosition ( ) const
virtual

Gets the position of the entity.

Returns
The position of the entity.

Reimplemented in IEntityDecorator< T >.

◆ getSpeed()

virtual double IEntity::getSpeed ( ) const
virtual

Gets the speed of the entity.

Returns
The speed of the entity.

Reimplemented in IEntityDecorator< T >.

◆ linkModel()

virtual void IEntity::linkModel ( SimulationModel model)
virtual

Links this entity to a simulation model, giving it access to the model's public variables and functions.

Parameters
[in]modelThe simulation model to link.

Reimplemented in IEntityDecorator< T >.

◆ rotate()

virtual void IEntity::rotate ( double  angle)
virtual

Rotate the entity around y axis.

Parameters
angleThe angle to rotate the entity by.

Reimplemented in IEntityDecorator< T >.

◆ setColor()

virtual void IEntity::setColor ( std::string  col_)
virtual

Sets the color of the entity.

Parameters
col_The new color of the entity

Reimplemented in IEntityDecorator< T >.

◆ setDirection()

virtual void IEntity::setDirection ( Vector3  dir_)
virtual

Set the direction of the entity.

Parameters
dir_The new direction of the entity.

Reimplemented in IEntityDecorator< T >.

◆ setPosition()

virtual void IEntity::setPosition ( Vector3  pos_)
virtual

Sets the position of the entity.

Parameters
pos_The desired position of the entity.

Reimplemented in IEntityDecorator< T >.

◆ update()

virtual void IEntity::update ( double  dt)
pure virtual

Updates the entity's position in the physical system.

Parameters
dtThe time step of the update.

Implemented in Robot, RechargeStation, RechargeDrone, POI, Package, Human, Helicopter, Drone, and IEntityDecorator< T >.


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