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 seek and tell functions from so3g.G3IndexedReader #81

Merged
merged 2 commits into from
Aug 2, 2022

Conversation

arahlin
Copy link
Member

@arahlin arahlin commented Aug 2, 2022

This PR provides an implementation for seeking through a G3 file for positions of particular frames, allowing faster parsing of data after the initial pass. Most efficient for streams containing many interleaved frame types.

Includes a test of the functionality using two passes through an existing data file, first to cache the desired frame position, and then to seek to that position.

@arahlin arahlin requested review from mhasself and nwhitehorn August 2, 2022 04:38
This provides an implementation for seeking through a G3 file on disk,
allowing faster parsing of data after the initial pass.
@nwhitehorn nwhitehorn merged commit 06e9df3 into master Aug 2, 2022
@arahlin arahlin deleted the indexed_reader branch August 2, 2022 14:06
return boost::iostreams::seek(stream_, offset, std::ios_base::beg);
}

int G3Reader::Tell() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@@ -108,6 +108,14 @@ void G3Reader::Process(G3FramePtr frame, std::deque<G3FramePtr> &out)
n_frames_read_++;
}

int G3Reader::Seek(int offset) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be off_t rather than int.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants