Fix clang format
This commit is contained in:
committed by
Patrick Niklaus
parent
bd6492bb38
commit
6339395cba
@@ -88,10 +88,16 @@ struct RouteParameters : public BaseParameters
|
||||
const OverviewType overview_,
|
||||
const boost::optional<bool> continue_straight_,
|
||||
Args... args_)
|
||||
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one below.
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{false},
|
||||
annotations_type{AnnotationsType::None}, geometries{geometries_}, overview{overview_},
|
||||
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one
|
||||
// below.
|
||||
: BaseParameters{std::forward<Args>(args_)...},
|
||||
steps{steps_},
|
||||
alternatives{alternatives_},
|
||||
number_of_alternatives{alternatives_ ? 1u : 0u},
|
||||
annotations{false},
|
||||
annotations_type{AnnotationsType::None},
|
||||
geometries{geometries_},
|
||||
overview{overview_},
|
||||
continue_straight{continue_straight_}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace osrm
|
||||
namespace engine
|
||||
{
|
||||
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// We need this wrapper type since template-template specilization of FacadeT is broken on clang
|
||||
@@ -30,7 +29,8 @@ namespace detail
|
||||
// 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
|
||||
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>;
|
||||
@@ -42,8 +42,9 @@ template <typename AlgorithmT> class DataWatchdogImpl<AlgorithmT, datafacade::Co
|
||||
{
|
||||
boost::interprocess::scoped_lock<mutex_type> current_region_lock(barrier.get_mutex());
|
||||
|
||||
facade_factory = DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||
std::make_shared<datafacade::SharedMemoryAllocator>(barrier.data().region));
|
||||
facade_factory =
|
||||
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||
std::make_shared<datafacade::SharedMemoryAllocator>(barrier.data().region));
|
||||
timestamp = barrier.data().timestamp;
|
||||
}
|
||||
|
||||
@@ -57,8 +58,14 @@ template <typename AlgorithmT> class DataWatchdogImpl<AlgorithmT, datafacade::Co
|
||||
watcher.join();
|
||||
}
|
||||
|
||||
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const { return facade_factory.Get(params); }
|
||||
std::shared_ptr<const Facade> Get(const api::TileParameters ¶ms) const { return facade_factory.Get(params); }
|
||||
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const
|
||||
{
|
||||
return facade_factory.Get(params);
|
||||
}
|
||||
std::shared_ptr<const Facade> Get(const api::TileParameters ¶ms) const
|
||||
{
|
||||
return facade_factory.Get(params);
|
||||
}
|
||||
|
||||
private:
|
||||
void Run()
|
||||
@@ -75,8 +82,9 @@ template <typename AlgorithmT> class DataWatchdogImpl<AlgorithmT, datafacade::Co
|
||||
if (timestamp != barrier.data().timestamp)
|
||||
{
|
||||
auto region = barrier.data().region;
|
||||
facade_factory = DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||
std::make_shared<datafacade::SharedMemoryAllocator>(region));
|
||||
facade_factory =
|
||||
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||
std::make_shared<datafacade::SharedMemoryAllocator>(region));
|
||||
timestamp = barrier.data().timestamp;
|
||||
util::Log() << "updated facade to region " << region << " with timestamp "
|
||||
<< timestamp;
|
||||
@@ -97,8 +105,8 @@ template <typename AlgorithmT> class DataWatchdogImpl<AlgorithmT, datafacade::Co
|
||||
// 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>>;
|
||||
|
||||
template <typename AlgorithmT, template <typename A> class FacadeT>
|
||||
using DataWatchdog = detail::DataWatchdogImpl<AlgorithmT, FacadeT<AlgorithmT>>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace engine
|
||||
using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase;
|
||||
template <typename AlgorithmT>
|
||||
using DataFacade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
// allocator that keeps the allocation data
|
||||
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
||||
|
||||
void InitializeProfilePropertiesPointer(storage::DataLayout &data_layout, char *memory_block, const std::size_t avoid_index)
|
||||
void InitializeProfilePropertiesPointer(storage::DataLayout &data_layout,
|
||||
char *memory_block,
|
||||
const std::size_t avoid_index)
|
||||
{
|
||||
m_profile_properties = data_layout.GetBlockPtr<extractor::ProfileProperties>(
|
||||
memory_block, storage::DataLayout::PROPERTIES);
|
||||
@@ -542,7 +544,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
m_entry_class_table = std::move(entry_class_table);
|
||||
}
|
||||
|
||||
void InitializeInternalPointers(storage::DataLayout &data_layout, char *memory_block, const std::size_t avoid_index)
|
||||
void InitializeInternalPointers(storage::DataLayout &data_layout,
|
||||
char *memory_block,
|
||||
const std::size_t avoid_index)
|
||||
{
|
||||
InitializeChecksumPointer(data_layout, memory_block);
|
||||
InitializeNodeInformationPointers(data_layout, memory_block);
|
||||
@@ -561,7 +565,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
public:
|
||||
// allows switching between process_memory/shared_memory datafacade, based on the type of
|
||||
// allocator
|
||||
ContiguousInternalMemoryDataFacadeBase(std::shared_ptr<ContiguousBlockAllocator> allocator_, const std::size_t avoid_index)
|
||||
ContiguousInternalMemoryDataFacadeBase(std::shared_ptr<ContiguousBlockAllocator> allocator_,
|
||||
const std::size_t avoid_index)
|
||||
: allocator(std::move(allocator_))
|
||||
{
|
||||
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory(), avoid_index);
|
||||
@@ -924,7 +929,6 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
{
|
||||
return m_profile_properties->left_hand_driving;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename AlgorithmT> class ContiguousInternalMemoryDataFacade;
|
||||
@@ -1028,7 +1032,7 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
|
||||
util::vector_view<EdgeDuration> durations(mld_cell_durations_ptr,
|
||||
duration_entries_count);
|
||||
|
||||
mld_cell_metric = customizer::CellMetricView {std::move(weights), std::move(durations)};
|
||||
mld_cell_metric = customizer::CellMetricView{std::move(weights), std::move(durations)};
|
||||
}
|
||||
|
||||
if (data_layout.GetBlockSize(storage::DataLayout::MLD_CELLS) > 0)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#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"
|
||||
#include "engine/datafacade/process_memory_allocator.hpp"
|
||||
#include "engine/datafacade_factory.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -21,8 +21,8 @@ template <typename AlgorithmT, template <typename A> class FacadeT> class DataFa
|
||||
|
||||
virtual ~DataFacadeProvider() = default;
|
||||
|
||||
virtual std::shared_ptr<const Facade> Get(const api::BaseParameters&) const = 0;
|
||||
virtual std::shared_ptr<const Facade> Get(const api::TileParameters&) const = 0;
|
||||
virtual std::shared_ptr<const Facade> Get(const api::BaseParameters &) const = 0;
|
||||
virtual std::shared_ptr<const Facade> Get(const api::TileParameters &) const = 0;
|
||||
};
|
||||
|
||||
template <typename AlgorithmT, template <typename A> class FacadeT>
|
||||
@@ -36,8 +36,14 @@ class ImmutableProvider final : public DataFacadeProvider<AlgorithmT, FacadeT>
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<const Facade> Get(const api::TileParameters ¶ms) const override final { return facade_factory.Get(params); }
|
||||
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const override final { return facade_factory.Get(params); }
|
||||
std::shared_ptr<const Facade> Get(const api::TileParameters ¶ms) const override final
|
||||
{
|
||||
return facade_factory.Get(params);
|
||||
}
|
||||
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const override final
|
||||
{
|
||||
return facade_factory.Get(params);
|
||||
}
|
||||
|
||||
private:
|
||||
DataFacadeFactory<FacadeT, AlgorithmT> facade_factory;
|
||||
@@ -51,8 +57,14 @@ class WatchingProvider : public DataFacadeProvider<AlgorithmT, FacadeT>
|
||||
public:
|
||||
using Facade = typename DataFacadeProvider<AlgorithmT, FacadeT>::Facade;
|
||||
|
||||
std::shared_ptr<const Facade> Get(const api::TileParameters ¶ms) const override final { return watchdog.Get(params); }
|
||||
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const override final { return watchdog.Get(params); }
|
||||
std::shared_ptr<const Facade> Get(const api::TileParameters ¶ms) const override final
|
||||
{
|
||||
return watchdog.Get(params);
|
||||
}
|
||||
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const override final
|
||||
{
|
||||
return watchdog.Get(params);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,7 @@ template <typename Algorithm> class Engine final : public EngineInterface
|
||||
static bool CheckCompability(const EngineConfig &config);
|
||||
|
||||
private:
|
||||
template<typename ParametersT>
|
||||
auto GetAlgorithms(const ParametersT ¶ms) const
|
||||
template <typename ParametersT> auto GetAlgorithms(const ParametersT ¶ms) const
|
||||
{
|
||||
return RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get(params)};
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ class BasePlugin
|
||||
});
|
||||
}
|
||||
|
||||
bool CheckAlgorithms(const api::BaseParameters ¶ms, const RoutingAlgorithmsInterface& algorithms, util::json::Object &result) const
|
||||
bool CheckAlgorithms(const api::BaseParameters ¶ms,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
util::json::Object &result) const
|
||||
{
|
||||
if (algorithms.IsValid())
|
||||
{
|
||||
@@ -55,7 +57,8 @@ class BasePlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOST_ASSERT_MSG(false, "There are only two reasons why the algorithm interface can be invalid.");
|
||||
BOOST_ASSERT_MSG(false,
|
||||
"There are only two reasons why the algorithm interface can be invalid.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,10 +134,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
|
||||
return routing_algorithms::HasAvoidFlags<Algorithm>::value;
|
||||
}
|
||||
|
||||
bool IsValid() const final override
|
||||
{
|
||||
return static_cast<bool>(facade);
|
||||
}
|
||||
bool IsValid() const final override { return static_cast<bool>(facade); }
|
||||
|
||||
private:
|
||||
SearchEngineData<Algorithm> &heaps;
|
||||
|
||||
Reference in New Issue
Block a user