Use ranges with fixed types
This commit is contained in:
committed by
Patrick Niklaus
parent
be123cd72f
commit
8d8042ebae
@@ -239,46 +239,46 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
|
||||
return m_osmnodeid_list[id];
|
||||
}
|
||||
|
||||
NodesIDRangeT GetUncompressedForwardGeometry(const EdgeID id) const override final
|
||||
NodeForwardRange GetUncompressedForwardGeometry(const EdgeID id) const override final
|
||||
{
|
||||
return segment_data.GetForwardGeometry(id);
|
||||
}
|
||||
|
||||
NodesIDRangeT GetUncompressedReverseGeometry(const EdgeID id) const override final
|
||||
NodeReverseRange GetUncompressedReverseGeometry(const EdgeID id) const override final
|
||||
{
|
||||
return segment_data.GetReverseGeometry(id);
|
||||
}
|
||||
|
||||
DurationsRangeT GetUncompressedForwardDurations(const EdgeID id) const override final
|
||||
DurationForwardRange GetUncompressedForwardDurations(const EdgeID id) const override final
|
||||
{
|
||||
return segment_data.GetForwardDurations(id);
|
||||
}
|
||||
|
||||
DurationsRangeT GetUncompressedReverseDurations(const EdgeID id) const override final
|
||||
DurationReverseRange GetUncompressedReverseDurations(const EdgeID id) const override final
|
||||
{
|
||||
return segment_data.GetReverseDurations(id);
|
||||
}
|
||||
|
||||
WeightsRangeT GetUncompressedForwardWeights(const EdgeID id) const override final
|
||||
WeightForwardRange GetUncompressedForwardWeights(const EdgeID id) const override final
|
||||
{
|
||||
return segment_data.GetForwardWeights(id);
|
||||
}
|
||||
|
||||
WeightsRangeT GetUncompressedReverseWeights(const EdgeID id) const override final
|
||||
WeightReverseRange GetUncompressedReverseWeights(const EdgeID id) const override final
|
||||
{
|
||||
return segment_data.GetReverseWeights(id);
|
||||
}
|
||||
|
||||
// Returns the data source ids that were used to supply the edge
|
||||
// weights.
|
||||
DatasourceIDRangeT GetUncompressedForwardDatasources(const EdgeID id) const override final
|
||||
DatasourceForwardRange GetUncompressedForwardDatasources(const EdgeID id) const override final
|
||||
{
|
||||
return segment_data.GetForwardDatasources(id);
|
||||
}
|
||||
|
||||
// Returns the data source ids that were used to supply the edge
|
||||
// weights.
|
||||
DatasourceIDRangeT GetUncompressedReverseDatasources(const EdgeID id) const override final
|
||||
DatasourceReverseRange GetUncompressedReverseDatasources(const EdgeID id) const override final
|
||||
{
|
||||
return segment_data.GetReverseDatasources(id);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "extractor/edge_based_node_segment.hpp"
|
||||
#include "extractor/maneuver_override.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/segment_data_container.hpp"
|
||||
#include "extractor/travel_mode.hpp"
|
||||
#include "extractor/turn_lane_types.hpp"
|
||||
|
||||
@@ -23,12 +24,14 @@
|
||||
#include "util/guidance/entry_class.hpp"
|
||||
#include "util/guidance/turn_lanes.hpp"
|
||||
#include "util/integer_range.hpp"
|
||||
#include "util/packed_vector.hpp"
|
||||
#include "util/string_util.hpp"
|
||||
#include "util/string_view.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "osrm/coordinate.hpp"
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/range/any_range.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
@@ -51,12 +54,21 @@ class BaseDataFacade
|
||||
public:
|
||||
using RTreeLeaf = extractor::EdgeBasedNodeSegment;
|
||||
|
||||
template <typename T>
|
||||
using RangeT = boost::any_range<T, boost::random_access_traversal_tag, const T, std::ptrdiff_t>;
|
||||
using NodesIDRangeT = RangeT<NodeID>;
|
||||
using WeightsRangeT = RangeT<SegmentWeight>;
|
||||
using DurationsRangeT = RangeT<SegmentDuration>;
|
||||
using DatasourceIDRangeT = RangeT<DatasourceID>;
|
||||
using NodeForwardRange =
|
||||
boost::iterator_range<extractor::SegmentDataView::SegmentNodeVector::const_iterator>;
|
||||
using NodeReverseRange = boost::reversed_range<const NodeForwardRange>;
|
||||
|
||||
using WeightForwardRange =
|
||||
boost::iterator_range<extractor::SegmentDataView::SegmentWeightVector::const_iterator>;
|
||||
using WeightReverseRange = boost::reversed_range<const WeightForwardRange>;
|
||||
|
||||
using DurationForwardRange =
|
||||
boost::iterator_range<extractor::SegmentDataView::SegmentDurationVector::const_iterator>;
|
||||
using DurationReverseRange = boost::reversed_range<const DurationForwardRange>;
|
||||
|
||||
using DatasourceForwardRange =
|
||||
boost::iterator_range<extractor::SegmentDataView::SegmentDatasourceVector::const_iterator>;
|
||||
using DatasourceReverseRange = boost::reversed_range<const DatasourceForwardRange>;
|
||||
|
||||
BaseDataFacade() {}
|
||||
virtual ~BaseDataFacade() {}
|
||||
@@ -72,8 +84,8 @@ class BaseDataFacade
|
||||
|
||||
virtual ComponentID GetComponentID(const NodeID id) const = 0;
|
||||
|
||||
virtual NodesIDRangeT GetUncompressedForwardGeometry(const EdgeID id) const = 0;
|
||||
virtual NodesIDRangeT GetUncompressedReverseGeometry(const EdgeID id) const = 0;
|
||||
virtual NodeForwardRange GetUncompressedForwardGeometry(const EdgeID id) const = 0;
|
||||
virtual NodeReverseRange GetUncompressedReverseGeometry(const EdgeID id) const = 0;
|
||||
|
||||
virtual TurnPenalty GetWeightPenaltyForEdgeID(const unsigned id) const = 0;
|
||||
|
||||
@@ -81,18 +93,18 @@ class BaseDataFacade
|
||||
|
||||
// Gets the weight values for each segment in an uncompressed geometry.
|
||||
// Should always be 1 shorter than GetUncompressedGeometry
|
||||
virtual WeightsRangeT GetUncompressedForwardWeights(const EdgeID id) const = 0;
|
||||
virtual WeightsRangeT GetUncompressedReverseWeights(const EdgeID id) const = 0;
|
||||
virtual WeightForwardRange GetUncompressedForwardWeights(const EdgeID id) const = 0;
|
||||
virtual WeightReverseRange GetUncompressedReverseWeights(const EdgeID id) const = 0;
|
||||
|
||||
// Gets the duration values for each segment in an uncompressed geometry.
|
||||
// Should always be 1 shorter than GetUncompressedGeometry
|
||||
virtual DurationsRangeT GetUncompressedForwardDurations(const EdgeID id) const = 0;
|
||||
virtual DurationsRangeT GetUncompressedReverseDurations(const EdgeID id) const = 0;
|
||||
virtual DurationForwardRange GetUncompressedForwardDurations(const EdgeID id) const = 0;
|
||||
virtual DurationReverseRange GetUncompressedReverseDurations(const EdgeID id) const = 0;
|
||||
|
||||
// Returns the data source ids that were used to supply the edge
|
||||
// weights. Will return an empty array when only the base profile is used.
|
||||
virtual DatasourceIDRangeT GetUncompressedForwardDatasources(const EdgeID id) const = 0;
|
||||
virtual DatasourceIDRangeT GetUncompressedReverseDatasources(const EdgeID id) const = 0;
|
||||
virtual DatasourceForwardRange GetUncompressedForwardDatasources(const EdgeID id) const = 0;
|
||||
virtual DatasourceReverseRange GetUncompressedReverseDatasources(const EdgeID id) const = 0;
|
||||
|
||||
// Gets the name of a datasource
|
||||
virtual StringView GetDatasourceName(const DatasourceID id) const = 0;
|
||||
|
||||
Reference in New Issue
Block a user