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

Method BlobNodeImpl

plugins/e57/libE57Format/src/BlobNodeImpl.cpp:36–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34namespace e57
35{
36 BlobNodeImpl::BlobNodeImpl( ImageFileImplWeakPtr destImageFile, int64_t byteCount ) :
37 NodeImpl( destImageFile )
38 {
39 // don't checkImageFileOpen, NodeImpl() will do it
40
41 ImageFileImplSharedPtr imf( destImageFile );
42
43 // This what caller thinks blob length is
44 blobLogicalLength_ = byteCount;
45
46 // Round segment length up to multiple of 4 bytes
47 binarySectionLogicalLength_ = sizeof( BlobSectionHeader ) + blobLogicalLength_;
48 unsigned remainder = binarySectionLogicalLength_ % 4;
49 if ( remainder > 0 )
50 {
51 binarySectionLogicalLength_ += 4 - remainder;
52 }
53
54 // Reserve space for blob in file, extend with zeros since writes will
55 // happen at later time by caller
56 binarySectionLogicalStart_ = imf->allocateSpace( binarySectionLogicalLength_, true );
57
58 // Prepare BlobSectionHeader
59 BlobSectionHeader header;
60 header.sectionLogicalLength = binarySectionLogicalLength_;
61#ifdef E57_VERBOSE
62 header.dump(); //???
63#endif
64
65 // Write header at beginning of section
66 imf->file_->seek( binarySectionLogicalStart_ );
67 imf->file_->write( reinterpret_cast<char *>( &header ), sizeof( header ) );
68 }
69
70 BlobNodeImpl::BlobNodeImpl( ImageFileImplWeakPtr destImageFile, int64_t fileOffset,
71 int64_t length ) : NodeImpl( destImageFile )

Callers

nothing calls this directly

Calls 5

allocateSpaceMethod · 0.80
physicalToLogicalMethod · 0.80
dumpMethod · 0.45
seekMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected