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

Function streamTest

test/unit/io/LasReaderTest.cpp:473–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471}
472
473void streamTest(const std::string src)
474{
475 Options ops1;
476 ops1.add("filename", src);
477
478 LasReader lasReader;
479 lasReader.setOptions(ops1);
480
481 PointTable t;
482 lasReader.prepare(t);
483 PointViewSet s = lasReader.execute(t);
484
485 PointViewPtr p = *s.begin();
486
487 class Checker : public Filter, public Streamable
488 {
489 public:
490 std::string getName() const
491 { return "checker"; }
492 Checker(PointViewPtr v) : m_cnt(0), m_view(v),
493 m_bulkBuf(v->pointSize()), m_buf(v->pointSize()),
494 m_dims(v->dimTypes())
495 {}
496 private:
497 point_count_t m_cnt;
498 PointViewPtr m_view;
499 std::vector<char> m_bulkBuf;
500 std::vector<char> m_buf;
501 DimTypeList m_dims;
502
503 bool processOne(PointRef& point)
504 {
505 PointRef bulkPoint = m_view->point(m_cnt);
506
507 bulkPoint.getPackedData(m_dims, m_bulkBuf.data());
508 point.getPackedData(m_dims, m_buf.data());
509 EXPECT_EQ(memcmp(m_buf.data(), m_bulkBuf.data(),
510 m_view->pointSize()), 0);
511 m_cnt++;
512 return true;
513 }
514
515 void done(PointTableRef)
516 {
517 EXPECT_EQ(m_cnt, 110000u);
518 }
519 };
520
521 Options ops2;
522 ops2.add("filename", Support::datapath("las/autzen_trim.las"));
523
524 LasReader lazReader;
525 lazReader.setOptions(ops2);
526
527 Checker c(p);
528 c.setInput(lazReader);
529
530 FixedPointTable fixed(100);

Callers 1

TESTFunction · 0.70

Calls 6

datapathFunction · 0.85
setOptionsMethod · 0.80
addMethod · 0.45
prepareMethod · 0.45
executeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected