Inject offline compressed data facade with OSRM_EXTERNAL_MEMORY option.
This commit is contained in:
parent
a64145b712
commit
40857aae61
@ -3,8 +3,17 @@
|
||||
|
||||
#ifdef OSRM_EXTERNAL_MEMORY
|
||||
|
||||
// Register your own data backend here
|
||||
#error "No external memory implementation found"
|
||||
#include "routing/compressed_datafacade.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
|
||||
using DataFacadeBase = datafacade::BaseDataFacade;
|
||||
template <typename AlgorithmT> using DataFacade = datafacade::CompressedDataFacadeT<AlgorithmT>;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
#ifndef SEARCH_ENGINE_DATA_HPP
|
||||
#define SEARCH_ENGINE_DATA_HPP
|
||||
|
||||
#ifndef OSRM_EXTERNAL_MEMORY
|
||||
#include <boost/thread/tss.hpp>
|
||||
#endif
|
||||
|
||||
#include "engine/algorithm.hpp"
|
||||
#include "util/query_heap.hpp"
|
||||
@ -37,7 +39,6 @@ template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
||||
{
|
||||
using QueryHeap = util::
|
||||
QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::UnorderedMapStorage<NodeID, int>>;
|
||||
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||
|
||||
using ManyToManyQueryHeap = util::QueryHeap<NodeID,
|
||||
NodeID,
|
||||
@ -45,7 +46,13 @@ template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
||||
ManyToManyHeapData,
|
||||
util::UnorderedMapStorage<NodeID, int>>;
|
||||
|
||||
#ifdef OSRM_EXTERNAL_MEMORY
|
||||
using SearchEngineHeapPtr = std::unique_ptr<QueryHeap>;
|
||||
using ManyToManyHeapPtr = std::unique_ptr<ManyToManyQueryHeap>;
|
||||
#else
|
||||
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
||||
#endif
|
||||
|
||||
static SearchEngineHeapPtr forward_heap_1;
|
||||
static SearchEngineHeapPtr reverse_heap_1;
|
||||
@ -105,9 +112,13 @@ template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
|
||||
ManyToManyMultiLayerDijkstraHeapData,
|
||||
util::UnorderedMapStorage<NodeID, int>>;
|
||||
|
||||
#ifdef OSRM_EXTERNAL_MEMORY
|
||||
using SearchEngineHeapPtr = std::unique_ptr<QueryHeap>;
|
||||
using ManyToManyHeapPtr = std::unique_ptr<ManyToManyQueryHeap>;
|
||||
#else
|
||||
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
||||
|
||||
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
||||
#endif
|
||||
|
||||
static SearchEngineHeapPtr forward_heap_1;
|
||||
static SearchEngineHeapPtr reverse_heap_1;
|
||||
|
@ -1,6 +1,11 @@
|
||||
#include "engine/routing_algorithms/shortest_path.hpp"
|
||||
|
||||
#ifdef OSRM_EXTERNAL_MEMORY
|
||||
#include "routing/routing_base_offline.hpp"
|
||||
#else
|
||||
#include "engine/routing_algorithms/routing_base_ch.hpp"
|
||||
#include "engine/routing_algorithms/routing_base_mld.hpp"
|
||||
#endif
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
@ -456,6 +461,16 @@ InternalRouteResult shortestPathSearch(SearchEngineData<Algorithm> &engine_worki
|
||||
return raw_route_data;
|
||||
}
|
||||
|
||||
#ifdef OSRM_EXTERNAL_MEMORY
|
||||
|
||||
template InternalRouteResult
|
||||
shortestPathSearch(SearchEngineData<offline::Algorithm> &engine_working_data,
|
||||
const DataFacade<offline::Algorithm> &facade,
|
||||
const std::vector<PhantomNodes> &phantom_nodes_vector,
|
||||
const boost::optional<bool> continue_straight_at_waypoint);
|
||||
|
||||
#else
|
||||
|
||||
template InternalRouteResult
|
||||
shortestPathSearch(SearchEngineData<ch::Algorithm> &engine_working_data,
|
||||
const DataFacade<ch::Algorithm> &facade,
|
||||
@ -474,6 +489,8 @@ shortestPathSearch(SearchEngineData<mld::Algorithm> &engine_working_data,
|
||||
const std::vector<PhantomNodes> &phantom_nodes_vector,
|
||||
const boost::optional<bool> continue_straight_at_waypoint);
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace routing_algorithms
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
|
Loading…
Reference in New Issue
Block a user