diff --git a/pi2-demo/include/Bicycle.hpp b/pi2-demo/include/Bicycle.hpp index 29f005c92b13e7ddb4d9bc086979baea2d679680..19943df08763ec48b032e80c4d83cfc41a48967a 100644 --- a/pi2-demo/include/Bicycle.hpp +++ b/pi2-demo/include/Bicycle.hpp @@ -2,13 +2,13 @@ #include "Vehicle.hpp" #include -class MapAppABIWrapper; +class MapAppAPIWrapper; class Bicycle : public Vehicle { public: Bicycle(std::string name, double topSpeed, double timeOfStart, double time); - void draw(MapAppABIWrapper &mapApp, const std::string &laneName, + void draw(MapAppAPIWrapper &mapApp, const std::string &laneName, double laneLength, double speedLimit) const override; double getSpeed(double speedLimit) const override; diff --git a/pi2-demo/include/Car.hpp b/pi2-demo/include/Car.hpp index 044be76c60450035e4f7d12932103ea681b95671..19717a0543f950e077e6a4dfb255bae6267bd8de 100644 --- a/pi2-demo/include/Car.hpp +++ b/pi2-demo/include/Car.hpp @@ -2,7 +2,7 @@ #include "Vehicle.hpp" #include -class MapAppABIWrapper; +class MapAppAPIWrapper; class Car : public Vehicle { public: @@ -10,7 +10,7 @@ public: Car(std::string name, double topSpeed, double timeOfStart, double fuelConsumption, double fuelCapacity, double time); - void draw(MapAppABIWrapper &mapApp, const std::string &laneName, + void draw(MapAppAPIWrapper &mapApp, const std::string &laneName, double laneLength, double speedLimit) const override; double getSpeed(double speedLimit) const override; diff --git a/pi2-demo/include/Junction.hpp b/pi2-demo/include/Junction.hpp index 82b77ab626b4c385989ce32e06a34dd7657f9ba9..be4ceb4b57b8622f41ea92f1405fb5ef0351c693 100644 --- a/pi2-demo/include/Junction.hpp +++ b/pi2-demo/include/Junction.hpp @@ -7,7 +7,7 @@ #include #include class Vehicle; -class MapAppABIWrapper; +class MapAppAPIWrapper; class Junction : public Named { public: @@ -25,7 +25,7 @@ public: void processVehicles(double time); - void drawVehicles(MapAppABIWrapper &mapApp) const; + void drawVehicles(MapAppAPIWrapper &mapApp) const; void createCar(std::string name, double topSpeed, double fuelConsumption, double fuelCapacity, double timeOfStart, double time); diff --git a/pi2-demo/include/Lane.hpp b/pi2-demo/include/Lane.hpp index c4809020bb1c0074c79b1f6b717c30a869a809a0..e3413ff665d078785990b95a219abf7dbe42f003 100644 --- a/pi2-demo/include/Lane.hpp +++ b/pi2-demo/include/Lane.hpp @@ -5,7 +5,7 @@ #include #include #include -class MapAppABIWrapper; +class MapAppAPIWrapper; class Junction; class Lane : public Named { @@ -16,7 +16,7 @@ public: double speedLimit, bool noPassing, std::weak_ptr destinationJunction); - void drawVehicles(MapAppABIWrapper &mapApp) const; + void drawVehicles(MapAppAPIWrapper &mapApp) const; void processVehicles(double time); diff --git a/pi2-demo/include/Map.hpp b/pi2-demo/include/Map.hpp index 1c68d1447ca64afc299b378f8cb2e0a3592654fd..4c47d844d78d2317eb7769108f934b7c966333fd 100644 --- a/pi2-demo/include/Map.hpp +++ b/pi2-demo/include/Map.hpp @@ -1,6 +1,6 @@ #pragma once -#include "MapAppABIWrapper.hpp" +#include "MapAppAPIWrapper.hpp" #include #include #include @@ -18,18 +18,18 @@ public: private: double time; std::vector> junctions; - MapAppABIWrapper mapApp; + MapAppAPIWrapper mapApp; std::weak_ptr getJunction(const std::string &name); /// Required format: /// `name` `fuelAmount` `x` `y` - void extractJunctionAndDraw(std::istream &is, MapAppABIWrapper &mapApp); + void extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp); /// Required format: /// `nameJunctionA` `nameJunctionB` `nameLaneAToB` `nameLaneBToA` `length in km` /// `speedLimit in {1,2,3}` `noPassing` `coordinateCount` `coordinates...` - void extractRoadAndDraw(std::istream &is, MapAppABIWrapper &mapApp); + void extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp); /// Required format: /// `name` `topSpeed` `nameStartJunction` `timeOfStart` diff --git a/pi2-demo/include/MapAppABIWrapper.hpp b/pi2-demo/include/MapAppAPIWrapper.hpp similarity index 87% rename from pi2-demo/include/MapAppABIWrapper.hpp rename to pi2-demo/include/MapAppAPIWrapper.hpp index 2a74a41fdb1ee1124c73126fa54d2d446fd60128..8f395cb224e79373f2c314f879effa3a6e01e1d2 100644 --- a/pi2-demo/include/MapAppABIWrapper.hpp +++ b/pi2-demo/include/MapAppAPIWrapper.hpp @@ -5,10 +5,10 @@ #include struct MapApp; -class MapAppABIWrapper { +class MapAppAPIWrapper { public: - MapAppABIWrapper(const std::string &windowTitle); - virtual ~MapAppABIWrapper(); + MapAppAPIWrapper(const std::string &windowTitle); + virtual ~MapAppAPIWrapper(); void addJunction(double x, double y); void addRoad(const std::string &laneThereName, const std::string &laneBackName, diff --git a/pi2-demo/include/Vehicle.hpp b/pi2-demo/include/Vehicle.hpp index 0545ec582ceb0bbeebfb21fa9219c100d36b89d8..580b627cd1ef6ebaef780290a0fa6bbe3ee78780 100644 --- a/pi2-demo/include/Vehicle.hpp +++ b/pi2-demo/include/Vehicle.hpp @@ -2,13 +2,13 @@ #include "Named.hpp" #include -class MapAppABIWrapper; +class MapAppAPIWrapper; class Vehicle : public Named { public: // Draws the vehicle on the provided \p mapApp on the specified \p laneName // which has a \p laneLength and a \p speedLimit - virtual void draw(MapAppABIWrapper &mapApp, const std::string &laneName, + virtual void draw(MapAppAPIWrapper &mapApp, const std::string &laneName, double laneLength, double speedLimit) const = 0; /// \returns The current speed in km/h diff --git a/pi2-demo/meson.build b/pi2-demo/meson.build index c0a987af0b81bddf90fb47b960a2db392f521387..1d6b9cfd3916a98cec18d3e58cf78cc3a898b765 100644 --- a/pi2-demo/meson.build +++ b/pi2-demo/meson.build @@ -8,7 +8,7 @@ pi2_demo_src = files( 'src/Lane.cpp', 'src/Map.cpp', 'src/main.cpp', - 'src/MapAppABIWrapper.cpp' + 'src/MapAppAPIWrapper.cpp' ) boost_po_dep = dependency('boost', modules : ['program_options']) executable('pi2-demo', pi2_demo_src, diff --git a/pi2-demo/src/Bicycle.cpp b/pi2-demo/src/Bicycle.cpp index fea813fbacfe922b177297f381f7f260974bdd67..164b405536c565dfda4339a84ce6efd0ef30288a 100644 --- a/pi2-demo/src/Bicycle.cpp +++ b/pi2-demo/src/Bicycle.cpp @@ -1,5 +1,5 @@ #include "Bicycle.hpp" -#include "MapAppABIWrapper.hpp" +#include "MapAppAPIWrapper.hpp" #include #include #include @@ -8,7 +8,7 @@ Bicycle::Bicycle(std::string name, const double topSpeed, const double timeOfStart, const double time) : Vehicle(std::move(name), topSpeed, timeOfStart, time) {} -void Bicycle::draw(MapAppABIWrapper &mapApp, const std::string &laneName, +void Bicycle::draw(MapAppAPIWrapper &mapApp, const std::string &laneName, const double laneLength, const double speedLimit) const { const auto positionOnLane = getDistanceOnLane() / laneLength; mapApp.addOrReplaceBicycle(getName(), laneName, positionOnLane, diff --git a/pi2-demo/src/Car.cpp b/pi2-demo/src/Car.cpp index 21bb727cb3a55537f9c1bd17520b0ee1a28f2d83..084ed6279d516983501f6737a7111ec59e5f1230 100644 --- a/pi2-demo/src/Car.cpp +++ b/pi2-demo/src/Car.cpp @@ -1,5 +1,5 @@ #include "Car.hpp" -#include "MapAppABIWrapper.hpp" +#include "MapAppAPIWrapper.hpp" #include #include @@ -10,7 +10,7 @@ Car::Car(std::string name, const double topSpeed, const double timeOfStart, fuelConsumption(fuelConsumption), fuelCapacity(fuelCapacity), fuel(fuelCapacity / 2) {} -void Car::draw(MapAppABIWrapper &mapApp, const std::string &laneName, +void Car::draw(MapAppAPIWrapper &mapApp, const std::string &laneName, const double laneLength, const double speedLimit) const { const auto positionOnLane = getDistanceOnLane() / laneLength; mapApp.addOrReplaceCar(getName(), laneName, positionOnLane, diff --git a/pi2-demo/src/Junction.cpp b/pi2-demo/src/Junction.cpp index 92e7f2c73ff7bfc65835d262505cdce1eee27c65..621be40f52a9656110bce84bf4f449dad5a0681b 100644 --- a/pi2-demo/src/Junction.cpp +++ b/pi2-demo/src/Junction.cpp @@ -5,7 +5,7 @@ #include #include #include -class MapAppABIWrapper; +class MapAppAPIWrapper; void Junction::connect(const std::weak_ptr &junctionA, const std::weak_ptr &junctionB, @@ -33,7 +33,7 @@ void Junction::processVehicles(const double time) { } } -void Junction::drawVehicles(MapAppABIWrapper &mapApp) const { +void Junction::drawVehicles(MapAppAPIWrapper &mapApp) const { for (auto &&weg : outboundLanes) { weg.drawVehicles(mapApp); } diff --git a/pi2-demo/src/Lane.cpp b/pi2-demo/src/Lane.cpp index 6600ac6e6603bffd329b1ac6dd073a782b8b845e..ae99252040570f1118a968b18ad5fd06f9b4ee83 100644 --- a/pi2-demo/src/Lane.cpp +++ b/pi2-demo/src/Lane.cpp @@ -6,7 +6,7 @@ #include #include #include -class MapAppABIWrapper; +class MapAppAPIWrapper; // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) Lane::Lane(Lane &&other) noexcept = default; @@ -19,7 +19,7 @@ Lane::Lane(std::string name, std::string oppositeLaneName, const double length, oppositeLaneName(std::move(oppositeLaneName)), speedLimit(speedLimit), noPassing(noPassing) {} -void Lane::drawVehicles(MapAppABIWrapper &mapApp) const { +void Lane::drawVehicles(MapAppAPIWrapper &mapApp) const { for (auto &&fahrzeug : vehicles) { fahrzeug->draw(mapApp, getName(), length, speedLimit); } diff --git a/pi2-demo/src/Map.cpp b/pi2-demo/src/Map.cpp index 110fd6716ab4b39042fbe58d48f284e4fe72e0a1..a9d09f9e3bbc47f23a88060757b77f5f22069836 100644 --- a/pi2-demo/src/Map.cpp +++ b/pi2-demo/src/Map.cpp @@ -1,6 +1,6 @@ #include "Map.hpp" #include "Junction.hpp" -#include "MapAppABIWrapper.hpp" +#include "MapAppAPIWrapper.hpp" #include #include #include @@ -52,7 +52,7 @@ std::weak_ptr Map::getJunction(const std::string &name) { [&name](const auto &junction) { return junction->getName() == name; }); } -void Map::extractJunctionAndDraw(std::istream &is, MapAppABIWrapper &mapApp) { +void Map::extractJunctionAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) { std::string name; double fuelAmount; is >> name >> fuelAmount; @@ -64,7 +64,7 @@ void Map::extractJunctionAndDraw(std::istream &is, MapAppABIWrapper &mapApp) { mapApp.addJunction(x, y); } -void Map::extractRoadAndDraw(std::istream &is, MapAppABIWrapper &mapApp) { +void Map::extractRoadAndDraw(std::istream &is, MapAppAPIWrapper &mapApp) { std::string nameJunctionA; std::string nameJunctionB; std::string nameLaneAToB; diff --git a/pi2-demo/src/MapAppABIWrapper.cpp b/pi2-demo/src/MapAppAPIWrapper.cpp similarity index 73% rename from pi2-demo/src/MapAppABIWrapper.cpp rename to pi2-demo/src/MapAppAPIWrapper.cpp index 920d68a5085850a09fb0eba0ddd65ba6ba764678..dc02a3e9ff5b496aa3e750bdad5cc006cda377a5 100644 --- a/pi2-demo/src/MapAppABIWrapper.cpp +++ b/pi2-demo/src/MapAppAPIWrapper.cpp @@ -1,28 +1,28 @@ -#include "MapAppABIWrapper.hpp" +#include "MapAppAPIWrapper.hpp" #include "pi2-view.h" #include #include -MapAppABIWrapper::MapAppABIWrapper(const std::string &windowTitle) +MapAppAPIWrapper::MapAppAPIWrapper(const std::string &windowTitle) : mapApp(mapAppCreate(windowTitle.c_str())) {} -MapAppABIWrapper::~MapAppABIWrapper() { +MapAppAPIWrapper::~MapAppAPIWrapper() { mapAppDestroy(mapApp); mapApp = nullptr; } -void MapAppABIWrapper::addJunction(const double x, const double y) { +void MapAppAPIWrapper::addJunction(const double x, const double y) { mapAppAddJunction(mapApp, x, y); } -void MapAppABIWrapper::addRoad(const std::string &laneThereName, +void MapAppAPIWrapper::addRoad(const std::string &laneThereName, const std::string &laneBackName, const std::vector &coordinates) { mapAppAddRoad(mapApp, laneThereName.c_str(), laneBackName.c_str(), coordinates.data(), coordinates.size()); } -void MapAppABIWrapper::addOrReplaceBicycle(const std::string &vehicleName, +void MapAppAPIWrapper::addOrReplaceBicycle(const std::string &vehicleName, const std::string &laneName, const double positionOnLane, const double speed) { @@ -30,7 +30,7 @@ void MapAppABIWrapper::addOrReplaceBicycle(const std::string &vehicleName, positionOnLane, speed); } -void MapAppABIWrapper::addOrReplaceCar(const std::string &vehicleName, +void MapAppAPIWrapper::addOrReplaceCar(const std::string &vehicleName, const std::string &laneName, const double positionOnLane, const double speed, @@ -39,6 +39,6 @@ void MapAppABIWrapper::addOrReplaceCar(const std::string &vehicleName, positionOnLane, speed, remainingFuel); } -void MapAppABIWrapper::setDurationLabel(const std::chrono::minutes minutes) { +void MapAppAPIWrapper::setDurationLabel(const std::chrono::minutes minutes) { mapAppSetDurationLabel(mapApp, minutes.count()); }