Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add allowParallel flag to allow multiple readers to be created #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/E57Format.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public:

// Iterators
CompressedVectorWriter writer( std::vector<SourceDestBuffer> &sbufs );
CompressedVectorReader reader( const std::vector<SourceDestBuffer> &dbufs );
CompressedVectorReader reader( const std::vector<SourceDestBuffer> &dbufs, bool allowParallel = false );

// Up/Down cast conversion
operator Node() const;
Expand Down
4 changes: 2 additions & 2 deletions src/CompressedVectorNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ prototype. It is not an error to create a CompressedVectorReader for an empty Co
@see CompressedVectorReader, SourceDestBuffer, CompressedVectorNode::CompressedVectorNode,
CompressedVectorNode::prototype
*/
CompressedVectorReader CompressedVectorNode::reader( const std::vector<SourceDestBuffer> &dbufs )
CompressedVectorReader CompressedVectorNode::reader( const std::vector<SourceDestBuffer> &dbufs, bool allowParallel )
{
return CompressedVectorReader( impl_->reader( dbufs ) );
return CompressedVectorReader( impl_->reader( dbufs, allowParallel ) );
}
5 changes: 3 additions & 2 deletions src/CompressedVectorNodeImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ namespace e57
}

std::shared_ptr<CompressedVectorReaderImpl> CompressedVectorNodeImpl::reader(
std::vector<SourceDestBuffer> dbufs )
std::vector<SourceDestBuffer> dbufs,
bool allowParallel )
{
checkImageFileOpen( __FILE__, __LINE__, static_cast<const char *>( __FUNCTION__ ) );

Expand All @@ -332,7 +333,7 @@ namespace e57
" writerCount=" + toString( destImageFile->writerCount() ) +
" readerCount=" + toString( destImageFile->readerCount() ) );
}
if ( destImageFile->readerCount() > 0 )
if ( !allowParallel && destImageFile->readerCount() > 0 )
{
throw E57_EXCEPTION2( ErrorTooManyReaders,
"fileName=" + destImageFile->fileName() +
Expand Down
2 changes: 1 addition & 1 deletion src/CompressedVectorNodeImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace e57

/// Iterator constructors
std::shared_ptr<CompressedVectorWriterImpl> writer( std::vector<SourceDestBuffer> sbufs );
std::shared_ptr<CompressedVectorReaderImpl> reader( std::vector<SourceDestBuffer> dbufs );
std::shared_ptr<CompressedVectorReaderImpl> reader( std::vector<SourceDestBuffer> dbufs, bool allowParallel );

int64_t getRecordCount() const
{
Expand Down