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

Method writer

plugins/e57/libE57Format/src/CompressedVectorNodeImpl.cpp:268–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266#endif
267
268 std::shared_ptr<CompressedVectorWriterImpl> CompressedVectorNodeImpl::writer(
269 std::vector<SourceDestBuffer> sbufs )
270 {
271 checkImageFileOpen( __FILE__, __LINE__, static_cast<const char *>( __FUNCTION__ ) );
272
273 ImageFileImplSharedPtr destImageFile( destImageFile_ );
274
275 // Check don't have any writers/readers open for this ImageFile
276 if ( destImageFile->writerCount() > 0 )
277 {
278 throw E57_EXCEPTION2( ErrorTooManyWriters,
279 "fileName=" + destImageFile->fileName() +
280 " writerCount=" + toString( destImageFile->writerCount() ) +
281 " readerCount=" + toString( destImageFile->readerCount() ) );
282 }
283 if ( destImageFile->readerCount() > 0 )
284 {
285 throw E57_EXCEPTION2( ErrorTooManyReaders,
286 "fileName=" + destImageFile->fileName() +
287 " writerCount=" + toString( destImageFile->writerCount() ) +
288 " readerCount=" + toString( destImageFile->readerCount() ) );
289 }
290
291 // sbufs can't be empty
292 if ( sbufs.empty() )
293 {
294 throw E57_EXCEPTION2( ErrorBadAPIArgument, "fileName=" + destImageFile->fileName() );
295 }
296
297 if ( !destImageFile->isWriter() )
298 {
299 throw E57_EXCEPTION2( ErrorFileReadOnly, "fileName=" + destImageFile->fileName() );
300 }
301
302 if ( !isAttached() )
303 {
304 throw E57_EXCEPTION2( ErrorNodeUnattached, "fileName=" + destImageFile->fileName() );
305 }
306
307 // Get pointer to me (really shared_ptr<CompressedVectorNodeImpl>)
308 NodeImplSharedPtr ni( shared_from_this() );
309
310 // Downcast pointer to right type
311 std::shared_ptr<CompressedVectorNodeImpl> cai(
312 std::static_pointer_cast<CompressedVectorNodeImpl>( ni ) );
313
314 // Return a shared_ptr to new object
315 std::shared_ptr<CompressedVectorWriterImpl> cvwi(
316 new CompressedVectorWriterImpl( cai, sbufs ) );
317 return ( cvwi );
318 }
319
320 std::shared_ptr<CompressedVectorReaderImpl> CompressedVectorNodeImpl::reader(
321 std::vector<SourceDestBuffer> dbufs )

Callers

nothing calls this directly

Calls 6

isWriterMethod · 0.80
toStringFunction · 0.70
writerCountMethod · 0.45
fileNameMethod · 0.45
readerCountMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected