ctrl k
  • service/include/simulationmodel/entity/RechargeStation.h
    ■ ■ ■ ■ ■ ■
     1 +#pragma once
     2 + 
     3 +#include "IEntity.h"
     4 + 
     5 +class RechargeStation : public IEntity {
     6 + public:
     7 + RechargeStation(const JsonObject& obj);
     8 + ~RechargeStation();
     9 + RechargeStation(const RechargeStation& rechargeStation) = delete;
     10 + RechargeStation& operator=(const RechargeStation& rechargeStation) = delete;
     11 + void chargeDrone(IEntity* entity);
     12 + void update(double dt);
     13 +};
     14 + 
  • service/include/simulationmodel/factory/RechargeStationFactory.h
    ■ ■ ■ ■ ■ ■
     1 +#pragma once
     2 + 
     3 +#include "IEntityFactory.h"
     4 +#include "RechargeStation.h"
     5 + 
     6 +class RechargeStationFactory : public IEntityFactory {
     7 + public:
     8 + virtual ~RechargeStationFactory() {}
     9 + IEntity* createEntity(const JsonObject& obj);
     10 +};
     11 + 
  • service/src/simulationmodel/SimulationModel.cc
    ■ ■ ■ ■ ■ ■
    skipped 4 lines
    5 5  #include "HumanFactory.h"
    6 6  #include "PackageFactory.h"
    7 7  #include "RobotFactory.h"
     8 +#include "RechargeStationFactory.h"
    8 9   
    9 10  SimulationModel::SimulationModel(IController& controller)
    10 11   : controller(controller) {
    skipped 2 lines
    13 14   entityFactory.addFactory(new RobotFactory());
    14 15   entityFactory.addFactory(new HumanFactory());
    15 16   entityFactory.addFactory(new HelicopterFactory());
     17 + entityFactory.addFactory(new RechargeStationFactory());
    16 18  }
    17 19   
    18 20  SimulationModel::~SimulationModel() {
    skipped 112 lines
  • service/src/simulationmodel/entity/RechargeStation.cc
    ■ ■ ■ ■ ■ ■
     1 +#include "RechargeStation.h"
     2 + 
     3 +RechargeStation::RechargeStation(const JsonObject& obj) : IEntity(obj) {}
     4 + 
     5 +RechargeStation::~RechargeStation() {}
     6 + 
     7 +void RechargeStation::chargeDrone(IEntity* entity) {}
     8 + 
     9 +void RechargeStation::update(double dt) {}
     10 + 
  • service/src/simulationmodel/factory/RechargeStationFactory.cc
    ■ ■ ■ ■ ■ ■
     1 +#include "RechargeStationFactory.h"
     2 + 
     3 +IEntity* RechargeStationFactory::createEntity(const JsonObject& obj) {
     4 + std::string type = obj["type"];
     5 + if (type.compare("recharge_station") == 0) {
     6 + std::cout << "Recharge Station Created" << std::endl;
     7 + return new RechargeStation(obj);
     8 + }
     9 + return nullptr;
     10 +}
     11 + 
Page is in error, reload to recover