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

Method write

src/lasinterval.cpp:644–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642}
643
644BOOL LASinterval::write(ByteStreamOut* stream) const
645{
646 if (!stream->putBytes((const U8*)"LASV", 4))
647 {
648 laserror("(LASinterval): writing signature");
649 return FALSE;
650 }
651 U32 version = 0;
652 if (!stream->put32bitsLE((const U8*)&version))
653 {
654 laserror("(LASinterval): writing version");
655 return FALSE;
656 }
657 // write number of cells
658 U32 number_cells = (U32)((my_cell_hash*)cells)->size();
659 if (!stream->put32bitsLE((const U8*)&number_cells))
660 {
661 laserror("(LASinterval): writing number of cells %d", number_cells);
662 return FALSE;
663 }
664 // loop over all cells
665 my_cell_hash::iterator hash_element = ((my_cell_hash*)cells)->begin();
666 while (hash_element != ((my_cell_hash*)cells)->end())
667 {
668 LASintervalCell* cell = (*hash_element).second;
669#pragma warning(push)
670#pragma warning(disable : 6011)
671 // count number of intervals and points in cell
672 U32 number_intervals = 0;
673 U32 number_points = ((LASintervalStartCell*)cell)->full;
674#pragma warning(pop)
675 while (cell)
676 {
677 number_intervals++;
678 cell = cell->next;
679 }
680 // write index of cell
681 I32 cell_index = (*hash_element).first;
682 if (!stream->put32bitsLE((const U8*)&cell_index))
683 {
684 laserror("(LASinterval): writing cell index %d", cell_index);
685 return FALSE;
686 }
687 // write number of intervals in cell
688 if (!stream->put32bitsLE((const U8*)&number_intervals))
689 {
690 laserror("(LASinterval): writing number of intervals %d in cell", number_intervals);
691 return FALSE;
692 }
693 // write number of points in cell
694 if (!stream->put32bitsLE((const U8*)&number_points))
695 {
696 laserror("(LASinterval): writing number of points %d in cell", number_points);
697 return FALSE;
698 }
699 // write intervals
700 cell = (*hash_element).second;
701 while (cell)

Callers

nothing calls this directly

Calls 3

laserrorFunction · 0.85
putBytesMethod · 0.45
put32bitsLEMethod · 0.45

Tested by

no test coverage detected