Exemplo n.º 1
0
func createGroup(id C.hid_t, name string, link_flags, grp_c_flags, grp_a_flags int) (*Group, error) {
	c_name := C.CString(name)
	defer C.free(unsafe.Pointer(c_name))

	hid := C.H5Gcreate2(id, c_name, C.hid_t(link_flags), C.hid_t(grp_c_flags), P_DEFAULT.id)
	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
}
Exemplo n.º 2
0
// CreateGroup creates a new empty group and links it to a location in the file.
func (g *CommonFG) CreateGroup(name string) (*Group, error) {
	c_name := C.CString(name)
	defer C.free(unsafe.Pointer(c_name))

	link_flags := C.hid_t(C.H5P_DEFAULT)
	grp_c_flags := C.hid_t(C.H5P_DEFAULT)
	hid := C.H5Gcreate2(g.id, c_name, link_flags, grp_c_flags, 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
}
Exemplo n.º 3
0
// Creates a new empty group and links it to a location in the file.
// hid_t H5Gcreate2( hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id )
func (self *File) CreateGroup(name string, link_flags, grp_c_flags, grp_a_flags int) (g *Group, err error) {
	g = nil
	err = nil

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

	hid := C.H5Gcreate2(self.id, c_name, C.hid_t(link_flags), C.hid_t(grp_c_flags), P_DEFAULT.id)
	err = togo_err(C.herr_t(int(hid)))
	if err != nil {
		return
	}
	g = &Group{id: hid}
	runtime.SetFinalizer(g, (*Group).h5g_finalizer)
	return
}