Skip to content

Commit

Permalink
Adapt the example to include all osrm public headers
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j-h authored and TheMarex committed Apr 5, 2016
1 parent fcf5838 commit dded2c2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Thumbs.db
# build related files #
#######################
/build/
/example/build/
/cmake/postinst

# Eclipse related files #
Expand Down
14 changes: 11 additions & 3 deletions example/example.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#include "osrm/json_container.hpp"
#include "osrm/engine_config.hpp"
#include "osrm/route_parameters.hpp"
#include "osrm/table_parameters.hpp"
#include "osrm/nearest_parameters.hpp"
#include "osrm/trip_parameters.hpp"
#include "osrm/match_parameters.hpp"

#include "osrm/coordinate.hpp"
#include "osrm/engine_config.hpp"
#include "osrm/json_container.hpp"

#include "osrm/status.hpp"
#include "osrm/osrm.hpp"

#include <string>
Expand Down Expand Up @@ -46,7 +54,7 @@ int main(int argc, const char *argv[]) try
if (result_code / 100 == 2)
{
// Extract data out of JSON structure
auto& summary = json_result.values["route_summary"].get<osrm::json::Object>();
auto &summary = json_result.values["route_summary"].get<osrm::json::Object>();
auto duration = summary.values["total_time"].get<osrm::json::Number>().value;
auto distance = summary.values["total_distance"].get<osrm::json::Number>().value;
std::cout << "duration: " << duration << std::endl;
Expand Down

0 comments on commit dded2c2

Please sign in to comment.