From 2222f3b01999144df8cd956bc773b55b2917cdfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Mon, 21 Jan 2019 12:00:36 +0100 Subject: [PATCH] Rename MapAppABIWrapper to MapAppABIWrapper --- pi2-demo/include/Bicycle.hpp | 4 ++-- pi2-demo/include/Car.hpp | 4 ++-- pi2-demo/include/Junction.hpp | 4 ++-- pi2-demo/include/Lane.hpp | 4 ++-- pi2-demo/include/Map.hpp | 8 ++++---- ...MapAppABIWrapper.hpp => MapAppAPIWrapper.hpp} | 6 +++--- pi2-demo/include/Vehicle.hpp | 4 ++-- pi2-demo/meson.build | 2 +- pi2-demo/src/Bicycle.cpp | 4 ++-- pi2-demo/src/Car.cpp | 4 ++-- pi2-demo/src/Junction.cpp | 4 ++-- pi2-demo/src/Lane.cpp | 4 ++-- pi2-demo/src/Map.cpp | 6 +++--- ...MapAppABIWrapper.cpp => MapAppAPIWrapper.cpp} | 16 ++++++++-------- 14 files changed, 37 insertions(+), 37 deletions(-) rename pi2-demo/include/{MapAppABIWrapper.hpp => MapAppAPIWrapper.hpp} (87%) rename pi2-demo/src/{MapAppABIWrapper.cpp => MapAppAPIWrapper.cpp} (73%) diff --git a/pi2-demo/include/Bicycle.hpp b/pi2-demo/include/Bicycle.hpp index 29f005c..19943df 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 044be76..19717a0 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 82b77ab..be4ceb4 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 c480902..e3413ff 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 1c68d14..4c47d84 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 2a74a41..8f395cb 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 0545ec5..580b627 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 c0a987a..1d6b9cf 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 fea813f..164b405 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 21bb727..084ed62 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 92e7f2c..621be40 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 6600ac6..ae99252 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 110fd67..a9d09f9 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 920d68a..dc02a3e 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()); } -- GitLab