示例#1
0
文件: h5g.go 项目: simleb/go-hdf5
func openGroup(id C.hid_t, name string, gapl_flag C.hid_t) (*Group, error) {
	c_name := C.CString(name)
	defer C.free(unsafe.Pointer(c_name))

	hid := C.H5Gopen2(id, c_name, gapl_flag)
	if err := h5err(C.herr_t(int(hid))); err != nil {
		return nil, err
	}
	g := &Group{Location{hid}}
	runtime.SetFinalizer(g, (*Group).finalizer)
	return g, nil
}
示例#2
0
文件: h5g.go 项目: kisielk/go-hdf5
// OpenGroup opens an existing child group from this Group.
func (g *CommonFG) OpenGroup(name string) (*Group, error) {
	c_name := C.CString(name)
	defer C.free(unsafe.Pointer(c_name))

	hid := C.H5Gopen2(g.id, c_name, P_DEFAULT.id)
	if err := h5err(C.herr_t(int(hid))); err != nil {
		return nil, err
	}
	group := &Group{CommonFG{Location{Identifier{hid}}}}
	runtime.SetFinalizer(group, (*Group).finalizer)
	return group, nil
}
示例#3
0
// Opens an existing group in a file.
// hid_t H5Gopen2( hid_t loc_id, const char * name, hid_t gapl_id )
func (f *File) OpenGroup(name string, gapl_flag int) (g *Group, err error) {
	g = nil
	err = nil

	c_name := C.CString(name)
	defer C.free(unsafe.Pointer(c_name))

	hid := C.H5Gopen2(f.id, c_name, C.hid_t(gapl_flag))
	err = togo_err(C.herr_t(int(hid)))
	if err != nil {
		return
	}
	g = &Group{id: hid}
	runtime.SetFinalizer(g, (*Group).h5g_finalizer)
	return
}