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

Method AddUncompressedEdge

src/extractor/compressed_edge_container.cpp:201–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201void CompressedEdgeContainer::AddUncompressedEdge(const EdgeID edge_id,
202 const NodeID target_node_id,
203 const EdgeWeight weight,
204 const EdgeDuration duration)
205{
206 // remove super-trivial geometries
207 BOOST_ASSERT(SPECIAL_EDGEID != edge_id);
208 BOOST_ASSERT(SPECIAL_NODEID != target_node_id);
209 BOOST_ASSERT(INVALID_EDGE_WEIGHT != weight);
210 BOOST_ASSERT(INVALID_EDGE_DURATION != duration);
211
212 // Add via node id. List is created if it does not exist
213 if (!HasEntryForID(edge_id))
214 {
215 // create a new entry in the map
216 if (0 == m_free_list.size())
217 {
218 // make sure there is a place to put the entries
219 IncreaseFreeList();
220 }
221 BOOST_ASSERT(!m_free_list.empty());
222 m_edge_id_to_list_index_map[edge_id] = m_free_list.back();
223 m_free_list.pop_back();
224 }
225
226 // find bucket index
227 const auto iter = m_edge_id_to_list_index_map.find(edge_id);
228 BOOST_ASSERT(iter != m_edge_id_to_list_index_map.end());
229 const unsigned edge_bucket_id = iter->second;
230 BOOST_ASSERT(edge_bucket_id == GetPositionForID(edge_id));
231 BOOST_ASSERT(edge_bucket_id < m_compressed_oneway_geometries.size());
232
233 std::vector<OnewayCompressedEdge> &edge_bucket_list =
234 m_compressed_oneway_geometries[edge_bucket_id];
235
236 // note we don't save the start coordinate: it is implicitly given by edge_id
237 // weight is the distance to the (currently) last coordinate in the bucket
238 // Don't re-add this if it's already in there.
239 if (edge_bucket_list.empty())
240 {
241 edge_bucket_list.emplace_back(
242 OnewayCompressedEdge{target_node_id, ClipWeight(weight), ClipDuration(duration)});
243 }
244}
245
246void CompressedEdgeContainer::InitializeBothwayVector()
247{

Callers 1

CompressMethod · 0.80

Calls 5

sizeMethod · 0.45
emptyMethod · 0.45
backMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected