示例#1
0
文件: H5File.cs 项目: lefi7z/h5ohm
 protected H5File(hid_t fid, string path, string mode)
     : base(fid)
 {
     Path = path;
     Mode = mode;
     Root = H5Group.Open(ID, key: "/", writable: mode != "r");
 }
示例#2
0
文件: H5Group.cs 项目: lefi7z/h5ohm
        /// <summary>
        /// Access the sub-Group given by `key` relative to this Group.
        /// If the sub-Group does not exist and `create = false` (default),
        /// a `KeyNotFoundException` is thrown.
        /// An attempt to create multiple groups or to write a readonly-file
        /// will throw an `InvalidOperationException`.
        /// </summary>
        public H5Group SubGroup(string key, bool create = false)
        {
            if (H5Link.Exists(ID, key))
            {
                return(H5Group.Open(ID, key, IsWritable));
            }

            if (create)
            {
                return(CreateGroup(key));
            }

            else
            {
                throw new KeyNotFoundException(key);
            }
        }