1Dev
Projects
Global Views
Pull Requests
Issues
Builds
Packages
drone_simulation
Code
Files
Commits
Branches
Tags
Code Comments
Code Compare
Pull Requests
Issues
List
Boards
Iterations
Builds
Packages
Statistics
Code
Child Projects
Projects
drone_simulation
Commits
df26c352
ctrl
k
Sign In
Adding recharge station and corresponding factory
Browse Code
main
backend-fix
Integration-v2
Hongzheng Li
committed
1 year ago
df26c352
1 parent
c0f509d9
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
+
All occurrences
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
+
All occurrences
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
All occurrences
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
+
All occurrences
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
+
All occurrences
service
include/simulationmodel
entity/RechargeStation.h
factory/RechargeStationFactory.h
src/simulationmodel
SimulationModel.cc
entity/RechargeStation.cc
factory/RechargeStationFactory.cc
Please wait...
Page is in error, reload to recover