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

Method at

include/util/indexed_data.hpp:330–351  ·  view source on GitHub ↗

Return value at the given index

Source from the content-addressed store, hash-verified

328
329 // Return value at the given index
330 ResultType at(std::uint32_t index) const
331 {
332 if (values.empty())
333 return ResultType();
334
335 // Get block external ad internal indices
336 const BlocksNumberType block_idx = index / (BLOCK_SIZE + 1);
337 const std::uint32_t internal_idx = index % (BLOCK_SIZE + 1);
338
339 if (block_idx >= blocks.size())
340 return ResultType();
341
342 // Get block first and last iterators
343 auto first = values.begin() + blocks[block_idx].offset;
344 auto last = block_idx + 1 == blocks.size() ? values.end()
345 : values.begin() + blocks[block_idx + 1].offset;
346
347 const GroupBlockPolicy block;
348 block.ReadRefrencedBlock(blocks[block_idx], internal_idx, first, last);
349
350 return adapt(first, last);
351 }
352
353 friend void serialization::read<GroupBlockPolicy, Ownership>(storage::tar::FileReader &reader,
354 const std::string &name,

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
ReadRefrencedBlockMethod · 0.45

Tested by

no test coverage detected