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

Method read

src/lasinterval.cpp:560–642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558}
559
560BOOL LASinterval::read(ByteStreamIn* stream)
561{
562 char signature[4];
563 try { stream->getBytes((U8*)signature, 4); } catch (...)
564 {
565 laserror("(LASinterval): reading signature");
566 return FALSE;
567 }
568 if (strncmp(signature, "LASV", 4) != 0)
569 {
570 laserror("(LASinterval): wrong signature %4s instead of 'LASV'", signature);
571 return FALSE;
572 }
573 U32 version;
574 try { stream->get32bitsLE((U8*)&version); } catch (...)
575 {
576 laserror("(LASinterval): reading version");
577 return FALSE;
578 }
579 // read number of cells
580 U32 number_cells;
581 try { stream->get32bitsLE((U8*)&number_cells); } catch (...)
582 {
583 laserror("(LASinterval): reading number of cells");
584 return FALSE;
585 }
586 // loop over all cells
587 while (number_cells)
588 {
589 // read index of cell
590 I32 cell_index;
591 try { stream->get32bitsLE((U8*)&cell_index); } catch (...)
592 {
593 laserror("(LASinterval): reading cell index");
594 return FALSE;
595 }
596 // create cell and insert into hash
597 LASintervalStartCell* start_cell = new LASintervalStartCell();
598 ((my_cell_hash*)cells)->insert(my_cell_hash::value_type(cell_index, start_cell));
599 LASintervalCell* cell = start_cell;
600 // read number of intervals in cell
601 U32 number_intervals;
602 try { stream->get32bitsLE((U8*)&number_intervals); } catch (...)
603 {
604 laserror("(LASinterval): reading number of intervals in cell");
605 return FALSE;
606 }
607 // read number of points in cell
608 U32 number_points;
609 try { stream->get32bitsLE((U8*)&number_points); } catch (...)
610 {
611 laserror("(LASinterval): reading number of points in cell");
612 return FALSE;
613 }
614 start_cell->full = number_points;
615 start_cell->total = 0;
616 while (number_intervals)
617 {

Callers

nothing calls this directly

Calls 3

laserrorFunction · 0.85
getBytesMethod · 0.45
get32bitsLEMethod · 0.45

Tested by

no test coverage detected