2017-03-01 12:27:57 -05:00
|
|
|
#ifndef OSRM_BINDINGS_NODE_HPP
|
|
|
|
#define OSRM_BINDINGS_NODE_HPP
|
|
|
|
|
|
|
|
#include "osrm/osrm_fwd.hpp"
|
|
|
|
|
2018-02-01 08:03:47 -05:00
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
2017-03-01 12:27:57 -05:00
|
|
|
#include <nan.h>
|
2018-02-01 08:03:47 -05:00
|
|
|
#pragma GCC diagnostic pop
|
2017-03-01 12:27:57 -05:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace node_osrm
|
|
|
|
{
|
|
|
|
|
|
|
|
struct Engine final : public Nan::ObjectWrap
|
|
|
|
{
|
|
|
|
using Base = Nan::ObjectWrap;
|
|
|
|
|
|
|
|
static NAN_MODULE_INIT(Init);
|
|
|
|
|
|
|
|
static NAN_METHOD(New);
|
|
|
|
|
|
|
|
static NAN_METHOD(route);
|
|
|
|
static NAN_METHOD(nearest);
|
|
|
|
static NAN_METHOD(table);
|
|
|
|
static NAN_METHOD(tile);
|
|
|
|
static NAN_METHOD(match);
|
|
|
|
static NAN_METHOD(trip);
|
|
|
|
|
|
|
|
Engine(osrm::EngineConfig &config);
|
|
|
|
|
|
|
|
// Thread-safe singleton accessor
|
|
|
|
static Nan::Persistent<v8::Function> &constructor();
|
|
|
|
|
|
|
|
// Ref-counted OSRM alive even after shutdown until last callback is done
|
|
|
|
std::shared_ptr<osrm::OSRM> this_;
|
|
|
|
};
|
|
|
|
|
2020-05-12 09:09:40 -04:00
|
|
|
} // namespace node_osrm
|
2017-03-01 12:27:57 -05:00
|
|
|
|
|
|
|
NODE_MODULE(osrm, node_osrm::Engine::Init)
|
|
|
|
|
|
|
|
#endif
|