Beispiel #1
0
        /// <summary>
        /// Create a temporary HDF5 with SWMR access and return
        /// its name and a file handle.
        /// </summary>
        public static hid_t H5TempFileSWMR(ref string fileName)
        {
            hid_t fapl = H5P.create(H5P.FILE_ACCESS);

            if (fapl < 0)
            {
                throw new ApplicationException("H5P.create failed.");
            }
            if (H5P.set_libver_bounds(fapl, H5F.libver_t.LATEST) < 0)
            {
                throw new ApplicationException("H5P.set_libver_bounds failed.");
            }
            if (H5P.set_fclose_degree(fapl, H5F.close_degree_t.STRONG) < 0)
            {
                throw new ApplicationException("H5P.set_fclose_degree failed.");
            }
            fileName = Path.GetTempFileName();
            hid_t file = H5F.create(fileName, H5F.ACC_TRUNC | H5F.ACC_SWMR_WRITE,
                                    H5P.DEFAULT, fapl);

            if (file < 0)
            {
                throw new ApplicationException("H5F.create failed.");
            }
            if (H5P.close(fapl) < 0)
            {
                throw new ApplicationException("H5P.close failed.");
            }
            return(file);
        }