コード例 #1
0
ファイル: Hdf5Attributes.cs プロジェクト: syy94/sharpHDF
        /// <summary>
        /// Remove the attribute from the list and delete the attibute from the file
        /// </summary>
        /// <param name="_attribute"></param>
        public void Delete(Hdf5Attribute _attribute)
        {
            //If the parent is the file, then just delete the attribute (file already open).
            if (ParentObject.Id.Equals(ParentObject.FileId))
            {
                AttributeHelper.DeleteAttribute(ParentObject.Id, _attribute.Name);
            }
            else
            {
                //Otherwise open the object then delete the attibute
                var id = H5O.open(ParentObject.FileId.Value, ParentObject.Path.FullPath).ToId();
                if (id.Value > 0)
                {
                    AttributeHelper.DeleteAttribute(id, _attribute.Name);
                    H5O.close(id.Value);
                }
            }

            Remove(_attribute);
        }