public void H5Lget_name_by_idxTest2() { hid_t lcpl = H5P.copy(m_lcpl); Assert.IsTrue(lcpl >= 0); Assert.IsTrue(H5P.set_char_encoding(lcpl, H5T.cset_t.UTF8) >= 0); for (int i = 0; i < m_utf8strings.Length; ++i) { Assert.IsTrue( H5L.create_external(m_v0_class_file_name, "/", m_v0_class_file, m_utf8strings[i], lcpl) >= 0); } for (int i = 0; i < m_utf8strings.Length; ++i) { size_t buf_size = IntPtr.Zero; ssize_t size = H5L.get_name_by_idx(m_v0_test_file, ".", H5.index_t.NAME, H5.iter_order_t.NATIVE, (hsize_t)i, null, buf_size); buf_size = new IntPtr(size.ToInt32() + 1); StringBuilder nameBuilder = new StringBuilder(buf_size.ToInt32()); size = H5L.get_name_by_idx(m_v0_test_file, ".", H5.index_t.NAME, H5.iter_order_t.NATIVE, (hsize_t)i, nameBuilder, buf_size); } Assert.IsTrue(H5P.close(lcpl) >= 0); }
public static void ClassInit(TestContext testContext) { // create test files which persists across file tests m_v0_class_file = Utilities.H5TempFile(ref m_v0_class_file_name, H5F.libver_t.EARLIEST); Assert.IsTrue(m_v0_class_file >= 0); m_v2_class_file = Utilities.H5TempFile(ref m_v2_class_file_name); Assert.IsTrue(m_v2_class_file >= 0); m_lcpl = H5P.create(H5P.LINK_CREATE); Assert.IsTrue(H5P.set_create_intermediate_group(m_lcpl, 1) >= 0); m_lcpl_utf8 = H5P.copy(m_lcpl); Assert.IsTrue( H5P.set_char_encoding(m_lcpl_utf8, H5T.cset_t.UTF8) >= 0); }
public static void ClassInit(TestContext testContext) { #if HDF5_VER1_10 // create test files which persists across file tests m_v3_class_file = Utilities.H5TempFileSWMR(ref m_v3_class_file_name); Assert.IsTrue(m_v3_class_file >= 0); m_lcpl = H5P.create(H5P.LINK_CREATE); Assert.IsTrue(H5P.set_create_intermediate_group(m_lcpl, 1) >= 0); m_lcpl_utf8 = H5P.copy(m_lcpl); Assert.IsTrue( H5P.set_char_encoding(m_lcpl_utf8, H5T.cset_t.UTF8) >= 0); // create a sample dataset hsize_t[] dims = { 6, 6 }; hsize_t[] maxdims = { 6, H5S.UNLIMITED }; hsize_t[] chunk_dims = { 2, 5 }; int[] cbuf = new int[36]; hid_t dsp = H5S.create_simple(2, dims, maxdims); Assert.IsTrue(dsp >= 0); hid_t dcpl = H5P.create(H5P.DATASET_CREATE); Assert.IsTrue(dcpl >= 0); Assert.IsTrue(H5P.set_chunk(dcpl, 2, chunk_dims) >= 0); hid_t dst = H5D.create(m_v3_class_file, "int6x6", H5T.NATIVE_INT, dsp, H5P.DEFAULT, dcpl); Assert.IsTrue(dst >= 0); GCHandle hnd = GCHandle.Alloc(cbuf, GCHandleType.Pinned); Assert.IsTrue(H5D.write(dst, H5T.NATIVE_INT, H5S.ALL, H5S.ALL, H5P.DEFAULT, hnd.AddrOfPinnedObject()) >= 0); hnd.Free(); Assert.IsTrue(H5D.flush(dst) >= 0); Assert.IsTrue(H5D.close(dst) >= 0); Assert.IsTrue(H5P.close(dcpl) >= 0); Assert.IsTrue(H5S.close(dsp) >= 0); #endif }