Skip to content

Add more iterators on Group #157

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

Merged
merged 24 commits into from
Oct 13, 2021
Merged

Conversation

mulimoen
Copy link
Collaborator

@mulimoen mulimoen commented Jun 4, 2021

This adds groups, datasets, and datatypes to Group. This also adds the general iter_visit, which can be adapted by users to fully use the capabilities of H5Literate (sans iteration resumption).

@mulimoen mulimoen force-pushed the feature/iteration branch 3 times, most recently from d9587cd to dfd4c71 Compare June 4, 2021 20:57
@aldanor aldanor mentioned this pull request Oct 6, 2021
@mulimoen
Copy link
Collaborator Author

mulimoen commented Oct 6, 2021

@aldanor This should be good to go now

@aldanor
Copy link
Owner

aldanor commented Oct 6, 2021

@mulimoen Looks good overall. I started writing review but figured it would be easier to fix myself - I'll open a PR to your PR on your fork.

@aldanor
Copy link
Owner

aldanor commented Oct 6, 2021

One minor point - why the manual .incref() on the group handle? (otherwise, it looks similar to ObjectClass::from_id() constructor)

@mulimoen
Copy link
Collaborator Author

mulimoen commented Oct 6, 2021

hdf5 has ownership of this ID, and we need to ensure we don't invalidate the id before we return it, as there is an unconditional close on the ID after the callback. This is where #139 would be useful: We only have a borrowed handle and need to treat it as such

@aldanor
Copy link
Owner

aldanor commented Oct 11, 2021

For reference: mulimoen#11

@mulimoen
Copy link
Collaborator Author

@aldanor Looks good to me now. I forgot how big this release is, I thought we already published attributes, but apparently not

@aldanor
Copy link
Owner

aldanor commented Oct 13, 2021

Hm, with times not being filled out, that's not good - but I'll open a separate PR to quickly fix that. This one - let's merge then.

}
}

pub enum IterationOrder {
Copy link
Owner

Choose a reason for hiding this comment

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

#[derive(Clone, Copy, Debug, PartialEq, Eq)]?

) -> herr_t {
panic::catch_unwind(|| {
let other_data: &mut Vec<String> = unsafe { &mut *(op_data.cast::<Vec<String>>()) };
pub enum TraversalOrder {
Copy link
Owner

Choose a reason for hiding this comment

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

#[derive(Clone, Copy, Debug, PartialEq, Eq)]?

let name = unsafe { std::ffi::CStr::from_ptr(name) };
let info = unsafe { info.as_ref().unwrap() };
let handle = Handle::try_new(id).unwrap();
handle.incref();
Copy link
Owner

Choose a reason for hiding this comment

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

You could probably do Group::from_id(id).expect("invalid group id"), no?

The only difference would be it doesn't incref the handle there, wonder why it's increfed manually here?

src/hl/group.rs Outdated
let vtable = op_data.cast::<Vtable<F, G>>();
let vtable = unsafe { vtable.as_mut().expect("op_data is always non-null") };
let name = unsafe { std::ffi::CStr::from_ptr(name) };
let info = unsafe { info.as_ref().unwrap() };
Copy link
Owner

Choose a reason for hiding this comment

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

Replace all unwraps within ffi code with .expect()?

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