CSCI3081W Drone Delivery System
Public Member Functions | Protected Attributes | List of all members
IEntityDecorator< T > Class Template Reference

Base class decorator for all entities that implements each specific entity in a template, delegates all work to wrapped entity class. More...

#include <IEntityDecorator.h>

Inheritance diagram for IEntityDecorator< T >:
Inheritance graph
[legend]
Collaboration diagram for IEntityDecorator< T >:
Collaboration graph
[legend]

Public Member Functions

 IEntityDecorator (T *e)
 Constructor for IEntityDecorator. More...
 
virtual ~IEntityDecorator ()
 Destructor.
 
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)
 Updates the entity's position in the physical system. More...
 
virtual SimulationModelgetModel () const
 
- 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.
 
- 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

T * sub = 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

template<std::derived_from< IEntity > T = IEntity>
class IEntityDecorator< T >

Base class decorator for all entities that implements each specific entity in a template, delegates all work to wrapped entity class.

Constructor & Destructor Documentation

◆ IEntityDecorator()

template<std::derived_from< IEntity > T = IEntity>
IEntityDecorator< T >::IEntityDecorator ( T *  e)
inline

Constructor for IEntityDecorator.

Parameters
eThe pointer to the entity object to be wrapped

Member Function Documentation

◆ getColor()

template<std::derived_from< IEntity > T = IEntity>
virtual std::string IEntityDecorator< T >::getColor ( ) const
inlinevirtual

Gets the color of the entity.

Returns
The color of the entity

Reimplemented from IEntity.

Reimplemented in PackageColorDecorator.

◆ getDetails()

template<std::derived_from< IEntity > T = IEntity>
virtual const JsonObject& IEntityDecorator< T >::getDetails ( ) const
inlinevirtual

Gets the details of the entity.

Returns
The details of the entity.

Reimplemented from IEntity.

◆ getDirection()

template<std::derived_from< IEntity > T = IEntity>
virtual Vector3 IEntityDecorator< T >::getDirection ( ) const
inlinevirtual

Gets the direction of the entity.

Returns
The direction of the entity.

Reimplemented from IEntity.

◆ getId()

template<std::derived_from< IEntity > T = IEntity>
virtual int IEntityDecorator< T >::getId ( ) const
inlinevirtual

Gets the ID of the entity.

Returns
The ID of the entity.

Reimplemented from IEntity.

◆ getName()

template<std::derived_from< IEntity > T = IEntity>
virtual std::string IEntityDecorator< T >::getName ( ) const
inlinevirtual

Gets the name of the entity.

Returns
The name of the entity

Reimplemented from IEntity.

◆ getPosition()

template<std::derived_from< IEntity > T = IEntity>
virtual Vector3 IEntityDecorator< T >::getPosition ( ) const
inlinevirtual

Gets the position of the entity.

Returns
The position of the entity.

Reimplemented from IEntity.

◆ getSpeed()

template<std::derived_from< IEntity > T = IEntity>
virtual double IEntityDecorator< T >::getSpeed ( ) const
inlinevirtual

Gets the speed of the entity.

Returns
The speed of the entity.

Reimplemented from IEntity.

◆ linkModel()

template<std::derived_from< IEntity > T = IEntity>
virtual void IEntityDecorator< T >::linkModel ( SimulationModel model)
inlinevirtual

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 from IEntity.

Reimplemented in MultiDeliveryDecorator.

◆ rotate()

template<std::derived_from< IEntity > T = IEntity>
virtual void IEntityDecorator< T >::rotate ( double  angle)
inlinevirtual

Rotate the entity around y axis.

Parameters
angleThe angle to rotate the entity by.

Reimplemented from IEntity.

◆ setColor()

template<std::derived_from< IEntity > T = IEntity>
virtual void IEntityDecorator< T >::setColor ( std::string  col_)
inlinevirtual

Sets the color of the entity.

Parameters
col_The new color of the entity

Reimplemented from IEntity.

◆ setDirection()

template<std::derived_from< IEntity > T = IEntity>
virtual void IEntityDecorator< T >::setDirection ( Vector3  dir_)
inlinevirtual

Set the direction of the entity.

Parameters
dir_The new direction of the entity.

Reimplemented from IEntity.

◆ setPosition()

template<std::derived_from< IEntity > T = IEntity>
virtual void IEntityDecorator< T >::setPosition ( Vector3  pos_)
inlinevirtual

Sets the position of the entity.

Parameters
pos_The desired position of the entity.

Reimplemented from IEntity.

◆ update()

template<std::derived_from< IEntity > T = IEntity>
virtual void IEntityDecorator< T >::update ( double  dt)
inlinevirtual

Updates the entity's position in the physical system.

Parameters
dtThe time step of the update.

Implements IEntity.

Reimplemented in MultiDeliveryDecorator, DroneDecorator, and DroneBatteryDecorator.


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