MCPcopy Create free account
hub / github.com/PDAL/PDAL / read

Method read

io/CopcReader.cpp:879–908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

877
878
879point_count_t CopcReader::read(PointViewPtr view, point_count_t count)
880{
881 if (m_p->tileCount == 0)
882 return 0;
883
884 point_count_t numRead = 0;
885
886 // Pop tiles until there are no more, or wait for them to appear.
887 // Exit when we've handled all the tiles or we've read enough points.
888 // The mutex protects the tile queue (m_p->contents).
889 do
890 {
891 std::unique_lock<std::mutex> l(m_p->mutex);
892 if (m_p->contents.size())
893 {
894 copc::Tile tile = std::move(m_p->contents.front());
895 m_p->contents.pop();
896 m_p->consumedCv.notify_one();
897 l.unlock();
898 checkTile(tile);
899 process(view, tile, count - numRead);
900 numRead += tile.size();
901 m_p->tileCount--;
902 }
903 else
904 m_p->contentsCv.wait(l);
905 } while (m_p->tileCount && numRead <= count);
906
907 return numRead;
908}
909
910void CopcReader::checkTile(const copc::Tile& tile)
911{

Callers 1

loadMethod · 0.45

Calls 4

processFunction · 0.85
unlockMethod · 0.80
waitMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected