MCPcopy Create free account
hub / github.com/LAStools/LAStools / write_chunk_table

Method write_chunk_table

LASzip/src/laswritepoint.cpp:459–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459BOOL LASwritePoint::write_chunk_table()
460{
461 U32 i;
462 I64 position = outstream->tell();
463 if (chunk_table_start_position != -1) // stream is seekable
464 {
465 if (!outstream->seek(chunk_table_start_position))
466 {
467 return FALSE;
468 }
469 if (!outstream->put64bitsLE((U8*)&position))
470 {
471 return FALSE;
472 }
473 if (!outstream->seek(position))
474 {
475 return FALSE;
476 }
477 }
478 U32 version = 0;
479 if (!outstream->put32bitsLE((U8*)&version))
480 {
481 return FALSE;
482 }
483 if (!outstream->put32bitsLE((U8*)&number_chunks))
484 {
485 return FALSE;
486 }
487 if (number_chunks > 0)
488 {
489 enc->init(outstream);
490 IntegerCompressor ic(enc, 32, 2);
491 ic.initCompressor();
492 for (i = 0; i < number_chunks; i++)
493 {
494 if (chunk_size == U32_MAX) ic.compress((i ? chunk_sizes[i-1] : 0), chunk_sizes[i], 0);
495 ic.compress((i ? chunk_bytes[i-1] : 0), chunk_bytes[i], 1);
496 }
497 enc->done();
498 }
499 if (chunk_table_start_position == -1) // stream is not-seekable
500 {
501 if (!outstream->put64bitsLE((U8*)&position))
502 {
503 return FALSE;
504 }
505 }
506 return TRUE;
507}
508
509LASwritePoint::~LASwritePoint()
510{

Callers

nothing calls this directly

Calls 8

initCompressorMethod · 0.80
compressMethod · 0.80
tellMethod · 0.45
seekMethod · 0.45
put64bitsLEMethod · 0.45
put32bitsLEMethod · 0.45
initMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected