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

Function getOrInsertStartNode

src/extractor/restriction_graph.cpp:46–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46RestrictionID getOrInsertStartNode(RestrictionGraph &rg, NodeID from, NodeID to)
47{
48 auto start_edge = std::make_pair(from, to);
49 auto start_node_idx_itr = rg.start_edge_to_node.find(start_edge);
50 if (start_node_idx_itr == rg.start_edge_to_node.end())
51 {
52 // First time we have seen a restriction start from this edge.
53 auto start_node_idx = rg.nodes.size();
54 rg.nodes.push_back(RestrictionNode{rg.restrictions.size(), 0, rg.edges.size(), 0});
55 start_node_idx_itr = rg.start_edge_to_node.insert({start_edge, start_node_idx}).first;
56 }
57 return start_node_idx_itr->second;
58}
59
60RestrictionID insertViaNode(RestrictionGraph &rg, NodeID from, NodeID to)
61{

Callers 2

startMethod · 0.85
startMethod · 0.85

Calls 4

insertMethod · 0.80
endMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected