@@ -19,15 +19,17 @@ export
19
19
# Attribute, File, Group, Dataset, Datatype, Opaque
20
20
# Dataspace, Object, Properties, VLen, ChunkStorage, Reference
21
21
# functions
22
- a_create, a_delete, a_open, a_read, a_write, attrs,
23
- d_create, d_create_external, d_open, d_read, d_write,
24
- dataspace, datatype, exists, file, filename,
25
- g_create, g_open, get_access_properties, get_create_properties,
22
+ create_attribute, delete_attribute, read_attribute, open_attribute, write_attribute, attributes,
23
+ create_dataset, create_external_dataset, open_dataset, read_dataset, write_dataset,
24
+ dataspace, datatype, file, filename,
25
+ create_group, open_group,
26
+ create_datatype, commit_datatype,
27
+ copy_object, delete_object, open_object, create_property,
28
+ get_access_properties, get_create_properties,
26
29
get_chunk, get_datasets,
27
30
h5open, h5read, h5rewrite, h5writeattr, h5readattr, h5write,
28
31
iscontiguous, ishdf5, ismmappable, name,
29
- o_copy, o_delete, o_open, p_create,
30
- readmmap, @read , @write , root, set_dims!, t_create, t_commit
32
+ readmmap, @read , @write , root, set_dims!
31
33
32
34
const depsfile = joinpath (dirname (@__DIR__ ), " deps" , " deps.jl" )
33
35
if isfile (depsfile)
@@ -635,7 +637,7 @@ flush(f::Union{Object,Attribute,Datatype,File}, scope = H5F_SCOPE_GLOBAL) = h5f_
635
637
g_open (parent:: Union{File,Group} , name:: String , apl:: Properties = DEFAULT_PROPERTIES) = Group (h5g_open (checkvalid (parent). id, name, apl. id), file (parent))
636
638
d_open (parent:: Union{File,Group} , name:: String , apl:: Properties = DEFAULT_PROPERTIES, xpl:: Properties = DEFAULT_PROPERTIES) = Dataset (h5d_open (checkvalid (parent). id, name, apl. id), file (parent), xpl)
637
639
t_open (parent:: Union{File,Group} , name:: String , apl:: Properties = DEFAULT_PROPERTIES) = Datatype (h5t_open (checkvalid (parent). id, name, apl. id), file (parent))
638
- a_open (parent:: Union{File,Object} , name:: String ) = Attribute (h5a_open (checkvalid (parent). id, name, H5P_DEFAULT), file (parent))
640
+ open_attribute (parent:: Union{File,Object} , name:: String ) = Attribute (h5a_open (checkvalid (parent). id, name, H5P_DEFAULT), file (parent))
639
641
# Object (group, named datatype, or dataset) open
640
642
function h5object (obj_id:: hid_t , parent)
641
643
obj_type = h5i_get_type (obj_id)
@@ -656,8 +658,8 @@ root(h5file::File) = g_open(h5file, "/")
656
658
root (obj:: Union{Group,Dataset} ) = g_open (file (obj), " /" )
657
659
# getindex syntax: obj2 = obj1[path]
658
660
# getindex(parent::Union{HDF5File, HDF5Group}, path::String) = o_open(parent, path)
659
- getindex (dset:: Dataset , name:: String ) = a_open (dset, name)
660
- getindex (x:: Attributes , name:: String ) = a_open (x. parent, name)
661
+ getindex (dset:: Dataset , name:: String ) = open_attribute (dset, name)
662
+ getindex (x:: Attributes , name:: String ) = open_attribute (x. parent, name)
661
663
662
664
function getindex (parent:: Union{File,Group} , path:: String ; pv... )
663
665
objtype = gettype (parent, path)
@@ -740,7 +742,7 @@ function t_commit(parent::Union{File,Group}, path::String, dtype::Datatype, lcpl
740
742
end
741
743
t_commit (parent:: Union{File,Group} , path:: String , dtype:: Datatype ) = t_commit (parent, path, dtype, p_create (H5P_LINK_CREATE))
742
744
743
- a_create (parent:: Union{File,Object} , name:: String , dtype:: Datatype , dspace:: Dataspace ) = Attribute (h5a_create (checkvalid (parent). id, name, dtype. id, dspace. id), file (parent))
745
+ create_attribute (parent:: Union{File,Object} , name:: String , dtype:: Datatype , dspace:: Dataspace ) = Attribute (h5a_create (checkvalid (parent). id, name, dtype. id, dspace. id), file (parent))
744
746
745
747
function _prop_get (p:: Properties , name:: Symbol )
746
748
class = p. class
@@ -859,7 +861,7 @@ function p_create(class; pv...)
859
861
end
860
862
861
863
# Delete objects
862
- a_delete (parent:: Union{File,Object} , path:: String ) = h5a_delete (checkvalid (parent). id, path)
864
+ delete_attribute (parent:: Union{File,Object} , path:: String ) = h5a_delete (checkvalid (parent). id, path)
863
865
o_delete (parent:: Union{File,Group} , path:: String , lapl:: Properties ) = h5l_delete (checkvalid (parent). id, path, lapl. id)
864
866
o_delete (parent:: Union{File,Group} , path:: String ) = h5l_delete (checkvalid (parent). id, path, H5P_DEFAULT)
865
867
o_delete (obj:: Object ) = o_delete (parent (obj), ascii (split (name (obj)," /" )[end ]))
@@ -870,8 +872,8 @@ o_copy(src_obj::Object, dst_parent::Union{File,Group}, dst_path::String) = h5o_c
870
872
871
873
# Assign syntax: obj[path] = value
872
874
# Creates a dataset unless obj is a dataset, in which case it creates an attribute
873
- setindex! (dset:: Dataset , val, name:: String ) = a_write (dset, name, val)
874
- setindex! (x:: Attributes , val, name:: String ) = a_write (x. parent, name, val)
875
+ setindex! (dset:: Dataset , val, name:: String ) = write_attribute (dset, name, val)
876
+ setindex! (x:: Attributes , val, name:: String ) = write_attribute (x. parent, name, val)
875
877
# Getting and setting properties: p[:chunk] = dims, p[:compress] = 6
876
878
getindex (p:: Properties , name:: Symbol ) = _prop_get (checkvalid (p), name)
877
879
function setindex! (p:: Properties , val, name:: Symbol )
@@ -1039,7 +1041,7 @@ dataspace(dset::Dataset) = Dataspace(h5d_get_space(checkvalid(dset).id))
1039
1041
dataspace (attr:: Attribute ) = Dataspace (h5a_get_space (checkvalid (attr). id))
1040
1042
1041
1043
# Create a dataspace from in-memory types
1042
- dataspace (x:: Union{T, Complex{T}} ) where {T<: ScalarType } = Dataspace (h5s_create (H5S_SCALAR))
1044
+ dataspace (x:: Union{T,Complex{T}} ) where {T<: ScalarType } = Dataspace (h5s_create (H5S_SCALAR))
1043
1045
1044
1046
function _dataspace (sz:: Dims{N} , max_dims:: Union{Dims{N}, Tuple{}} = ()) where N
1045
1047
dims = Vector {hsize_t} (undef,length (sz))
@@ -1105,7 +1107,7 @@ flush(ds::Dataset) = h5d_flush(checkvalid(ds).id)
1105
1107
# Generic read functions
1106
1108
for (fsym, osym, ptype) in
1107
1109
((:d_read , :d_open , Union{File,Group}),
1108
- (:a_read , :a_open , Union{File,Group,Dataset,Datatype}))
1110
+ (:read_attribute , :open_attribute , Union{File,Group,Dataset,Datatype}))
1109
1111
@eval begin
1110
1112
function ($ fsym)(parent:: $ptype , name:: String )
1111
1113
local ret
@@ -1292,7 +1294,7 @@ do_reclaim(::Type{T}) where {T} = false
1292
1294
do_reclaim (:: Type{NamedTuple{T,U}} ) where {U,T} = any (i -> do_reclaim (fieldtype (U,i)), 1 : fieldcount (U))
1293
1295
do_reclaim (:: Type{T} ) where T <: Union{Cstring,VariableArray} = true
1294
1296
1295
- read (attr:: Attributes , name:: String ) = a_read (attr. parent, name)
1297
+ read (attr:: Attributes , name:: String ) = read_attribute (attr. parent, name)
1296
1298
1297
1299
# Reading with mmap
1298
1300
function iscontiguous (obj:: Dataset )
@@ -1390,7 +1392,7 @@ end
1390
1392
# The return syntax is: dset, dtype = d_create(parent, name, data; properties...)
1391
1393
for (privatesym, fsym, ptype) in
1392
1394
((:_d_create , :d_create , Union{File,Group}),
1393
- (:_a_create , :a_create , Union{File, Group, Dataset, Datatype}))
1395
+ (:_a_create , :create_attribute , Union{File, Group, Dataset, Datatype}))
1394
1396
@eval begin
1395
1397
# Generic create (hidden)
1396
1398
function ($ privatesym)(parent:: $ptype , name:: String , data; pv... )
@@ -1415,7 +1417,7 @@ end
1415
1417
# Create and write, closing the objects upon exit
1416
1418
for (privatesym, fsym, ptype, crsym) in
1417
1419
((:_d_write , :d_write , Union{File,Group}, :d_create ),
1418
- (:_a_write , :a_write , Union{File,Object,Datatype}, :a_create ))
1420
+ (:_a_write , :write_attribute , Union{File,Object,Datatype}, :create_attribute ))
1419
1421
@eval begin
1420
1422
# Generic write (hidden)
1421
1423
function ($ privatesym)(parent:: $ptype , name:: String , data; pv... )
@@ -1457,9 +1459,9 @@ end
1457
1459
# For plain files and groups, let "write(obj, name, val; properties...)" mean "d_write"
1458
1460
write (parent:: Union{File,Group} , name:: String , data:: Union{T,AbstractArray{T}} ; pv... ) where {T<: Union{ScalarType,String,Complex{<:ScalarType}} } =
1459
1461
d_write (parent, name, data; pv... )
1460
- # For datasets, "write(dset, name, val; properties...)" means "a_write "
1462
+ # For datasets, "write(dset, name, val; properties...)" means "write_attribute "
1461
1463
write (parent:: Dataset , name:: String , data:: Union{T, AbstractArray{T}} ; pv... ) where {T<: ScalarType ,String} =
1462
- a_write (parent, name, data; pv... )
1464
+ write_attribute (parent, name, data; pv... )
1463
1465
1464
1466
1465
1467
# Indexing
0 commit comments