From 2c4ba90abb9da294218a09e6d4004d1e48ff576a Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Thu, 31 Mar 2016 21:35:41 +0200 Subject: [PATCH] Remove leftover hello_world and timestamp plugins --- include/engine/plugins/hello_world.hpp | 87 -------------------------- include/engine/plugins/timestamp.hpp | 43 ------------- src/engine/engine.cpp | 2 - 3 files changed, 132 deletions(-) delete mode 100644 include/engine/plugins/hello_world.hpp delete mode 100644 include/engine/plugins/timestamp.hpp diff --git a/include/engine/plugins/hello_world.hpp b/include/engine/plugins/hello_world.hpp deleted file mode 100644 index 312b6e5d6..000000000 --- a/include/engine/plugins/hello_world.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef HELLO_WORLD_HPP -#define HELLO_WORLD_HPP - -#include "engine/plugins/plugin_base.hpp" - -#include "osrm/json_container.hpp" - -#include - -namespace osrm -{ -namespace engine -{ -namespace plugins -{ - -class HelloWorldPlugin final : public BasePlugin -{ - private: - std::string temp_string; - - public: - HelloWorldPlugin() : descriptor_string("hello") {} - virtual ~HelloWorldPlugin() {} - const std::string GetDescriptor() const override final { return descriptor_string; } - - Status HandleRequest(const RouteParameters &routeParameters, - util::json::Object &json_result) override final - { - std::string temp_string; - json_result.values["title"] = "Hello World"; - - temp_string = std::to_string(routeParameters.zoom_level); - json_result.values["zoom_level"] = temp_string; - - temp_string = std::to_string(routeParameters.check_sum); - json_result.values["check_sum"] = temp_string; - json_result.values["instructions"] = (routeParameters.print_instructions ? "yes" : "no"); - json_result.values["geometry"] = (routeParameters.geometry ? "yes" : "no"); - json_result.values["compression"] = (routeParameters.compression ? "yes" : "no"); - json_result.values["output_format"] = - (!routeParameters.output_format.empty() ? "yes" : "no"); - - json_result.values["jsonp_parameter"] = - (!routeParameters.jsonp_parameter.empty() ? "yes" : "no"); - json_result.values["language"] = (!routeParameters.language.empty() ? "yes" : "no"); - - temp_string = std::to_string(routeParameters.coordinates.size()); - json_result.values["location_count"] = temp_string; - - util::json::Array json_locations; - unsigned counter = 0; - for (const auto coordinate : routeParameters.coordinates) - { - util::json::Object json_location; - util::json::Array json_coordinates; - - json_coordinates.values.push_back( - static_cast(coordinate.lat / COORDINATE_PRECISION)); - json_coordinates.values.push_back( - static_cast(coordinate.lon / COORDINATE_PRECISION)); - json_location.values[std::to_string(counter)] = json_coordinates; - json_locations.values.push_back(json_location); - ++counter; - } - json_result.values["locations"] = json_locations; - json_result.values["hint_count"] = routeParameters.hints.size(); - - util::json::Array json_hints; - counter = 0; - for (const std::string ¤t_hint : routeParameters.hints) - { - json_hints.values.push_back(current_hint); - ++counter; - } - json_result.values["hints"] = json_hints; - return Status::Ok; - } - - private: - std::string descriptor_string; -}; -} -} -} - -#endif // HELLO_WORLD_HPP diff --git a/include/engine/plugins/timestamp.hpp b/include/engine/plugins/timestamp.hpp deleted file mode 100644 index 2bf4bdd50..000000000 --- a/include/engine/plugins/timestamp.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef TIMESTAMP_PLUGIN_H -#define TIMESTAMP_PLUGIN_H - -#include "engine/plugins/plugin_base.hpp" - -#include "osrm/json_container.hpp" - -#include - -namespace osrm -{ -namespace engine -{ -namespace plugins -{ - -template class TimestampPlugin final : public BasePlugin -{ - public: - explicit TimestampPlugin(const DataFacadeT *facade) - : facade(facade), descriptor_string("timestamp") - { - } - const std::string GetDescriptor() const override final { return descriptor_string; } - Status HandleRequest(const RouteParameters &route_parameters, - util::json::Object &json_result) override final - { - (void)route_parameters; // unused - - const std::string timestamp = facade->GetTimestamp(); - json_result.values["timestamp"] = timestamp; - return Status::Ok; - } - - private: - const DataFacadeT *facade; - std::string descriptor_string; -}; -} -} -} - -#endif /* TIMESTAMP_PLUGIN_H */ diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 63f601c56..9207c44c0 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -4,9 +4,7 @@ #include "engine/status.hpp" #include "engine/plugins/table.hpp" -//#include "engine/plugins/hello_world.hpp" #include "engine/plugins/nearest.hpp" -//#include "engine/plugins/timestamp.hpp" #include "engine/plugins/trip.hpp" #include "engine/plugins/viaroute.hpp" #include "engine/plugins/tile.hpp"