You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
myd7349 edited this page Jun 16, 2021
·
2 revisions
Iterating over all objects in the file
The anonymous function passed to visit allows us to save information back into dynamic List<T>. Without this we would have to pin an array that is preallocated.
List<string>datasetNames=newList<string>();List<string>groupNames=newList<string>();varrootId=H5G.open(fileId,"/");H5O.visit(fileId,H5.index_t.NAME,H5.iter_order_t.INC,newH5O.iterate_t(delegate(hid_tobjectId,IntPtrnamePtr,refH5O.info_tinfo,IntPtrop_data){stringobjectName=Marshal.PtrToStringAnsi(namePtr);H5O.info_tgInfo=newH5O.info_t();H5O.get_info_by_name(objectId,objectName,refgInfo);if(gInfo.type==H5O.type_t.DATASET){datasetNames.Add(objectName);}elseif(gInfo.type==H5O.type_t.GROUP){groupNames.Add(objectName);}return0;}),newIntPtr());H5G.close(rootId);// Print out the information that we foundforeach(varlineindatasetNames){Debug.WriteLine(line);}