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

Method close

plugins/e57/libE57Format/src/CompressedVectorWriterImpl.cpp:153–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151 }
152
153 void CompressedVectorWriterImpl::close()
154 {
155#ifdef E57_VERBOSE
156 std::cout << "CompressedVectorWriterImpl::close() called" << std::endl; //???
157#endif
158 ImageFileImplSharedPtr imf( cVector_->destImageFile_ );
159
160 // Before anything that can throw, decrement writer count
161 imf->decrWriterCount();
162
163 checkImageFileOpen( __FILE__, __LINE__, static_cast<const char *>( __FUNCTION__ ) );
164 // don't call checkWriterOpen();
165
166 if ( !isOpen_ )
167 {
168 return;
169 }
170
171 // Set closed before do anything, so if get fault and start unwinding, don't
172 // try to close again.
173 isOpen_ = false;
174
175 // If have any data, write packet
176 // Write all remaining ioBuffers and internal encoder register cache into
177 // file. Know we are done when totalOutputAvailable() returns 0 after a
178 // flush().
179 flush();
180 while ( totalOutputAvailable() > 0 )
181 {
182 packetWrite();
183 flush();
184 }
185
186 // Write one index packet (required by standard).
187 packetWriteIndex();
188
189 // Compute length of whole section we just wrote (from section start to
190 // current start of free space).
191 sectionLogicalLength_ = imf->unusedLogicalStart_ - sectionHeaderLogicalStart_;
192#ifdef E57_VERBOSE
193 std::cout << " sectionLogicalLength_=" << sectionLogicalLength_ << std::endl; //???
194#endif
195
196 // Prepare CompressedVectorSectionHeader
197 CompressedVectorSectionHeader header;
198 header.sectionLogicalLength = sectionLogicalLength_;
199 header.dataPhysicalOffset =
200 dataPhysicalOffset_; //??? can be zero, if no data written ???not set yet
201 header.indexPhysicalOffset =
202 topIndexPhysicalOffset_; //??? can be zero, if no data written ???not set
203 // yet
204#ifdef E57_VERBOSE
205 std::cout << " CompressedVectorSectionHeader:" << std::endl;
206 header.dump( 4 ); //???
207#endif
208
209#if VALIDATE_BASIC
210 // Verify OK before write it.

Callers

nothing calls this directly

Calls 10

flushFunction · 0.85
decrWriterCountMethod · 0.80
setRecordCountMethod · 0.80
dumpMethod · 0.45
verifyMethod · 0.45
lengthMethod · 0.45
seekMethod · 0.45
writeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected