ctrl k
  • service/include/simulationmodel/IController.h
    ■ ■ ■ ■ ■
    skipped 8 lines
    9 9  /// Abstract controller class used in the Transit Service. Uses the Model View
    10 10  /// Controller Pattern
    11 11  /**
     12 + * @class IController
    12 13   * @brief class for IController used for transit service. Uses the Model View
    13 14   **/
    14 15  class IController {
    skipped 35 lines
  • service/include/simulationmodel/SimulationModel.h
    ■ ■ ■ ■ ■ ■
    skipped 22 lines
    23 23  /// Simulation Model handling the transit simulation. The model can communicate
    24 24  /// with the controller.
    25 25  /**
     26 + * @class SimulationModel
    26 27   * @brief Class SimulationModel handling the transit simulation. it can
    27 28   * communicate with the controller
    28 29   **/
    skipped 1 lines
    30 31   public:
    31 32   /**
    32 33   * @brief Default constructor that create the SimulationModel object
     34 + * @param controller The specified Controller to be initialized in the model
    33 35   **/
    34 36   SimulationModel(IController& controller);
    35 37   
    skipped 48 lines
    84 86   */
    85 87   const routing::Graph* getGraph() const;
    86 88   
     89 + /**
     90 + * @brief Notifies observer with specific message
     91 + * @param message The specific message
     92 + */
    87 93   void notify(const std::string& message) const;
    88 94   
    89 95   std::deque<Package*> scheduledDeliveries;
    skipped 7 lines
    97 103   protected:
    98 104   std::map<int, IEntity*> entities;
    99 105   std::set<int> removed;
     106 + /**
     107 + * @brief Removes the model from the simulation
     108 + * @param id The id of the model to be removed
     109 + */
    100 110   void removeFromSim(int id);
    101 111   const routing::Graph* graph = nullptr;
    102 112   CompositeFactory entityFactory;
    skipped 4 lines
  • service/include/simulationmodel/WebServer.h
    ■ ■ ■ ■ ■ ■
    skipped 11 lines
    12 12  #include "libwebsockets.h"
    13 13  #include "libwebsockets/lws-service.h"
    14 14   
     15 +/**
     16 + * @class WebServerBase
     17 + * @brief Base class for web server implementation
     18 +*/
    15 19  class WebServerBase {
    16 20   public:
     21 + /**
     22 + * @brief Constructor for WebServerBase
     23 + * @param port The port on which the server will listen
     24 + * @param webDir The directory from which to serve web content
     25 + */
    17 26   WebServerBase(int port = 8081, const std::string& webDir = ".");
     27 + 
     28 + /**
     29 + * @brief Destructor
     30 + */
    18 31   virtual ~WebServerBase();
    19 32   
     33 + /**
     34 + * @class Session
     35 + * @brief Represents a session with a client
     36 + */
    20 37   class Session {
    21 38   friend class WebServerBase;
    22 39   
    23 40   public:
     41 + /**
     42 + * @brief Constructor for Session
     43 + */
    24 44   Session();
     45 + 
     46 + /**
     47 + * @brief Destructor
     48 + */
    25 49   virtual ~Session();
     50 + 
     51 + /**
     52 + * @brief Returns the ID of the session
     53 + */
    26 54   virtual int getId() const { return id; }
     55 + 
     56 + /**
     57 + * @brief Receives a message from the client
     58 + * @param msg The message received from the client
     59 + */
    27 60   virtual void receiveMessage(const std::string& msg) {}
     61 + 
     62 + /**
     63 + * @brief Sends a message to the client
     64 + * @param msg The message to send to the client
     65 + */
    28 66   virtual void sendMessage(const std::string& msg);
     67 + 
     68 + /**
     69 + * @brief Performs any necessary updates for the session
     70 + */
    29 71   virtual void update() {}
     72 + 
     73 + /**
     74 + * @brief Function called when the session is ready to write
     75 + */
    30 76   virtual void onWrite();
    31 77   
    32 78   private:
    skipped 1 lines
    34 80   int id;
    35 81   };
    36 82   
     83 + /**
     84 + * @brief Services the server, processing incoming requests
     85 + * @param time Time for which to service the server
     86 + */
    37 87   void service(int time = 10);
    38 88   
     89 + /**
     90 + * @brief Creates a session for a new client connection
     91 + * @param info Pointer to information about the session
     92 + */
    39 93   virtual void createSession(void* info);
    40 94   
    41 95   protected:
     96 + /**
     97 + * @brief Factory method to create a new session
     98 + */
    42 99   virtual Session* createSession() { return new Session(); }
    43 100   
    44 101   public:
    skipped 3 lines
    48 105   std::string webDir;
    49 106  };
    50 107   
     108 +/**
     109 + * @class WebServer
     110 + * @brief Templated class for a basic web server that inherits from WebServerBase
     111 + */
    51 112  template <typename T>
    52 113  class WebServer : public WebServerBase {
    53 114   public:
     115 + /**
     116 + * @brief Constructor for WebServer that calls WebServerBase's constructor
     117 + * @param port The port on which the server will listen
     118 + * @param webDir The directory from which to serve web content
     119 + */
    54 120   WebServer(int port = 8081, const std::string& webDir = ".")
    55 121   : WebServerBase(port, webDir) {}
    56 122   
    57 123   protected:
     124 + /**
     125 + * @brief Factory method to create a new session of type T
     126 + */
    58 127   Session* createSession() { return new T(); }
    59 128  };
    60 129   
     130 +/**
     131 + * @class WebServerWithState
     132 + * @brief Templated class for a web server with state that inherits from WebServerBase
     133 + */
    61 134  template <typename T, typename STATE>
    62 135  class WebServerWithState : public WebServerBase {
    63 136   public:
     137 + /**
     138 + * @brief Constructor for WebServerWithState that calls WebServerBase's constructor
     139 + * @param state The initial state of the server
     140 + * @param port The port on which the server will listen
     141 + * @param webDir The directory from which to serve web content
     142 + */
    64 143   WebServerWithState(STATE state, int port = 8081,
    65 144   const std::string& webDir = ".")
    66 145   : WebServerBase(port, webDir), state(state) {}
    67 146   
    68 147   protected:
     148 + /**
     149 + * @brief Factory method to create a new session of type T with the given state
     150 + */
    69 151   Session* createSession() { return new T(state); }
    70 152   
    71 153   private:
    skipped 3 lines
    75 157  // JSON support
    76 158  #include "picojson.h"
    77 159   
     160 +/**
     161 + * @class JSONSession
     162 + * @brief Abstract class for a session supporting JSON communication
     163 + */
    78 164  class JSONSession : public WebServerBase::Session {
    79 165   public:
     166 + /**
     167 + * @brief Receives a JSON message from the client
     168 + * @param val The JSON value received from the client
     169 + */
    80 170   virtual void receiveJSON(picojson::value& val) {}
    81 171   
     172 + /**
     173 + * @brief Sends a JSON message to the client
     174 + * @param val The JSON value to send to the client
     175 + */
    82 176   virtual void sendJSON(picojson::value& val) { sendMessage(val.serialize()); }
    83 177   
     178 + /**
     179 + * @brief Receives a message from the client and parses it as JSON
     180 + * @param msg The message received from the client
     181 + */
    84 182   void receiveMessage(const std::string& msg) {
    85 183   static std::string buf = "";
    86 184   picojson::value val;
    skipped 14 lines
    101 199   
    102 200  #include "util/json.h"
    103 201   
     202 +/**
     203 + * @class JsonSession
     204 + * @brief Abstract class for a session supporting JSON communication with command handling, inherits from JSONSession
     205 + */
    104 206  class JsonSession : public JSONSession {
    105 207   public:
    106 208   /**
    skipped 29 lines
  • service/include/simulationmodel/entity/Drone.h
    ■ ■ ■ ■ ■ ■
    skipped 10 lines
    11 11   
    12 12  class Package;
    13 13   
    14  -// Represents a drone in a physical system.
    15  -// Drones move using euler integration based on a specified
    16  -// velocity and direction.
    17 14  /**
    18 15   * @class Drone
    19 16   * @brief Represents a drone in a physical system. Drones move using euler
    skipped 70 lines
  • service/include/simulationmodel/entity/Helicopter.h
    ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  #include "IEntity.h"
    5 5  #include "IStrategy.h"
    6 6   
     7 +/**
     8 + * @class Helicopter
     9 + * @brief Represents a helicopter in a physical system. Helicopters move using euler
     10 + * integration based on a specified velocity and direction.
     11 + */
    7 12  class Helicopter : public IEntity {
    8 13   public:
    9 14   /**
    10  - * @brief Helicopter are created with a name
    11  - * @param obj JSON object containing the drone's information
     15 + * @brief Helicopters are created with a name
     16 + * @param obj JSON object containing the helicopter's information
    12 17   */
    13 18   Helicopter(const JsonObject& obj);
    14 19   
     20 + /**
     21 + * @brief Destructor
     22 + */
    15 23   ~Helicopter();
    16 24   
     25 + /**
     26 + * @brief Updates the helicopter's position
     27 + * @param dt Delta time
     28 + */
    17 29   void update(double dt);
    18 30   
    19 31   private:
    skipped 8 lines
  • service/include/simulationmodel/entity/Human.h
    ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  #include "IEntity.h"
    5 5  #include "IStrategy.h"
    6 6   
     7 +/**
     8 + * @class Human
     9 + * @brief Represents a human in a physical system. Humans move using euler
     10 + * integration based on a specified velocity and direction.
     11 + */
    7 12  class Human : public IEntity {
    8 13   public:
    9 14   /**
    10  - * @brief Drones are created with a name
    11  - * @param obj JSON object containing the drone's information
     15 + * @brief Humans are created with a name
     16 + * @param obj JSON object containing the human's information
    12 17   */
    13 18   Human(const JsonObject& obj);
    14 19   
     20 + /**
     21 + * @brief Destructor
     22 + */
    15 23   ~Human();
    16 24   
     25 + /**
     26 + * @brief Updates the human's position
     27 + * @param dt Delta time
     28 + */
    17 29   void update(double dt);
    18 30   
    19 31   private:
    skipped 7 lines
  • service/include/simulationmodel/entity/IEntity.h
    ■ ■ ■ ■ ■
    skipped 27 lines
    28 28   
    29 29   /**
    30 30   * @brief Constructor with JsonObject details to define the entity
     31 + * @param details The JsonObject to define the entity
    31 32   */
    32 33   IEntity(const JsonObject& details);
    33 34   
    skipped 4 lines
    38 39   
    39 40   /**
    40 41   * @brief Links this entity to a simulation model,
    41  - * giving it access to the model's public variables
    42  - * and functions.
     42 + * giving it access to the model's public variables
     43 + * and functions.
    43 44   * @param[in] model The simulation model to link.
    44 45   */
    45 46   virtual void linkModel(SimulationModel* model);
    skipped 86 lines
  • service/include/simulationmodel/entity/decorator/BlueDecorator.h
    ■ ■ ■ ■ ■ ■
    skipped 2 lines
    3 3  
    4 4  #include "PackageColorDecorator.h"
    5 5  
     6 +/**
     7 + * @class BlueDecorator
     8 + * @brief Allows for the package to be colored blue
     9 +*/
    6 10  class BlueDecorator : public PackageColorDecorator {
    7 11   public:
     12 + /**
     13 + * @brief Constructor for BlueDecorator
     14 + * @param Package* Pointer to package to be colored blue
     15 + */
    8 16   BlueDecorator(Package*);
    9 17  };
    10 18  
    skipped 2 lines
  • service/include/simulationmodel/entity/decorator/DroneDecorator.h
    ■ ■ ■ ■ ■ ■
    skipped 4 lines
    5 5  #include "IEntityDecorator.h"
    6 6  #include "PathStrategy.h"
    7 7   
     8 +/**
     9 + * @class DroneDecorator
     10 + * @brief Base class decorator for Drone that implements IEntityDecorator Drone template,
     11 + * delegates all work to wrapped Drone class
     12 +*/
    8 13  class DroneDecorator : public IEntityDecorator<Drone> {
    9 14   public:
     15 + /**
     16 + * @brief Constructor for DroneDecorator, calls IEntityDecorator constructor
     17 + * @param d The pointer to the drone object to be wrapped
     18 + */
    10 19   DroneDecorator(Drone* d) : IEntityDecorator(d) {}
     20 + 
     21 + /**
     22 + * @brief Destructor
     23 + */
    11 24   virtual ~DroneDecorator() {}
     25 + 
     26 + /**
     27 + * @brief Gets the next delivery in the scheduler
     28 + */
     29 + virtual void getNextDelivery() const { return sub->getNextDelivery(); }
     30 + 
     31 + /**
     32 + * @brief Gets the pickedUp status of the Drone object
     33 + */
    12 34   virtual bool getPickedUp() const { return sub->getPickedUp(); }
     35 + 
     36 + /**
     37 + * @brief Gets pointer to the Drone's package
     38 + */
     39 + virtual Package* getPackage() const { return sub->getPackage(); }
     40 + 
     41 + /**
     42 + * @brief Returns pointer to toFinalDestination
     43 + */
     44 + virtual IStrategy* getFinalStrategy() const { return sub->getFinalStrategy(); }
     45 + 
     46 + /**
     47 + * @brief Sets the Drone's toPackage strategy to a new one
     48 + * @param s New strategy for drone to get to package
     49 + */
     50 + virtual void setToPackage(IStrategy* s) const { return sub->setToPackage(s); }
    13 51  };
    14 52   
    15 53  #endif
    skipped 1 lines
  • service/include/simulationmodel/entity/decorator/GreenDecorator.h
    ■ ■ ■ ■ ■ ■
    skipped 2 lines
    3 3  
    4 4  #include "PackageColorDecorator.h"
    5 5  
     6 +/**
     7 + * @class GreenDecorator
     8 + * @brief Allows for the package to be colored green
     9 +*/
    6 10  class GreenDecorator : public PackageColorDecorator {
    7 11   public:
     12 + /**
     13 + * @brief Constructor for GreenDecorator
     14 + * @param Package* Pointer to package to be colored green
     15 + */
    8 16   GreenDecorator(Package*);
    9 17  };
    10 18  
    skipped 2 lines
  • service/include/simulationmodel/entity/decorator/IEntityDecorator.h
    ■ ■ ■ ■ ■ ■
    skipped 5 lines
    6 6  #include "IEntity.h"
    7 7  
    8 8  template <std::derived_from<IEntity> T = IEntity>
     9 +
     10 +/**
     11 + * @class IEntityDecorator
     12 + * @brief Base class decorator for all entities that implements each specific entity in a template,
     13 + * delegates all work to wrapped entity class
     14 +*/
    9 15  class IEntityDecorator : public T {
    10 16   public:
     17 + /**
     18 + * @brief Constructor for IEntityDecorator
     19 + * @param e The pointer to the entity object to be wrapped
     20 + */
    11 21   IEntityDecorator(T* e) : T(e->getDetails()), sub(e) {}
     22 +
     23 + /**
     24 + * @brief Destructor
     25 + */
    12 26   virtual ~IEntityDecorator() {
    13 27   if (sub) delete sub;
    14 28   }
     29 +
     30 + /**
     31 + * @brief Links this entity to a simulation model,
     32 + * giving it access to the model's public variables
     33 + * and functions.
     34 + * @param[in] model The simulation model to link.
     35 + */
    15 36   virtual void linkModel(SimulationModel* model) {
    16 37   return sub->linkModel(model);
    17 38   }
     39 +
     40 + /**
     41 + * @brief Gets the ID of the entity.
     42 + * @return The ID of the entity.
     43 + */
    18 44   virtual int getId() const { return sub->getId(); }
     45 +
     46 + /**
     47 + * @brief Gets the position of the entity.
     48 + * @return The position of the entity.
     49 + */
    19 50   virtual Vector3 getPosition() const { return sub->getPosition(); }
     51 +
     52 + /**
     53 + * @brief Gets the direction of the entity.
     54 + * @return The direction of the entity.
     55 + */
    20 56   virtual Vector3 getDirection() const { return sub->getDirection(); }
     57 +
     58 + /**
     59 + * @brief Gets the details of the entity.
     60 + * @return The details of the entity.
     61 + */
    21 62   virtual const JsonObject& getDetails() const { return sub->getDetails(); }
     63 +
     64 + /**
     65 + * @brief Gets the color of the entity
     66 + * @return The color of the entity
     67 + */
    22 68   virtual std::string getColor() const { return sub->getColor(); }
     69 +
     70 + /**
     71 + * @brief Gets the name of the entity
     72 + * @return The name of the entity
     73 + */
    23 74   virtual std::string getName() const { return sub->getName(); }
     75 +
     76 + /**
     77 + * @brief Gets the speed of the entity.
     78 + * @return The speed of the entity.
     79 + */
    24 80   virtual double getSpeed() const { return sub->getSpeed(); }
     81 +
     82 + /**
     83 + * @brief Sets the position of the entity.
     84 + * @param pos_ The desired position of the entity.
     85 + */
    25 86   virtual void setPosition(Vector3 pos_) { return sub->setPosition(pos_); }
     87 +
     88 + /**
     89 + *@brief Set the direction of the entity.
     90 + *@param dir_ The new direction of the entity.
     91 + */
    26 92   virtual void setDirection(Vector3 dir_) { return sub->setDirection(dir_); }
     93 +
     94 + /**
     95 + * @brief Sets the color of the entity
     96 + * @param col_ The new color of the entity
     97 + */
    27 98   virtual void setColor(std::string col_) { return sub->setColor(col_); }
     99 +
     100 + /**
     101 + * @brief Rotate the entity around y axis.
     102 + * @param angle The angle to rotate the entity by.
     103 + */
    28 104   virtual void rotate(double angle) { return sub->rotate(angle); }
     105 +
     106 + /**
     107 + * @brief Updates the entity's position in the physical system.
     108 + * @param dt The time step of the update.
     109 + */
    29 110   virtual void update(double dt) { return sub->update(dt); }
    30 111  
    31 112   protected:
    skipped 5 lines
  • service/include/simulationmodel/entity/decorator/MultiDeliveryDecorator.h
    ■ ■ ■ ■ ■
    skipped 8 lines
    9 9  #include "SimulationModel.h"
    10 10   
    11 11  /**
    12  - * @brief Decorator allowing for drones to make multiple deliveries
     12 + * @class MultiDeliveryDecorator
     13 + * @brief Decorator allowing for drones to make multiple deliveries, inherits from IObserver and DroneDecorator
    13 14   **/
    14 15  class MultiDeliveryDecorator : public DroneDecorator, public IObserver {
    15 16   public:
    skipped 32 lines
    48 49   */
    49 50   void storeAdditional();
    50 51   
     52 + /**
     53 + * @brief Notifies observer with specific message
     54 + * @param message The specific message
     55 + */
    51 56   void notify(const std::string& message) const;
    52 57   
    53 58   // Position of the last POI visited by the drone
    skipped 18 lines
  • service/include/simulationmodel/entity/decorator/PackageColorDecorator.h
    ■ ■ ■ ■ ■ ■
    skipped 2 lines
    3 3   
    4 4  #include "PackageDecorator.h"
    5 5   
     6 +/**
     7 + * @class PackageColorDecorator
     8 + * @brief Decorator allowing for packages to become colored in different combinations of colors, inherits from PackageDecorator
     9 +*/
    6 10  class PackageColorDecorator : public PackageDecorator {
    7 11   private:
    8 12   double hue = 0;
    skipped 1 lines
    10 14   double light = 0;
    11 15   
    12 16   public:
     17 + /**
     18 + * @brief Constructor for PackageColorDecorator, calls PackageDecorator constructor
     19 + * @param Package* Pointer to package to be colored with a specific color
     20 + * @param double Hue value
     21 + * @param double Saturation value
     22 + * @param double Light value
     23 + */
    13 24   PackageColorDecorator(Package*, double = 0, double = 0, double = 0);
     25 + /**
     26 + * @brief Gets the package's color
     27 + */
    14 28   std::string getColor() const;
    15 29  };
    16 30   
    skipped 2 lines
  • service/include/simulationmodel/entity/decorator/PackageDecorator.h
    ■ ■ ■ ■ ■ ■
    skipped 4 lines
    5 5  #include "Package.h"
    6 6  #include "Robot.h"
    7 7  
     8 +/**
     9 + * @class PackageDecorator
     10 + * @brief Base class decorator for Package that implements IEntityDecorator Package template,
     11 + * delegates all work to wrapped Package class
     12 +*/
    8 13  class PackageDecorator : public IEntityDecorator<Package> {
    9 14   public:
     15 + /**
     16 + * @brief Constructor for PackageDecorator, calls IEntityDecorator constructor
     17 + * @param p The pointer to the package object to be wrapped
     18 + */
    10 19   PackageDecorator(Package* p) : IEntityDecorator(p) {}
     20 +
     21 + /**
     22 + * @brief Gets the Package's destination
     23 + * @return The Package's destination
     24 + */
    11 25   virtual Vector3 getDestination() const { return sub->getDestination(); }
     26 +
     27 + /**
     28 + * @brief Returns the name of the strategy for this package
     29 + *
     30 + * @returns String name of strategy
     31 + */
    12 32   virtual std::string getStrategyName() const { return sub->getStrategyName(); }
     33 +
     34 + /**
     35 + * @brief Returns the owner of the package
     36 + *
     37 + * @return pointer to Robot owning the package
     38 + */
    13 39   virtual Robot* getOwner() const { return sub->getOwner(); }
     40 +
     41 + /**
     42 + * @brief Returns whether or not the package needs to be delivered
     43 + *
     44 + * @return boolean value of the above statement
     45 + */
    14 46   virtual bool requiresDelivery() const { return sub->requiresDelivery(); }
     47 +
     48 + /**
     49 + * @brief Set the Strategy Name
     50 + *
     51 + * @param strategyName_ Strategy name
     52 + */
    15 53   virtual void setStrategyName(std::string strategyName_) {
    16 54   return sub->setStrategyName(strategyName_);
    17 55   }
     56 +
     57 + /**
     58 + * @brief Sets the attributes for delivery
     59 + *
     60 + * @param owner Robot for the package to be delivered to
     61 + */
    18 62   virtual void initDelivery(Robot* owner) { return sub->initDelivery(owner); }
     63 +
     64 + /**
     65 + * @brief Gives the robot/owner this package
     66 + */
    19 67   virtual void handOff() {
    20 68   if (getOwner()) getOwner()->receive(this);
    21 69   }
    skipped 4 lines
  • service/include/simulationmodel/entity/decorator/RedDecorator.h
    ■ ■ ■ ■ ■ ■
    skipped 2 lines
    3 3  
    4 4  #include "PackageColorDecorator.h"
    5 5  
     6 +/**
     7 + * @class RedDecorator
     8 + * @brief Allows for the package to be colored red
     9 +*/
    6 10  class RedDecorator : public PackageColorDecorator {
    7 11   public:
     12 + /**
     13 + * @brief Constructor for RedDecorator
     14 + * @param Package* Pointer to package to be colored red
     15 + */
    8 16   RedDecorator(Package*);
    9 17  };
    10 18  
    skipped 2 lines
  • service/include/simulationmodel/factory/CompositeFactory.h
    ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  #include "IEntityFactory.h"
    5 5   
    6 6  /**
    7  - *@brief Factory method for composite class. Inherits from IEntityFactory.
     7 + * @class CompositeFactory
     8 + * @brief Factory method for composite class. Inherits from IEntityFactory.
    8 9   **/
    9 10  class CompositeFactory : public IEntityFactory {
    10 11   public:
    skipped 25 lines
  • service/include/simulationmodel/factory/DroneFactory.h
    ■ ■ ■ ■ ■
    skipped 6 lines
    7 7  #include "IEntityFactory.h"
    8 8   
    9 9  /**
    10  - *@brief Drone Factory to produce Drones class.
     10 + * @class DroneFactory
     11 + * @brief Drone Factory to produce Drone class.
    11 12   **/
    12 13  class DroneFactory : public IEntityFactory {
    13 14   public:
    skipped 16 lines
  • service/include/simulationmodel/factory/HelicopterFactory.h
    ■ ■ ■ ■ ■
    skipped 6 lines
    7 7  #include "IEntityFactory.h"
    8 8   
    9 9  /**
    10  - *@brief Helicopter Factory to produce Helicopter class.
     10 + * @class HelicopterFactory
     11 + * @brief Helicopter Factory to produce Helicopter class.
    11 12   **/
    12 13  class HelicopterFactory : public IEntityFactory {
    13 14   public:
    skipped 16 lines
  • service/include/simulationmodel/factory/HumanFactory.h
    ■ ■ ■ ■ ■
    skipped 6 lines
    7 7  #include "IEntityFactory.h"
    8 8   
    9 9  /**
    10  - *@brief Human Factory to produce Human class.
     10 + * @class HumanFactory
     11 + * @brief Human Factory to produce Human class.
    11 12   **/
    12 13  class HumanFactory : public IEntityFactory {
    13 14   public:
    skipped 16 lines
  • service/include/simulationmodel/factory/IEntityFactory.h
    ■ ■ ■ ■ ■
    skipped 4 lines
    5 5  #include "util/json.h"
    6 6   
    7 7  /**
    8  - *@brief Composite Factory Interface
     8 + * @class IEntityFactory
     9 + * @brief Composite Factory Interface
    9 10   **/
    10 11  class IEntityFactory {
    11 12   public:
    skipped 16 lines
  • service/include/simulationmodel/factory/POIFactory.h
    ■ ■ ■ ■ ■
    skipped 6 lines
    7 7  #include "IEntityFactory.h"
    8 8   
    9 9  /**
    10  - *@brief POI Factory to produce POI class.
     10 + * @class POIFactory
     11 + * @brief POI Factory to produce POI class.
    11 12   **/
    12 13  class POIFactory : public IEntityFactory {
    13 14   public:
    skipped 16 lines
  • service/include/simulationmodel/factory/PackageFactory.h
    ■ ■ ■ ■ ■
    skipped 6 lines
    7 7  #include "Package.h"
    8 8  
    9 9  /**
    10  - *@brief Package Factory to produce Package class.
     10 + * @class PackageFactory
     11 + * @brief Package Factory to produce Package class.
    11 12   **/
    12 13  class PackageFactory : public IEntityFactory {
    13 14   public:
    skipped 16 lines
  • service/include/simulationmodel/factory/RobotFactory.h
    ■ ■ ■ ■ ■
    skipped 6 lines
    7 7  #include "Robot.h"
    8 8   
    9 9  /**
    10  - *@brief Drone Factory to produce Drones class.
     10 + * @class RobotFactory
     11 + * @brief Robot Factory to produce Robot class.
    11 12   **/
    12 13  class RobotFactory : public IEntityFactory {
    13 14   public:
    skipped 16 lines
  • service/include/simulationmodel/math/vector3.h
    ■ ■ ■ ■ ■ ■
    skipped 4 lines
    5 5  #include <iostream>
    6 6  #include <vector>
    7 7   
    8  -// a simple class used for vector math, most function are self explanatory
     8 +/**
     9 + * @class Vector3
     10 + * @brief a simple class used for vector math, most function are self explanatory
     11 +*/
    9 12  class Vector3 {
    10 13   public:
    11 14   double x = 0;
    12 15   double y = 0;
    13 16   double z = 0;
     17 + 
    14 18   /**
    15 19   * @brief Default constructor.
    16 20   */
    17 21   Vector3();
     22 + 
     23 + /**
     24 + * @brief Parameter constructor
     25 + *
     26 + * @param[in] a x, y, and z-coordinate
     27 + */
    18 28   Vector3(double a);
     29 + 
    19 30   /**
    20 31   * @brief Parameter constructor.
    21 32   *
    skipped 2 lines
    24 35   * @param[in] c z-coordinate
    25 36   */
    26 37   Vector3(double a, double b, double c);
     38 + 
     39 + /**
     40 + * @brief Parameter constructor
     41 + *
     42 + * @param[in] v The vector containing double-value xyz coordinates
     43 + */
    27 44   Vector3(const std::vector<double>& v);
     45 + 
     46 + /**
     47 + * @brief Parameter constructor
     48 + *
     49 + * @param[in] v The vector containing float-value xyz coordinates
     50 + */
    28 51   Vector3(const std::vector<float>& v);
     52 + 
     53 + /**
     54 + * @brief Overrides comparison operator
     55 + *
     56 + * @param v The Vector3 object you would like to compare to this Vector3
     57 + */
    29 58   bool operator==(const Vector3& v) const;
     59 + 
     60 + /**
     61 + * @brief Overrides indexing operator
     62 + *
     63 + * @param i The index you want to return
     64 + */
    30 65   double& operator[](int i);
     66 + 
     67 + /**
     68 + * @brief Overrides const indexing operator
     69 + *
     70 + * @param i The index you want to return
     71 + */
    31 72   double operator[](int i) const;
     73 +
    32 74   /**
    33 75   * @brief Overrides + operator.
    34 76   * @param[in] v The Vector3 object you would like to add to this Vector3
    skipped 1 lines
    36 78   * @return The Vector3 Object comprised of the sum of the two objects
    37 79   */
    38 80   Vector3 operator+(const Vector3& v) const;
     81 + 
    39 82   /**
    40 83   * @brief Overrides - operator.
    41 84   * @param[in] v The Vector3 object you would like to subtract to this Vector3
    skipped 1 lines
    43 86   * @return The Vector3 Object comprised of the subtraction of the two objects
    44 87   */
    45 88   Vector3 operator-(const Vector3& v) const;
     89 + 
    46 90   /**
    47 91   * @brief Overrides * operator.
    48 92   * @param[in] v The Vector3 object you would like to multiply to this Vector3
    skipped 2 lines
    51 95   * objects
    52 96   */
    53 97   Vector3 operator*(double s) const;
     98 + 
    54 99   /**
    55 100   * @brief Overrides / operator.
    56 101   * @param[in] v The Vector3 object you would like to divide to this Vector3
    skipped 1 lines
    58 103   * @return The Vector3 Object comprised of the division of the two objects
    59 104   */
    60 105   Vector3 operator/(double s) const;
    61  - double operator*(const Vector3& v) const; // dot product
    62  - // return std::vector version of this Vector3
    63  - // template function should be defined in same file
    64  - // with template keyword
     106 + 
     107 + /**
     108 + * @brief Dot product
     109 + * @param[in] The Vector3 object you would like to use to dot product with this Vector3
     110 + * @return The Vector3 object comprised of the dot product of the two objects
     111 + */
     112 + double operator*(const Vector3& v) const;
     113 + 
     114 + /**
     115 + * @brief return std::vector version of this Vector3
     116 + * template function should be defined in same file
     117 + * with template keyword
     118 + */
    65 119   template <class T>
    66 120   std::vector<T> vec() const {
    67 121   return {static_cast<T>(x), static_cast<T>(y), static_cast<T>(z)};
    68 122   }
     123 + 
     124 + /**
     125 + * @brief Cross product
     126 + * @param[in] The Vector3 object you would like to use to cross product with this Vector3
     127 + * @return The Vector3 object comprised of the cross product of the two objects
     128 + */
    69 129   Vector3 cross(const Vector3& v) const;
     130 + 
     131 + /**
     132 + * @brief Returns the magnitude of the Vector3 object
     133 + */
    70 134   double magnitude() const;
     135 + 
     136 + /**
     137 + * @brief Normalizes the Vector3 object
     138 + */
    71 139   Vector3& normalize();
    72  - Vector3 unit() const; // normal vector in same direction
     140 + 
     141 + /**
     142 + * @brief Normalizes the vector in the same direction
     143 + */
     144 + Vector3 unit() const;
     145 + 
     146 + /**
     147 + * @brief Finds the distance between two vectors
     148 + * @param[in] v The Vector3 object you would like to find the distance between with this Vector3
     149 + */
    73 150   double dist(const Vector3& v) const;
     151 + 
     152 + /**
     153 + * @brief << operator for Vector3 objects
     154 + * @param[in] strm The given output stream
     155 + * @param[in] v The given Vector3 object to output
     156 + */
    74 157   friend std::ostream& operator<<(std::ostream& strm, const Vector3& v);
    75 158  };
    76 159   
    skipped 2 lines
  • service/include/simulationmodel/observer/IObserver.h
    ■ ■ ■ ■ ■ ■
    skipped 2 lines
    3 3   
    4 4  #include <string>
    5 5   
     6 +/**
     7 + * @class IObserver
     8 + * @brief Interface for Observer
     9 +*/
    6 10  class IObserver {
    7 11   public:
     12 + /**
     13 + * @brief Notifies observer with specific message
     14 + * @param message The specific message
     15 + */
    8 16   virtual void notify(const std::string &message) const = 0;
    9 17  };
    10 18   
    skipped 2 lines
  • service/include/simulationmodel/observer/IPublisher.h
    ■ ■ ■ ■ ■ ■
    skipped 5 lines
    6 6   
    7 7  #include "IObserver.h"
    8 8   
     9 +/**
     10 + * @class IPublisher
     11 + * @brief Interface for Publisher
     12 +*/
    9 13  class IPublisher {
    10 14   public:
     15 + /**
     16 + * @brief adds an observer to the simulation
     17 + * @param o The pointer to the specific observer
     18 + */
    11 19   void addObserver(const IObserver* o);
     20 + 
     21 + /**
     22 + * @brief removes an observer in the simulation
     23 + * @param o The pointer to the specific observer
     24 + */
    12 25   void removeObserver(const IObserver* o);
     26 + 
     27 + /**
     28 + * @brief notifies all observers with a specific message
     29 + * @param message The specific message
     30 + */
    13 31   void notifyObservers(const std::string& message) const;
    14 32   
    15 33   private:
    skipped 5 lines
  • service/include/simulationmodel/strategy/AstarStrategy.h
    ■ ■ ■ ■ ■
    skipped 4 lines
    5 5  #include "Graph.h"
    6 6   
    7 7  /**
     8 + * @class AstarStrategy
    8 9   * @brief this class inhertis from the PathStrategy class and is responsible for
    9 10   * generating the astar path that the drone will take.
    10 11   */
    skipped 14 lines
  • service/include/simulationmodel/strategy/BeelineStrategy.h
    ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  #include "PathStrategy.h"
    5 5   
    6 6  /**
    7  - * @brief this class inherits from the IStrategy class and is responsible for
     7 + * @class BeelineStrategy
     8 + * @brief this class inherits from the PathStrategy class and is responsible for
    8 9   * generating the beeline that the drone will take.
    9 10   */
    10 11  class BeelineStrategy : public PathStrategy {
    skipped 12 lines
  • service/include/simulationmodel/strategy/BfsStrategy.h
    ■ ■ ■ ■ ■
    skipped 4 lines
    5 5  #include "Graph.h"
    6 6  
    7 7  /**
     8 + * @class BfsStrategy
    8 9   * @brief this class inhertis from the PathStrategy class and is responsible for
    9  - * generating the depth first search path that the drone will take.
     10 + * generating the breadth first search path that the drone will take.
    10 11   */
    11 12  class BfsStrategy : public PathStrategy {
    12 13   public:
    13 14   /**
    14  - * @brief Construct a new Astar Strategy object
     15 + * @brief Construct a new Bfs Strategy object
    15 16   *
    16 17   * @param position Current position
    17 18   * @param destination End destination
    skipped 7 lines
  • service/include/simulationmodel/strategy/DfsStrategy.h
    ■ ■ ■ ■ ■
    skipped 4 lines
    5 5  #include "Graph.h"
    6 6   
    7 7  /**
     8 + * @class DfsStrategy
    8 9   * @brief this class inhertis from the PathStrategy class and is responsible for
    9 10   * generating the depth first search path that the drone will take.
    10 11   */
    11 12  class DfsStrategy : public PathStrategy {
    12 13   public:
    13 14   /**
    14  - * @brief Construct a new Astar Strategy object
     15 + * @brief Construct a new Dfs Strategy object
    15 16   *
    16 17   * @param position Current position
    17 18   * @param destination End destination
    skipped 7 lines
  • service/include/simulationmodel/strategy/DijkstraStrategy.h
    ■ ■ ■ ■ ■
    skipped 4 lines
    5 5  #include "Graph.h"
    6 6   
    7 7  /**
     8 + * @class DijkstraStrategy
    8 9   * @brief this class inhertis from the PathStrategy class and is responsible for
    9 10   * generating the dijkstra path that the drone will take.
    10 11   */
    11 12  class DijkstraStrategy : public PathStrategy {
    12 13   public:
    13 14   /**
    14  - * @brief Construct a new Astar Strategy object
     15 + * @brief Construct a new Dijkstra Strategy object
    15 16   *
    16 17   * @param position Current position
    17 18   * @param destination End destination
    skipped 7 lines
  • service/include/simulationmodel/strategy/IStrategy.h
    ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  #include "IEntity.h"
    5 5   
    6 6  /**
     7 + * @class IStrategy
    7 8   * @brief Strategy interface
    8 9   *
    9 10   */
    10 11  class IStrategy {
    11 12   public:
     13 + /**
     14 + * @brief Destructor
     15 + */
    12 16   virtual ~IStrategy() {}
     17 +
    13 18   /**
    14 19   * @brief Move toward next position
    15 20   *
    skipped 15 lines
  • service/include/simulationmodel/strategy/PathStrategy.h
    ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  #include "IStrategy.h"
    5 5   
    6 6  /**
     7 + * @class PathStrategy
    7 8   * @brief this class inhertis from the IStrategy class and is represents
    8 9   * a movement strategy where the entity simply moves along the given path
    9 10   */
    skipped 32 lines
  • service/include/simulationmodel/strategy/decorator/ICelebrationDecorator.h
    ■ ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  #include "IStrategy.h"
    5 5   
    6 6  /**
     7 + * @class ICelebrationDecorator
    7 8   * @brief this class inhertis from the IStrategy class and is represents
    8 9   * a celebration decorator where the entity will celebrate according to it.
    9 10   */
    skipped 31 lines
    41 42   */
    42 43   virtual bool isCompleted();
    43 44   
     45 + /**
     46 + * @brief Make the entity celebrate.
     47 + *
     48 + * @param entity Entity to celebrate
     49 + * @param dt Delta Time
     50 + */
    44 51   virtual void celebrate(IEntity* entity, double dt) = 0;
    45 52  };
    46 53   
    skipped 2 lines
  • service/include/simulationmodel/strategy/decorator/JumpDecorator.h
    ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  #include "ICelebrationDecorator.h"
    5 5   
    6 6  /**
     7 + * @class JumpDecorator
    7 8   * @brief this class inhertis from the IStrategy class and is represents
    8 9   * a celebration decorator where the entity will celebrate according to it.
    9 10   */
    skipped 27 lines
  • service/include/simulationmodel/strategy/decorator/SpinDecorator.h
    ■ ■ ■ ■ ■
    skipped 3 lines
    4 4  #include "ICelebrationDecorator.h"
    5 5   
    6 6  /**
     7 + * @class SpinDecorator
    7 8   * @brief this class inhertis from the IStrategy class and is represents
    8 9   * a celebration decorator where the entity will celebrate according to it.
    9 10   */
    skipped 25 lines
Page is in error, reload to recover