diff --git a/include/engine/algorithm.hpp b/include/engine/algorithm.hpp index 6c3e9afda..8e8f8481c 100644 --- a/include/engine/algorithm.hpp +++ b/include/engine/algorithm.hpp @@ -56,6 +56,9 @@ template struct HasManyToManySearch final : std::false_typ template struct HasGetTileTurns final : std::false_type { }; +template struct HasAvoidFlags final : std::false_type +{ +}; // Algorithms supported by Contraction Hierarchies template <> struct HasAlternativePathSearch final : std::true_type @@ -111,6 +114,9 @@ template <> struct HasManyToManySearch final : std::true_type template <> struct HasGetTileTurns final : std::true_type { }; +template <> struct HasAvoidFlags final : std::true_type +{ +}; } } } diff --git a/include/engine/data_watchdog.hpp b/include/engine/data_watchdog.hpp index 1300732ff..983b84df8 100644 --- a/include/engine/data_watchdog.hpp +++ b/include/engine/data_watchdog.hpp @@ -25,10 +25,12 @@ namespace engine // This class monitors the shared memory region that contains the pointers to // the data and layout regions that should be used. This region is updated // once a new dataset arrives. -template class DataWatchdog final +template class FacadeT, typename AlgorithmT> class DataWatchdog; + +template class DataWatchdog final { using mutex_type = typename storage::SharedMonitor::mutex_type; - using FacadeT = datafacade::ContiguousInternalMemoryDataFacade; + using Facade = datafacade::ContiguousInternalMemoryDataFacade; public: DataWatchdog() : active(true), timestamp(0) @@ -37,7 +39,7 @@ template class DataWatchdog final { boost::interprocess::scoped_lock current_region_lock(barrier.get_mutex()); - facade_factory = DataFacadeFactory( + facade_factory = DataFacadeFactory( std::make_shared(barrier.data().region)); timestamp = barrier.data().timestamp; } @@ -52,8 +54,8 @@ template class DataWatchdog final watcher.join(); } - std::shared_ptr Get(const api::BaseParameters ¶ms) const { return facade_factory.Get(params); } - std::shared_ptr Get(const api::TileParameters ¶ms) const { return facade_factory.Get(params); } + std::shared_ptr Get(const api::BaseParameters ¶ms) const { return facade_factory.Get(params); } + std::shared_ptr Get(const api::TileParameters ¶ms) const { return facade_factory.Get(params); } private: void Run() @@ -70,7 +72,7 @@ template class DataWatchdog final if (timestamp != barrier.data().timestamp) { auto region = barrier.data().region; - facade_factory = DataFacadeFactory( + facade_factory = DataFacadeFactory( std::make_shared(region)); timestamp = barrier.data().timestamp; util::Log() << "updated facade to region " << region << " with timestamp " @@ -85,7 +87,7 @@ template class DataWatchdog final std::thread watcher; bool active; unsigned timestamp; - DataFacadeFactory facade_factory; + DataFacadeFactory facade_factory; }; } } diff --git a/include/engine/datafacade_factory.hpp b/include/engine/datafacade_factory.hpp index f4b422e75..930851a0a 100644 --- a/include/engine/datafacade_factory.hpp +++ b/include/engine/datafacade_factory.hpp @@ -4,6 +4,7 @@ #include "extractor/class_data.hpp" #include "extractor/profile_properties.hpp" +#include "engine/algorithm.hpp" #include "engine/api/base_parameters.hpp" #include "engine/api/tile_parameters.hpp" @@ -20,16 +21,33 @@ namespace osrm namespace engine { // This class selects the right facade for -template class DataFacadeFactory +template