Fix compilation after rebase

This commit is contained in:
Patrick Niklaus 2017-08-14 20:32:11 +00:00 committed by Patrick Niklaus
parent f93b331817
commit bd6492bb38
5 changed files with 33 additions and 12 deletions

View File

@ -22,18 +22,21 @@ namespace osrm
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 <template<typename A> class FacadeT, typename AlgorithmT> class DataWatchdog;
template <typename AlgorithmT> class DataWatchdog<datafacade::ContiguousInternalMemoryDataFacade,AlgorithmT> final
namespace detail
{
// We need this wrapper type since template-template specilization of FacadeT is broken on clang
// when it is combined with an templated alias (DataFacade in this case).
// See https://godbolt.org/g/ZS6Xmt for an example.
template <typename AlgorithmT, typename FacadeT> class DataWatchdogImpl;
template <typename AlgorithmT> class DataWatchdogImpl<AlgorithmT, datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>> final
{
using mutex_type = typename storage::SharedMonitor<storage::SharedDataTimestamp>::mutex_type;
using Facade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
public:
DataWatchdog() : active(true), timestamp(0)
DataWatchdogImpl() : active(true), timestamp(0)
{
// create the initial facade before launching the watchdog thread
{
@ -44,10 +47,10 @@ template <typename AlgorithmT> class DataWatchdog<datafacade::ContiguousInternal
timestamp = barrier.data().timestamp;
}
watcher = std::thread(&DataWatchdog::Run, this);
watcher = std::thread(&DataWatchdogImpl::Run, this);
}
~DataWatchdog()
~DataWatchdogImpl()
{
active = false;
barrier.notify_all();
@ -89,6 +92,13 @@ template <typename AlgorithmT> class DataWatchdog<datafacade::ContiguousInternal
unsigned timestamp;
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT> facade_factory;
};
}
// 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 <typename AlgorithmT, template<typename A> class FacadeT> using DataWatchdog = detail::DataWatchdogImpl<AlgorithmT, FacadeT<AlgorithmT>>;
}
}

View File

@ -11,6 +11,7 @@ namespace engine
using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase;
template <typename AlgorithmT>
using DataFacade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
}
}

View File

@ -1,6 +1,7 @@
#ifndef OSRM_ENGINE_DATAFACADE_PROVIDER_HPP
#define OSRM_ENGINE_DATAFACADE_PROVIDER_HPP
#include "engine/datafacade_factory.hpp"
#include "engine/data_watchdog.hpp"
#include "engine/datafacade.hpp"
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
@ -45,7 +46,7 @@ class ImmutableProvider final : public DataFacadeProvider<AlgorithmT, FacadeT>
template <typename AlgorithmT, template <typename A> class FacadeT>
class WatchingProvider : public DataFacadeProvider<AlgorithmT, FacadeT>
{
DataWatchdog<FacadeT, AlgorithmT> watchdog;
DataWatchdog<AlgorithmT, FacadeT> watchdog;
public:
using Facade = typename DataFacadeProvider<AlgorithmT, FacadeT>::Facade;

View File

@ -68,6 +68,10 @@ struct ExternalMultiLevelPartition
CellID EndChildren(LevelID /*level*/, CellID /*cell*/) const { return 0; }
};
struct ExternalCellMetric
{
};
// Define external cell storage
struct ExternalCellStorage
{
@ -97,10 +101,10 @@ struct ExternalCellStorage
using Cell = CellImpl;
using ConstCell = const CellImpl;
ConstCell GetCell(LevelID /*level*/, CellID /*id*/) const { return Cell{}; }
Cell GetCell(LevelID /*level*/, CellID /*id*/) { return Cell{}; }
ConstCell GetCell(ExternalCellMetric, LevelID /*level*/, CellID /*id*/) const { return Cell{}; }
};
// Define external data facade
template <>
class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm> final
@ -108,6 +112,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
{
ExternalMultiLevelPartition external_partition;
ExternalCellStorage external_cell_storage;
ExternalCellMetric external_cell_metric;
public:
using EdgeData = extractor::EdgeBasedEdge::EdgeData;
@ -131,6 +136,8 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
const auto &GetCellStorage() const { return external_cell_storage; }
const auto &GetCellMetric() const { return external_cell_metric; }
auto GetBorderEdgeRange(const LevelID /*level*/, const NodeID /*node*/) const
{
return util::irange<EdgeID>(0, 0);
@ -321,7 +328,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
}
bool HasLaneData(const EdgeID /*id*/) const override { return false; }
NameID GetNameIndex(const NodeID /*nodeID*/) const { return EMPTY_NAMEID; }
NameID GetNameIndex(const NodeID /*nodeID*/) const override { return EMPTY_NAMEID; }
StringView GetNameForID(const NameID /*id*/) const override { return StringView{}; }
StringView GetRefForID(const NameID /*id*/) const override { return StringView{}; }
StringView GetPronunciationForID(const NameID /*id*/) const override { return StringView{}; }
@ -334,6 +341,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
unsigned GetWeightPrecision() const override { return 0; }
double GetWeightMultiplier() const override { return 1; }
ComponentID GetComponentID(NodeID) const override { return ComponentID{}; }
bool AvoidNode(const NodeID) const override { return false; }
util::guidance::TurnBearing PreTurnBearing(const EdgeID /*eid*/) const override
{

View File

@ -27,6 +27,7 @@ class MockScriptingEnvironment : public extractor::ScriptingEnvironment
}
std::vector<std::string> GetNameSuffixList() override final { return {}; }
std::vector<std::vector<std::string>> GetAvoidableClasses() override final { return {}; };
std::vector<std::string> GetRestrictions() override final { return {}; }
void ProcessTurn(extractor::ExtractionTurn &) override final {}