Fix clang format
This commit is contained in:
parent
bd6492bb38
commit
6339395cba
@ -4,8 +4,8 @@
|
|||||||
#include "storage/io_fwd.hpp"
|
#include "storage/io_fwd.hpp"
|
||||||
#include "storage/shared_memory_ownership.hpp"
|
#include "storage/shared_memory_ownership.hpp"
|
||||||
|
|
||||||
#include "util/vector_view.hpp"
|
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
#include "util/vector_view.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -25,7 +25,6 @@ template <storage::Ownership Ownership> struct CellMetricImpl
|
|||||||
|
|
||||||
using CellMetric = detail::CellMetricImpl<storage::Ownership::Container>;
|
using CellMetric = detail::CellMetricImpl<storage::Ownership::Container>;
|
||||||
using CellMetricView = detail::CellMetricImpl<storage::Ownership::View>;
|
using CellMetricView = detail::CellMetricImpl<storage::Ownership::View>;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,11 @@ namespace customizer
|
|||||||
struct CustomizationConfig final : storage::IOConfig
|
struct CustomizationConfig final : storage::IOConfig
|
||||||
{
|
{
|
||||||
CustomizationConfig()
|
CustomizationConfig()
|
||||||
: IOConfig({".osrm.ebg", ".osrm.partition", ".osrm.cells", ".osrm.ebg_nodes", ".osrm.properties"},
|
: IOConfig({".osrm.ebg",
|
||||||
|
".osrm.partition",
|
||||||
|
".osrm.cells",
|
||||||
|
".osrm.ebg_nodes",
|
||||||
|
".osrm.properties"},
|
||||||
{},
|
{},
|
||||||
{".osrm.cell_metrics", ".osrm.mldgr"}),
|
{".osrm.cell_metrics", ".osrm.mldgr"}),
|
||||||
requested_num_threads(0)
|
requested_num_threads(0)
|
||||||
|
@ -28,7 +28,7 @@ inline void readCellMetrics(const boost::filesystem::path &path, std::vector<Cel
|
|||||||
auto num_metrics = reader.ReadElementCount64();
|
auto num_metrics = reader.ReadElementCount64();
|
||||||
metrics.resize(num_metrics);
|
metrics.resize(num_metrics);
|
||||||
|
|
||||||
for (auto& metric : metrics)
|
for (auto &metric : metrics)
|
||||||
{
|
{
|
||||||
serialization::read(reader, metric);
|
serialization::read(reader, metric);
|
||||||
}
|
}
|
||||||
@ -36,7 +36,8 @@ inline void readCellMetrics(const boost::filesystem::path &path, std::vector<Cel
|
|||||||
|
|
||||||
// writes .osrm.cell_metrics file
|
// writes .osrm.cell_metrics file
|
||||||
template <typename CellMetricT>
|
template <typename CellMetricT>
|
||||||
inline void writeCellMetrics(const boost::filesystem::path &path, const std::vector<CellMetricT> &metrics)
|
inline void writeCellMetrics(const boost::filesystem::path &path,
|
||||||
|
const std::vector<CellMetricT> &metrics)
|
||||||
{
|
{
|
||||||
static_assert(std::is_same<CellMetricView, CellMetricT>::value ||
|
static_assert(std::is_same<CellMetricView, CellMetricT>::value ||
|
||||||
std::is_same<CellMetric, CellMetricT>::value,
|
std::is_same<CellMetric, CellMetricT>::value,
|
||||||
@ -46,12 +47,11 @@ inline void writeCellMetrics(const boost::filesystem::path &path, const std::vec
|
|||||||
storage::io::FileWriter writer{path, fingerprint};
|
storage::io::FileWriter writer{path, fingerprint};
|
||||||
|
|
||||||
writer.WriteElementCount64(metrics.size());
|
writer.WriteElementCount64(metrics.size());
|
||||||
for (const auto& metric : metrics)
|
for (const auto &metric : metrics)
|
||||||
{
|
{
|
||||||
serialization::write(writer, metric);
|
serialization::write(writer, metric);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,10 +88,16 @@ struct RouteParameters : public BaseParameters
|
|||||||
const OverviewType overview_,
|
const OverviewType overview_,
|
||||||
const boost::optional<bool> continue_straight_,
|
const boost::optional<bool> continue_straight_,
|
||||||
Args... args_)
|
Args... args_)
|
||||||
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one below.
|
// Once we perfectly-forward `args` (see #2990) this constructor can delegate to the one
|
||||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
// below.
|
||||||
number_of_alternatives{alternatives_ ? 1u : 0u}, annotations{false},
|
: BaseParameters{std::forward<Args>(args_)...},
|
||||||
annotations_type{AnnotationsType::None}, geometries{geometries_}, overview{overview_},
|
steps{steps_},
|
||||||
|
alternatives{alternatives_},
|
||||||
|
number_of_alternatives{alternatives_ ? 1u : 0u},
|
||||||
|
annotations{false},
|
||||||
|
annotations_type{AnnotationsType::None},
|
||||||
|
geometries{geometries_},
|
||||||
|
overview{overview_},
|
||||||
continue_straight{continue_straight_}
|
continue_straight{continue_straight_}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ namespace osrm
|
|||||||
namespace engine
|
namespace engine
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
// We need this wrapper type since template-template specilization of FacadeT is broken on clang
|
// 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.
|
// See https://godbolt.org/g/ZS6Xmt for an example.
|
||||||
template <typename AlgorithmT, typename FacadeT> class DataWatchdogImpl;
|
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 mutex_type = typename storage::SharedMonitor<storage::SharedDataTimestamp>::mutex_type;
|
||||||
using Facade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
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());
|
boost::interprocess::scoped_lock<mutex_type> current_region_lock(barrier.get_mutex());
|
||||||
|
|
||||||
facade_factory = DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
facade_factory =
|
||||||
std::make_shared<datafacade::SharedMemoryAllocator>(barrier.data().region));
|
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||||
|
std::make_shared<datafacade::SharedMemoryAllocator>(barrier.data().region));
|
||||||
timestamp = barrier.data().timestamp;
|
timestamp = barrier.data().timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,8 +58,14 @@ template <typename AlgorithmT> class DataWatchdogImpl<AlgorithmT, datafacade::Co
|
|||||||
watcher.join();
|
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::BaseParameters ¶ms) const
|
||||||
std::shared_ptr<const Facade> Get(const api::TileParameters ¶ms) const { return facade_factory.Get(params); }
|
{
|
||||||
|
return facade_factory.Get(params);
|
||||||
|
}
|
||||||
|
std::shared_ptr<const Facade> Get(const api::TileParameters ¶ms) const
|
||||||
|
{
|
||||||
|
return facade_factory.Get(params);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Run()
|
void Run()
|
||||||
@ -75,8 +82,9 @@ template <typename AlgorithmT> class DataWatchdogImpl<AlgorithmT, datafacade::Co
|
|||||||
if (timestamp != barrier.data().timestamp)
|
if (timestamp != barrier.data().timestamp)
|
||||||
{
|
{
|
||||||
auto region = barrier.data().region;
|
auto region = barrier.data().region;
|
||||||
facade_factory = DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
facade_factory =
|
||||||
std::make_shared<datafacade::SharedMemoryAllocator>(region));
|
DataFacadeFactory<datafacade::ContiguousInternalMemoryDataFacade, AlgorithmT>(
|
||||||
|
std::make_shared<datafacade::SharedMemoryAllocator>(region));
|
||||||
timestamp = barrier.data().timestamp;
|
timestamp = barrier.data().timestamp;
|
||||||
util::Log() << "updated facade to region " << region << " with timestamp "
|
util::Log() << "updated facade to region " << region << " with timestamp "
|
||||||
<< 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
|
// 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
|
// the data and layout regions that should be used. This region is updated
|
||||||
// once a new dataset arrives.
|
// 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;
|
using DataFacadeBase = datafacade::ContiguousInternalMemoryDataFacadeBase;
|
||||||
template <typename AlgorithmT>
|
template <typename AlgorithmT>
|
||||||
using DataFacade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
using DataFacade = datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT>;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
// allocator that keeps the allocation data
|
// allocator that keeps the allocation data
|
||||||
std::shared_ptr<ContiguousBlockAllocator> allocator;
|
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>(
|
m_profile_properties = data_layout.GetBlockPtr<extractor::ProfileProperties>(
|
||||||
memory_block, storage::DataLayout::PROPERTIES);
|
memory_block, storage::DataLayout::PROPERTIES);
|
||||||
@ -542,7 +544,9 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
m_entry_class_table = std::move(entry_class_table);
|
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);
|
InitializeChecksumPointer(data_layout, memory_block);
|
||||||
InitializeNodeInformationPointers(data_layout, memory_block);
|
InitializeNodeInformationPointers(data_layout, memory_block);
|
||||||
@ -561,7 +565,8 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
public:
|
public:
|
||||||
// allows switching between process_memory/shared_memory datafacade, based on the type of
|
// allows switching between process_memory/shared_memory datafacade, based on the type of
|
||||||
// allocator
|
// 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_))
|
: allocator(std::move(allocator_))
|
||||||
{
|
{
|
||||||
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory(), avoid_index);
|
InitializeInternalPointers(allocator->GetLayout(), allocator->GetMemory(), avoid_index);
|
||||||
@ -924,7 +929,6 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
|||||||
{
|
{
|
||||||
return m_profile_properties->left_hand_driving;
|
return m_profile_properties->left_hand_driving;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename AlgorithmT> class ContiguousInternalMemoryDataFacade;
|
template <typename AlgorithmT> class ContiguousInternalMemoryDataFacade;
|
||||||
@ -1028,7 +1032,7 @@ template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public Algo
|
|||||||
util::vector_view<EdgeDuration> durations(mld_cell_durations_ptr,
|
util::vector_view<EdgeDuration> durations(mld_cell_durations_ptr,
|
||||||
duration_entries_count);
|
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)
|
if (data_layout.GetBlockSize(storage::DataLayout::MLD_CELLS) > 0)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef OSRM_ENGINE_DATAFACADE_PROVIDER_HPP
|
#ifndef OSRM_ENGINE_DATAFACADE_PROVIDER_HPP
|
||||||
#define OSRM_ENGINE_DATAFACADE_PROVIDER_HPP
|
#define OSRM_ENGINE_DATAFACADE_PROVIDER_HPP
|
||||||
|
|
||||||
#include "engine/datafacade_factory.hpp"
|
|
||||||
#include "engine/data_watchdog.hpp"
|
#include "engine/data_watchdog.hpp"
|
||||||
#include "engine/datafacade.hpp"
|
#include "engine/datafacade.hpp"
|
||||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||||
#include "engine/datafacade/process_memory_allocator.hpp"
|
#include "engine/datafacade/process_memory_allocator.hpp"
|
||||||
|
#include "engine/datafacade_factory.hpp"
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
{
|
{
|
||||||
@ -21,8 +21,8 @@ template <typename AlgorithmT, template <typename A> class FacadeT> class DataFa
|
|||||||
|
|
||||||
virtual ~DataFacadeProvider() = default;
|
virtual ~DataFacadeProvider() = default;
|
||||||
|
|
||||||
virtual std::shared_ptr<const Facade> Get(const api::BaseParameters&) 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;
|
virtual std::shared_ptr<const Facade> Get(const api::TileParameters &) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename AlgorithmT, template <typename A> class FacadeT>
|
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::TileParameters ¶ms) const override final
|
||||||
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const override final { return facade_factory.Get(params); }
|
{
|
||||||
|
return facade_factory.Get(params);
|
||||||
|
}
|
||||||
|
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const override final
|
||||||
|
{
|
||||||
|
return facade_factory.Get(params);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DataFacadeFactory<FacadeT, AlgorithmT> facade_factory;
|
DataFacadeFactory<FacadeT, AlgorithmT> facade_factory;
|
||||||
@ -51,8 +57,14 @@ class WatchingProvider : public DataFacadeProvider<AlgorithmT, FacadeT>
|
|||||||
public:
|
public:
|
||||||
using Facade = typename DataFacadeProvider<AlgorithmT, FacadeT>::Facade;
|
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::TileParameters ¶ms) const override final
|
||||||
std::shared_ptr<const Facade> Get(const api::BaseParameters ¶ms) const override final { return watchdog.Get(params); }
|
{
|
||||||
|
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);
|
static bool CheckCompability(const EngineConfig &config);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename ParametersT>
|
template <typename ParametersT> auto GetAlgorithms(const ParametersT ¶ms) const
|
||||||
auto GetAlgorithms(const ParametersT ¶ms) const
|
|
||||||
{
|
{
|
||||||
return RoutingAlgorithms<Algorithm>{heaps, facade_provider->Get(params)};
|
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())
|
if (algorithms.IsValid())
|
||||||
{
|
{
|
||||||
@ -55,7 +57,8 @@ class BasePlugin
|
|||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,10 +134,7 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
|
|||||||
return routing_algorithms::HasAvoidFlags<Algorithm>::value;
|
return routing_algorithms::HasAvoidFlags<Algorithm>::value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsValid() const final override
|
bool IsValid() const final override { return static_cast<bool>(facade); }
|
||||||
{
|
|
||||||
return static_cast<bool>(facade);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SearchEngineData<Algorithm> &heaps;
|
SearchEngineData<Algorithm> &heaps;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/numeric/conversion/cast.hpp>
|
#include <boost/numeric/conversion/cast.hpp>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -91,9 +91,10 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
WeightValueT,
|
WeightValueT,
|
||||||
boost::random_access_traversal_tag>
|
boost::random_access_traversal_tag>
|
||||||
{
|
{
|
||||||
typedef boost::
|
typedef boost::iterator_facade<ColumnIterator,
|
||||||
iterator_facade<ColumnIterator, WeightValueT, boost::random_access_traversal_tag>
|
WeightValueT,
|
||||||
base_t;
|
boost::random_access_traversal_tag>
|
||||||
|
base_t;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename base_t::value_type value_type;
|
typedef typename base_t::value_type value_type;
|
||||||
@ -178,8 +179,8 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
const NodeID *const all_destinations)
|
const NodeID *const all_destinations)
|
||||||
: num_source_nodes{data.num_source_nodes},
|
: num_source_nodes{data.num_source_nodes},
|
||||||
num_destination_nodes{data.num_destination_nodes},
|
num_destination_nodes{data.num_destination_nodes},
|
||||||
weights{all_weights + data.value_offset}, durations{all_durations +
|
weights{all_weights + data.value_offset},
|
||||||
data.value_offset},
|
durations{all_durations + data.value_offset},
|
||||||
source_boundary{all_sources + data.source_boundary_offset},
|
source_boundary{all_sources + data.source_boundary_offset},
|
||||||
destination_boundary{all_destinations + data.destination_boundary_offset}
|
destination_boundary{all_destinations + data.destination_boundary_offset}
|
||||||
{
|
{
|
||||||
@ -338,7 +339,7 @@ template <storage::Ownership Ownership> class CellStorageImpl
|
|||||||
|
|
||||||
const auto &last_cell = cells.back();
|
const auto &last_cell = cells.back();
|
||||||
ValueOffset total_size = cells.back().value_offset +
|
ValueOffset total_size = cells.back().value_offset +
|
||||||
last_cell.num_source_nodes * last_cell.num_destination_nodes;
|
last_cell.num_source_nodes * last_cell.num_destination_nodes;
|
||||||
|
|
||||||
metric.weights.resize(total_size + 1, INVALID_EDGE_WEIGHT);
|
metric.weights.resize(total_size + 1, INVALID_EDGE_WEIGHT);
|
||||||
metric.durations.resize(total_size + 1, MAXIMAL_EDGE_DURATION);
|
metric.durations.resize(total_size + 1, MAXIMAL_EDGE_DURATION);
|
||||||
|
@ -43,10 +43,10 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
|
|||||||
using EdgeOffset = std::uint8_t;
|
using EdgeOffset = std::uint8_t;
|
||||||
|
|
||||||
MultiLevelGraph() = default;
|
MultiLevelGraph() = default;
|
||||||
MultiLevelGraph(MultiLevelGraph&&) = default;
|
MultiLevelGraph(MultiLevelGraph &&) = default;
|
||||||
MultiLevelGraph(const MultiLevelGraph&) = default;
|
MultiLevelGraph(const MultiLevelGraph &) = default;
|
||||||
MultiLevelGraph& operator=(MultiLevelGraph&&) = default;
|
MultiLevelGraph &operator=(MultiLevelGraph &&) = default;
|
||||||
MultiLevelGraph& operator=(const MultiLevelGraph&) = default;
|
MultiLevelGraph &operator=(const MultiLevelGraph &) = default;
|
||||||
|
|
||||||
MultiLevelGraph(Vector<typename SuperT::NodeArrayEntry> node_array_,
|
MultiLevelGraph(Vector<typename SuperT::NodeArrayEntry> node_array_,
|
||||||
Vector<typename SuperT::EdgeArrayEntry> edge_array_,
|
Vector<typename SuperT::EdgeArrayEntry> edge_array_,
|
||||||
|
@ -69,7 +69,6 @@ inline void write(storage::io::FileWriter &writer,
|
|||||||
storage::serialization::write(writer, storage.cells);
|
storage::serialization::write(writer, storage.cells);
|
||||||
storage::serialization::write(writer, storage.level_to_cell_offset);
|
storage::serialization::write(writer, storage.level_to_cell_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,8 @@ void SetAvoidableClasses(const ExtractorCallbacks::ClassesMap &classes_map,
|
|||||||
{
|
{
|
||||||
if (avoidable_classes.size() > MAX_AVOIDABLE_CLASSES)
|
if (avoidable_classes.size() > MAX_AVOIDABLE_CLASSES)
|
||||||
{
|
{
|
||||||
throw util::exception("Only " + std::to_string(MAX_AVOIDABLE_CLASSES) + " avoidable combinations allowed.");
|
throw util::exception("Only " + std::to_string(MAX_AVOIDABLE_CLASSES) +
|
||||||
|
" avoidable combinations allowed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// The avoid index 0 is reserve for not avoiding anything
|
// The avoid index 0 is reserve for not avoiding anything
|
||||||
|
@ -712,7 +712,8 @@ Sol2ScriptingEnvironment::GetStringListsFromTable(const std::string &table_name)
|
|||||||
sol::table inner_table = pair.second;
|
sol::table inner_table = pair.second;
|
||||||
if (!inner_table.valid())
|
if (!inner_table.valid())
|
||||||
{
|
{
|
||||||
throw util::exception("Expected a sub-table at " + table_name + "[" + pair.first.as<std::string>() + "]");
|
throw util::exception("Expected a sub-table at " + table_name + "[" +
|
||||||
|
pair.first.as<std::string>() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> inner_vector;
|
std::vector<std::string> inner_vector;
|
||||||
|
@ -291,30 +291,9 @@ BOOST_AUTO_TEST_CASE(avoid_test)
|
|||||||
// 2 ----3 --- 4 --- 7
|
// 2 ----3 --- 4 --- 7
|
||||||
// \__________/
|
// \__________/
|
||||||
std::vector<MockEdge> edges = {
|
std::vector<MockEdge> edges = {
|
||||||
{0, 1, 1},
|
{0, 1, 1}, {0, 2, 1}, {1, 0, 1}, {1, 2, 10}, {1, 3, 1}, {1, 5, 1}, {2, 0, 1}, {2, 1, 10},
|
||||||
{0, 2, 1},
|
{2, 3, 1}, {2, 4, 1}, {3, 1, 1}, {3, 2, 1}, {3, 4, 1}, {4, 2, 1}, {4, 3, 1}, {4, 5, 1},
|
||||||
{1, 0, 1},
|
{4, 7, 1}, {5, 1, 1}, {5, 4, 1}, {5, 6, 1}, {6, 5, 1}, {6, 7, 1}, {7, 4, 1}, {7, 6, 1},
|
||||||
{1, 2, 10},
|
|
||||||
{1, 3, 1},
|
|
||||||
{1, 5, 1},
|
|
||||||
{2, 0, 1},
|
|
||||||
{2, 1, 10},
|
|
||||||
{2, 3, 1},
|
|
||||||
{2, 4, 1},
|
|
||||||
{3, 1, 1},
|
|
||||||
{3, 2, 1},
|
|
||||||
{3, 4, 1},
|
|
||||||
{4, 2, 1},
|
|
||||||
{4, 3, 1},
|
|
||||||
{4, 5, 1},
|
|
||||||
{4, 7, 1},
|
|
||||||
{5, 1, 1},
|
|
||||||
{5, 4, 1},
|
|
||||||
{5, 6, 1},
|
|
||||||
{6, 5, 1},
|
|
||||||
{6, 7, 1},
|
|
||||||
{7, 4, 1},
|
|
||||||
{7, 6, 1},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// node: 0 1 2 3 4 5 6 7
|
// node: 0 1 2 3 4 5 6 7
|
||||||
@ -417,10 +396,12 @@ BOOST_AUTO_TEST_CASE(avoid_test)
|
|||||||
|
|
||||||
CHECK_EQUAL_RANGE(cell_2_0.GetOutWeight(1), 0, 10, INVALID_EDGE_WEIGHT);
|
CHECK_EQUAL_RANGE(cell_2_0.GetOutWeight(1), 0, 10, INVALID_EDGE_WEIGHT);
|
||||||
CHECK_EQUAL_RANGE(cell_2_0.GetOutWeight(2), 10, 0, INVALID_EDGE_WEIGHT);
|
CHECK_EQUAL_RANGE(cell_2_0.GetOutWeight(2), 10, 0, INVALID_EDGE_WEIGHT);
|
||||||
CHECK_EQUAL_RANGE(cell_2_0.GetOutWeight(3), INVALID_EDGE_WEIGHT, INVALID_EDGE_WEIGHT, INVALID_EDGE_WEIGHT);
|
CHECK_EQUAL_RANGE(
|
||||||
|
cell_2_0.GetOutWeight(3), INVALID_EDGE_WEIGHT, INVALID_EDGE_WEIGHT, INVALID_EDGE_WEIGHT);
|
||||||
CHECK_EQUAL_RANGE(cell_2_0.GetInWeight(1), 0, 10, INVALID_EDGE_WEIGHT);
|
CHECK_EQUAL_RANGE(cell_2_0.GetInWeight(1), 0, 10, INVALID_EDGE_WEIGHT);
|
||||||
CHECK_EQUAL_RANGE(cell_2_0.GetInWeight(2), 10, 0, INVALID_EDGE_WEIGHT);
|
CHECK_EQUAL_RANGE(cell_2_0.GetInWeight(2), 10, 0, INVALID_EDGE_WEIGHT);
|
||||||
CHECK_EQUAL_RANGE(cell_2_0.GetInWeight(3), INVALID_EDGE_WEIGHT, INVALID_EDGE_WEIGHT, INVALID_EDGE_WEIGHT);
|
CHECK_EQUAL_RANGE(
|
||||||
|
cell_2_0.GetInWeight(3), INVALID_EDGE_WEIGHT, INVALID_EDGE_WEIGHT, INVALID_EDGE_WEIGHT);
|
||||||
|
|
||||||
CHECK_EQUAL_RANGE(cell_2_1.GetOutWeight(4), 0, 1);
|
CHECK_EQUAL_RANGE(cell_2_1.GetOutWeight(4), 0, 1);
|
||||||
CHECK_EQUAL_RANGE(cell_2_1.GetOutWeight(5), 1, 0);
|
CHECK_EQUAL_RANGE(cell_2_1.GetOutWeight(5), 1, 0);
|
||||||
|
@ -104,7 +104,6 @@ struct ExternalCellStorage
|
|||||||
ConstCell GetCell(ExternalCellMetric, LevelID /*level*/, CellID /*id*/) const { return Cell{}; }
|
ConstCell GetCell(ExternalCellMetric, LevelID /*level*/, CellID /*id*/) const { return Cell{}; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Define external data facade
|
// Define external data facade
|
||||||
template <>
|
template <>
|
||||||
class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm> final
|
class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm> final
|
||||||
|
@ -28,7 +28,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
|
|||||||
using StringView = util::StringView;
|
using StringView = util::StringView;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool AvoidNode(const NodeID ) const override { return false; };
|
bool AvoidNode(const NodeID) const override { return false; };
|
||||||
|
|
||||||
util::Coordinate GetCoordinateOfNode(const NodeID /* id */) const override
|
util::Coordinate GetCoordinateOfNode(const NodeID /* id */) const override
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ BOOST_AUTO_TEST_CASE(immutable_cell_storage)
|
|||||||
|
|
||||||
// test const storage
|
// test const storage
|
||||||
const CellStorage const_storage(mlp, graph);
|
const CellStorage const_storage(mlp, graph);
|
||||||
const auto metric =const_storage.MakeMetric();
|
const auto metric = const_storage.MakeMetric();
|
||||||
|
|
||||||
auto const_cell_1_0 = const_storage.GetCell(metric, 1, 0);
|
auto const_cell_1_0 = const_storage.GetCell(metric, 1, 0);
|
||||||
auto const_cell_1_1 = const_storage.GetCell(metric, 1, 1);
|
auto const_cell_1_1 = const_storage.GetCell(metric, 1, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user