osrm-backend/include/engine/plugins/timestamp.hpp

44 lines
969 B
C++
Raw Normal View History

2014-05-02 12:06:31 -04:00
#ifndef TIMESTAMP_PLUGIN_H
#define TIMESTAMP_PLUGIN_H
2016-01-02 11:13:44 -05:00
#include "engine/plugins/plugin_base.hpp"
2014-11-28 09:13:29 -05:00
2016-01-02 11:13:44 -05:00
#include "osrm/json_container.hpp"
2014-11-24 11:57:01 -05:00
#include <string>
2016-01-05 10:51:13 -05:00
namespace osrm
{
namespace engine
{
namespace plugins
{
2014-10-13 11:29:53 -04:00
template <class DataFacadeT> class TimestampPlugin final : public BasePlugin
2014-05-02 12:06:31 -04:00
{
public:
explicit TimestampPlugin(const DataFacadeT *facade)
: facade(facade), descriptor_string("timestamp")
{
}
const std::string GetDescriptor() const override final { return descriptor_string; }
2015-12-17 10:45:15 -05:00
Status HandleRequest(const RouteParameters &route_parameters,
2016-01-05 10:51:13 -05:00
util::json::Object &json_result) override final
2014-05-02 12:06:31 -04:00
{
2015-09-04 12:23:57 -04:00
(void)route_parameters; // unused
const std::string timestamp = facade->GetTimestamp();
json_result.values["timestamp"] = timestamp;
2015-12-17 10:45:15 -05:00
return Status::Ok;
}
2014-05-02 12:06:31 -04:00
private:
const DataFacadeT *facade;
2013-08-13 12:09:20 -04:00
std::string descriptor_string;
};
2016-01-05 10:51:13 -05:00
}
}
}
2014-05-02 12:06:31 -04:00
#endif /* TIMESTAMP_PLUGIN_H */