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

Function insertRestriction

src/extractor/restriction_graph.cpp:30–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30void insertRestriction(RestrictionGraph &rg,
31 const RestrictionID id,
32 const TurnRestriction *restriction)
33{
34 const auto range = rg.GetRestrictions(id);
35 auto &node = rg.nodes[id];
36 if (node.restrictions_begin_idx + range.size() != rg.restrictions.size())
37 {
38 // Most nodes will only have zero or one restriction, so this copy will be infrequent
39 node.restrictions_begin_idx = rg.restrictions.size();
40 std::copy(range.begin(), range.end(), std::back_inserter(rg.restrictions));
41 }
42 rg.restrictions.push_back(restriction);
43 node.num_restrictions += 1;
44}
45
46RestrictionID getOrInsertStartNode(RestrictionGraph &rg, NodeID from, NodeID to)
47{

Callers 2

endMethod · 0.85
nextMethod · 0.85

Calls 6

copyFunction · 0.85
GetRestrictionsMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected