MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / GetRestrictions

Method GetRestrictions

src/extractor/way_restriction_map.cpp:44–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44std::vector<const TurnRestriction *>
45WayRestrictionMap::GetRestrictions(DuplicatedNodeID duplicated_node, const NodeID to) const
46{
47 std::vector<const TurnRestriction *> result;
48 // Fetch all restrictions that will restrict a turn to 'to'.
49 BOOST_ASSERT(duplicated_node < restriction_graph.num_via_nodes);
50 const auto &restrictions = restriction_graph.GetRestrictions(duplicated_node);
51 std::copy_if(restrictions.begin(),
52 restrictions.end(),
53 std::back_inserter(result),
54 [&to](const auto &restriction) { return restriction->IsTurnRestricted(to); });
55 if (result.empty())
56 {
57 throw(
58 "Asking for the restriction of an unrestricted turn. Check with `IsRestricted` before "
59 "calling GetRestriction");
60 }
61 return result;
62}
63
64std::vector<WayRestrictionMap::ViaEdge> WayRestrictionMap::DuplicatedViaEdges() const
65{

Callers 1

IsRestrictedMethod · 0.45

Calls 4

IsTurnRestrictedMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected