1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
|
<html>
<head><title>
HDF5/H5A API Specification
</title>
<!-- #BeginLibraryItem "/ed_libs/styles_RM.lbi" -->
<!--
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-->
<link href="ed_styles/RMelect.css" rel="stylesheet" type="text/css">
<!-- #EndLibraryItem --></head>
<body bgcolor="#FFFFFF">
<!-- HEADER RIGHT " " -->
<!-- #BeginLibraryItem "/ed_libs/NavBar_RM.lbi" --><hr>
<center>
<table border=0 width=98%>
<tr><td valign=top align=left>
<a href="index.html">HDF5 documents and links</a> <br>
<a href="H5.intro.html">Introduction to HDF5</a> <br>
<a href="http://hdf.ncsa.uiuc.edu/HDF5/doc/UG/index.html">HDF5 User Guide</a> <br>
<!--
<a href="Glossary.html">Glossary</a><br>
-->
</td>
<td valign=top align=right>
And in this document, the
<a href="RM_H5Front.html">HDF5 Reference Manual</a>
<br>
<a href="RM_H5.html">H5</a>
<a href="RM_H5A.html">H5A</a>
<a href="RM_H5D.html">H5D</a>
<a href="RM_H5E.html">H5E</a>
<a href="RM_H5F.html">H5F</a>
<a href="RM_H5G.html">H5G</a>
<a href="RM_H5I.html">H5I</a>
<a href="RM_H5P.html">H5P</a>
<br>
<a href="RM_H5R.html">H5R</a>
<a href="RM_H5S.html">H5S</a>
<a href="RM_H5T.html">H5T</a>
<a href="RM_H5Z.html">H5Z</a>
<a href="Tools.html">Tools</a>
<a href="PredefDTypes.html">Datatypes</a>
</td></tr>
</table>
</center>
<hr>
<!-- #EndLibraryItem --><center>
<h1>H5A: Attribute Interface</h1>
</center>
<h2>Attribute API Functions</h2>
These functions create and manipulate attributes
and information about attributes.
<p>
<strong>The C Interfaces:</strong>
<table border=0>
<tr><td valign=top>
<ul>
<li><a href="#Annot-Create">H5Acreate</a>
<li><a href="#Annot-Write">H5Awrite</a>
<li><a href="#Annot-Read">H5Aread</a>
<li><a href="#Annot-Close">H5Aclose</a>
</ul>
</td><td> </td><td valign=top>
<ul>
<li><a href="#Annot-GetName">H5Aget_name</a>
<li><a href="#Annot-OpenName">H5Aopen_name</a>
<li><a href="#Annot-OpenIdx">H5Aopen_idx</a>
<li><a href="#Annot-GetSpace">H5Aget_space</a>
</ul>
</td><td> </td><td valign=top>
<ul>
<li><a href="#Annot-GetType">H5Aget_type</a>
<li><a href="#Annot-NumAttrs">H5Aget_num_attrs</a>
<li><a href="#Annot-Iterate">H5Aiterate</a>
<li><a href="#Annot-Delete">H5Adelete</a>
</ul>
</td></tr>
</table>
<br>
<i>Alphabetical Listing</i>
<table border="0">
<tr>
<td valign="top">
<ul>
<li><a href="#Annot-Close">H5Aclose</a>
<li><a href="#Annot-Create">H5Acreate</a>
<li><a href="#Annot-Delete">H5Adelete</a>
<li><a href="#Annot-GetName">H5Aget_name</a>
</ul>
</td>
<td> </td>
<td valign="top">
<ul>
<li><a href="#Annot-NumAttrs">H5Aget_num_attrs</a>
<li><a href="#Annot-GetSpace">H5Aget_space</a>
<li><a href="#Annot-GetType">H5Aget_type</a>
<li><a href="#Annot-Iterate">H5Aiterate</a>
</ul>
</td>
<td> </td>
<td valign="top">
<ul>
<li><a href="#Annot-OpenIdx">H5Aopen_idx</a>
<li><a href="#Annot-OpenName">H5Aopen_name</a>
<li><a href="#Annot-Read">H5Aread</a>
<li><a href="#Annot-Write">H5Awrite</a>
</ul>
</td>
</tr>
</table>
<br>
<strong>The FORTRAN90 Interfaces:</strong>
<br>
In general, each FORTRAN90 subroutine performs exactly the same task
as the corresponding C function.
<br>
<table border=0>
<tr><td valign=top>
<ul>
<li><a href="#Annot-Create">h5acreate_f</a>
<li><a href="#Annot-Write">h5awrite_f</a>
<li><a href="#Annot-Read">h5aread_f</a>
<li><a href="#Annot-Close">h5aclose_f</a>
</ul>
</td><td> </td><td valign=top>
<ul>
<li><a href="#Annot-GetName">h5aget_name_f</a>
<li><a href="#Annot-OpenName">h5aopen_name_f</a>
<li><a href="#Annot-OpenIdx">h5aopen_idx_f</a>
<li><a href="#Annot-GetSpace">h5aget_space_f</a>
</ul>
</td><td> </td><td valign=top>
<ul>
<li><a href="#Annot-GetType">h5aget_type_f</a>
<li><a href="#Annot-NumAttrs">h5aget_num_attrs_f</a>
<!--<li><a href="#Annot-Iterate">h5aiterate_f</a>-->
<li><a href="#Annot-Delete">h5adelete_f</a>
</ul>
</td></tr>
</table>
<p>
The Attribute interface, H5A, is primarily designed to easily allow
small datasets to be attached to primary datasets as metadata information.
Additional goals for the H5A interface include keeping storage requirement
for each attribute to a minimum and easily sharing attributes among
datasets.
<p>
Because attributes are intended to be small objects, large datasets
intended as additional information for a primary dataset should be
stored as supplemental datasets in a group with the primary dataset.
Attributes can then be attached to the group containing everything
to indicate a particular type of dataset with supplemental datasets
is located in the group. How small is "small" is not defined by the
library and is up to the user's interpretation.
<p>
See <a href="Attributes.html"><cite>Attributes</cite></a> in the
<a href="H5.user.html"><cite>HDF5 User's Guide</cite></a> for further information.
<!-- NEW PAGE -->
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Aclose" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-Close">H5Aclose</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t</em> <code>H5Aclose</code>(<em>hid_t</em> <code>attr_id</code>)
<dt><strong>Purpose:</strong>
<dd>Closes the specified attribute.
<dt><strong>Description:</strong>
<dd><code>H5Aclose</code> terminates access to the attribute
specified by <code>attr_id</code> by releasing the identifier.
<p>
Further use of a released attribute identifier is illegal;
a function using such an identifier will fail.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>attr_id</code>
<dd>IN: Attribute to release access to.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5aclose_f
<dd>
<pre>
SUBROUTINE h5aclose_f(attr_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aclose_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Acreate" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-Create">H5Acreate</a>
<dt><strong>Signature:</strong>
<dd><font size="-1"><em>hid_t</em> <code>H5Acreate</code>(<em>hid_t</em> <code>loc_id</code>,
<em>const char *</em><code>name</code>,
<em>hid_t</em> <code>type_id</code>,
<em>hid_t</em> <code>space_id</code>,
<em>hid_t</em> <code>create_plist</code></font>
)
<dt><strong>Purpose:</strong>
<dd>Creates a dataset as an attribute of another group, dataset,
or named datatype.
<dt><strong>Description:</strong>
<dd><code>H5Acreate</code> creates an attribute named <code>name</code>
and attached to the object specified with <code>loc_id</code>.
<code>loc_id</code> is a group, dataset, or named datatype identifier.
<p>
The attribute name specified in <code>name</code> must be unique.
Attempting to create an attribute with the same name as an already
existing attribute will fail, leaving the pre-existing attribute
in place. To overwrite an existing attribute with a new attribute
of the same name, first call <code>H5Adelete</code> then recreate
the attribute with <code>H5Acreate</code>.
<p>
The datatype and dataspace identifiers of the attribute,
<code>type_id</code> and <code>space_id</code>, respectively,
are created with the H5T and H5S interfaces, respectively.
<p>
Currently only simple dataspaces are allowed for attribute dataspaces.
<p>
The attribute creation property list, <code>create_plist</code>,
is currently unused;
it may be used in the future for optional attribute properties.
At this time, <code>H5P_DEFAULT</code> is the only accepted value.
</p>
The attribute identifier returned from this function must be released
with <code>H5Aclose</code> or resource leaks will develop.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>loc_id</code></dt>
<dd>IN: Object (dataset, group, or named datatype) to be attached to.</dd>
<dt><em>const char *</em><code>name</code></dt>
<dd>IN: Name of attribute to create.</dd>
<dt><em>hid_t</em> <code>type_id</code></dt>
<dd>IN: Identifier of datatype for attribute.</dd>
<dt><em>hid_t</em> <code>space_id</code></dt>
<dd>IN: Identifier of dataspace for attribute.</dd>
<dt><em>hid_t</em> <code>create_plist</code></dt>
<dd>IN: Identifier of creation property list. (Currently unused;
the only accepted value is <code>H5P_DEFAULT</code>.)</dd>
</dl>
<dt><strong>Returns:</strong>
<dd>Returns an attribute identifier if successful;
otherwise returns a negative value.
<!--<dt><strong>Non-C API(s):</strong>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
<dt><strong>Fortran90 Interface:</strong> h5acreate_f
<dd>
<pre>
SUBROUTINE h5acreate_f(obj_id, name, type_id, space_id, attr_id, &
hdferr, creation_prp)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name
INTEGER(HID_T), INTENT(IN) :: type_id ! Attribute datatype identifier
INTEGER(HID_T), INTENT(IN) :: space_id ! Attribute dataspace identifier
INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp
! Attribute creation property
! list identifier
END SUBROUTINE h5acreate_f
</pre>
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Adelete" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-Delete">H5Adelete</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t</em> <code>H5Adelete</code>(<em>hid_t</em> <code>loc_id</code>,
<em>const char *</em><code>name</code>
)
<dt><strong>Purpose:</strong>
<dd>Deletes an attribute from a location.
<dt><strong>Description:</strong>
<dd><code>H5Adelete</code> removes the attribute specified by its
name, <code>name</code>, from a dataset, group, or named datatype.
This function should not be used when attribute identifiers are
open on <code>loc_id</code> as it may cause the internal indexes
of the attributes to change and future writes to the open
attributes to produce incorrect results.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>loc_id</code>
<dd>IN: Identifier of the dataset, group, or named datatype
to have the attribute deleted from.
<dt><em>const char *</em><code>name</code>
<dd>IN: Name of the attribute to delete.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5adelete_f
<dd>
<pre>
SUBROUTINE h5adelete_f(obj_id, name, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5adelete_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Aget_name" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-GetName">H5Aget_name</a>
<dt><strong>Signature:</strong>
<dd><em>ssize_t</em> <code>H5Aget_name</code>(<em>hid_t</em> <code>attr_id</code>,
<em>size_t</em> <code>buf_size</code>,
<em>char *</em><code>buf</code>
)
<dt><strong>Purpose:</strong>
<dd>Gets an attribute name.
<dt><strong>Description:</strong>
<dd><code>H5Aget_name</code> retrieves the name of an attribute
specified by the identifier, <code>attr_id</code>.
Up to <code>buf_size</code> characters are stored in
<code>buf</code> followed by a <code>\0</code> string
terminator. If the name of the attribute is longer than
<code>(buf_size -1)</code>, the string terminator is stored in the
last position of the buffer to properly terminate the string.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>attr_id</code>
<dd>IN: Identifier of the attribute.
<dt><em>size_t</em> <code>buf_size</code>
<dd>IN: The size of the buffer to store the name in.
<dt><em>char *</em><code>buf</code>
<dd>IN: Buffer to store name in.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns the length of the attribute's name, which may be
longer than <code>buf_size</code>, if successful.
Otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5aget_name_f
<dd>
<pre>
SUBROUTINE h5aget_name_f(attr_id, size, buf, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER, INTENT(IN) :: size ! Buffer size
CHARACTER(LEN=*), INTENT(OUT) :: buf ! Buffer to hold attribute name
INTEGER, INTENT(OUT) :: hdferr ! Error code: name length
! on success and -1 on failure
END SUBROUTINE h5aget_name_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Aget_num_attrs" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-NumAttrs">H5Aget_num_attrs</a>
<dt><strong>Signature:</strong>
<dd><em>int</em> <code>H5Aget_num_attrs</code>(<em>hid_t</em> <code>loc_id</code>)
<dt><strong>Purpose:</strong>
<dd>Determines the number of attributes attached to an object.
<dt><strong>Description:</strong>
<dd><code>H5Aget_num_attrs</code> returns the number of attributes
attached to the object specified by its identifier,
<code>loc_id</code>.
The object can be a group, dataset, or named datatype.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>loc_id</code>
<dd>IN: Identifier of a group, dataset, or named datatype.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns the number of attributes if successful;
otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5aget_num_attrs_f
<dd>
<pre>
SUBROUTINE h5aget_num_attrs_f(obj_id, attr_num, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
INTEGER, INTENT(OUT) :: attr_num ! Number of attributes of the object
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aget_num_attrs_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Aget_space" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-GetSpace">H5Aget_space</a>
<dt><strong>Signature:</strong>
<dd><em>hid_t</em> <code>H5Aget_space</code>(<em>hid_t</em> <code>attr_id</code>)
<dt><strong>Purpose:</strong>
<dd>Gets a copy of the dataspace for an attribute.
<dt><strong>Description:</strong>
<dd><code>H5Aget_space</code> retrieves a copy of the dataspace
for an attribute. The dataspace identifier returned from
this function must be released with <code>H5Sclose</code>
or resource leaks will develop.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>attr_id</code>
<dd>IN: Identifier of an attribute.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns attribute dataspace identifier if successful;
otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5aget_space_f
<dd>
<pre>
SUBROUTINE h5aget_space_f(attr_id, space_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER(HID_T), INTENT(OUT) :: space_id ! Attribute dataspace identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aget_space_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Aget_type" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-GetType">H5Aget_type</a>
<dt><strong>Signature:</strong>
<dd><em>hid_t</em> <code>H5Aget_type</code>(<em>hid_t</em> <code>attr_id</code>)
<dt><strong>Purpose:</strong>
<dd>Gets an attribute datatype.
<dt><strong>Description:</strong>
<dd><code>H5Aget_type</code> retrieves a copy of the datatype
for an attribute.
<p>
The datatype is reopened if it is a named type before returning
it to the application. The datatypes returned by this function
are always read-only. If an error occurs when atomizing the
return datatype, then the datatype is closed.
<p>
The datatype identifier returned from this function must be
released with <code>H5Tclose</code> or resource leaks will develop.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>attr_id</code>
<dd>IN: Identifier of an attribute.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a datatype identifier if successful;
otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5aget_type_f
<dd>
<pre>
SUBROUTINE h5aget_type_f(attr_id, type_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER(HID_T), INTENT(OUT) :: type_id ! Attribute datatype identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aget_type_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Aiterate" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-Iterate">H5Aiterate</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t</em> <code>H5Aiterate</code>(<em>hid_t</em> <code>loc_id</code>,
<em>unsigned *</em> <code>idx</code>,
<em>H5A_operator_t</em> <code>op</code>,
<em>void *</em><code>op_data</code>
)
<dt><strong>Purpose:</strong>
<dd>Calls a user's function for each attribute on an object.
<dt><strong>Description:</strong>
<dd><code>H5Aiterate</code> iterates over the attributes of
the object specified by its identifier, <code>loc_id</code>.
The object can be a group, dataset, or named datatype.
For each attribute of the object, the <code>op_data</code>
and some additional information specified below are passed
to the operator function <code>op</code>.
The iteration begins with the attribute specified by its
index, <code>idx</code>; the index for the next attribute
to be processed by the operator, <code>op</code>, is
returned in <code>idx</code>.
If <code>idx</code> is the null pointer, then all attributes
are processed.
<p>
The prototype for <code>H5A_operator_t</code> is: <br>
<code>typedef herr_t (*H5A_operator_t)(hid_t <em>loc_id</em>,
const char *<em>attr_name</em>,
void *<em>operator_data</em>);
</code>
<p>
The operation receives the identifier for the group, dataset
or named datatype being iterated over, <code>loc_id</code>, the
name of the current attribute about the object, <code>attr_name</code>,
and the pointer to the operator data passed in to <code>H5Aiterate</code>,
<code>op_data</code>. The return values from an operator are:
<ul>
<li>Zero causes the iterator to continue, returning zero when all
attributes have been processed.
<li>Positive causes the iterator to immediately return that positive
value, indicating short-circuit success. The iterator can be
restarted at the next attribute.
<li>Negative causes the iterator to immediately return that value,
indicating failure. The iterator can be restarted at the next
attribute.
</ul>
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>loc_id</code>
<dd>IN: Identifier of a group, dataset or named datatype.
<dt><em>unsigned *</em> <code>idx</code>
<dd>IN/OUT: Starting (IN) and ending (OUT) attribute index.
<dt><em>H5A_operator_t</em> <code>op</code>
<dd>IN: User's function to pass each attribute to
<dt><em>void *</em><code>op_data</code>
<dd>IN/OUT: User's data to pass through to iterator operator function
</dl>
<dt><strong>Returns:</strong>
<dd>If successful, returns the return value of the last operator
if it was non-zero, or zero if all attributes were processed.
Otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong>
<dd>None.
<!--
<pre>
SUBROUTINE
</pre>
-->
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Aopen_idx" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-OpenIdx">H5Aopen_idx</a>
<dt><strong>Signature:</strong>
<dd><em>hid_t</em> <code>H5Aopen_idx</code>(<em>hid_t</em> <code>loc_id</code>,
<em>unsigned int</em> <code>idx</code>
)
<dt><strong>Purpose:</strong>
<dd>Opens the attribute specified by its index.
<dt><strong>Description:</strong>
<dd><code>H5Aopen_idx</code> opens an attribute which is attached
to the object specified with <code>loc_id</code>.
The location object may be either a group, dataset, or
named datatype, all of which may have any sort of attribute.
The attribute specified by the index, <code>idx</code>,
indicates the attribute to access.
The value of <code>idx</code> is a 0-based, non-negative integer.
The attribute identifier returned from this function must be
released with <code>H5Aclose</code> or resource leaks will develop.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>loc_id</code>
<dd>IN: Identifier of the group, dataset, or named datatype
attribute to be attached to.
<dt><em>unsigned int</em> <code>idx</code>
<dd>IN: Index of the attribute to open.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns attribute identifier if successful;
otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5aopen_idx_f
<dd>
<pre>
SUBROUTINE h5aopen_idx_f(obj_id, index, attr_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
INTEGER, INTENT(IN) :: index ! Attribute index
INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aopen_idx_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Aopen_name" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-OpenName">H5Aopen_name</a>
<dt><strong>Signature:</strong>
<dd><em>hid_t</em> <code>H5Aopen_name</code>(<em>hid_t</em> <code>loc_id</code>,
<em>const char *</em><code>name</code>
)
<dt><strong>Purpose:</strong>
<dd> Opens an attribute specified by name.
<dt><strong>Description:</strong>
<dd><code>H5Aopen_name</code> opens an attribute specified by
its name, <code>name</code>, which is attached to the
object specified with <code>loc_id</code>.
The location object may be either a group, dataset, or
named datatype, which may have any sort of attribute.
The attribute identifier returned from this function must
be released with <code>H5Aclose</code> or resource leaks
will develop.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>loc_id</code>
<dd>IN: Identifier of a group, dataset, or named datatype
atttribute to be attached to.
<dt><em>const char *</em><code>name</code>
<dd>IN: Attribute name.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns attribute identifier if successful;
otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5aopen_name_f
<dd>
<pre>
SUBROUTINE h5aopen_name_f(obj_id, name, attr_id, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier
CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name
INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aopen_name_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Aread" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-Read">H5Aread</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t</em> <code>H5Aread</code>(<em>hid_t</em> <code>attr_id</code>,
<em>hid_t</em> <code>mem_type_id</code>,
<em>void *</em><code>buf</code>
)
<dt><strong>Purpose:</strong>
<dd>Reads an attribute.
<dt><strong>Description:</strong>
<dd><code>H5Aread</code> reads an attribute, specified with
<code>attr_id</code>. The attribute's memory datatype
is specified with <code>mem_type_id</code>. The entire
attribute is read into <code>buf</code> from the file.
<p>
Datatype conversion takes place at the time of a read or write
and is automatic. See the
<a href="Datatypes.html#Datatypes-DataConversion">Data Conversion</a>
section of <cite>The Data Type Interface (H5T)</cite> in the
<cite>HDF5 User's Guide</cite> for a discussion of
data conversion, including the range of conversions currently
supported by the HDF5 libraries.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>attr_id</code>
<dd>IN: Identifier of an attribute to read.
<dt><em>hid_t</em> <code>mem_type_id</code>
<dd>IN: Identifier of the attribute datatype (in memory).
<dt><em>void *</em><code>buf</code>
<dd>OUT: Buffer for data to be read.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5aread_f
<dd>
<pre>
SUBROUTINE h5aread_f(attr_id, memtype_id, buf, dims, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype
! identifier (in memory)
TYPE, INTENT(INOUT) :: buf ! Data buffer; may be a scalar or
! an array
DIMENSION(*), INTEGER(HSIZE_T), INTENT(IN) :: dims
! Array to hold corresponding
! dimension sizes of data buffer buf;
! dim(k) has value of the
! k-th dimension of buffer buf;
! values are ignored if buf is a
! scalar
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5aread_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- NEW PAGE -->
<!-- HEADER RIGHT "H5Awrite" -->
<hr>
<dl>
<dt><strong>Name:</strong> <a name="Annot-Write">H5Awrite</a>
<dt><strong>Signature:</strong>
<dd><em>herr_t</em> <code>H5Awrite</code>(<em>hid_t</em> <code>attr_id</code>,
<em>hid_t</em> <code>mem_type_id</code>,
<em>const void *</em><code>buf</code>
)
<dt><strong>Purpose:</strong>
<dd>Writes data to an attribute.
<dt><strong>Description:</strong>
<dd><code>H5Awrite</code> writes an attribute, specified with
<code>attr_id</code>. The attribute's memory datatype
is specified with <code>mem_type_id</code>. The entire
attribute is written from <code>buf</code> to the file.
<p>
Datatype conversion takes place at the time of a read or write
and is automatic. See the
<a href="Datatypes.html#Datatypes-DataConversion">Data Conversion</a>
section of <cite>The Data Type Interface (H5T)</cite> in the
<cite>HDF5 User's Guide</cite> for a discussion of
data conversion, including the range of conversions currently
supported by the HDF5 libraries.
<dt><strong>Parameters:</strong>
<dl>
<dt><em>hid_t</em> <code>attr_id</code>
<dd>IN: Identifier of an attribute to write.
<dt><em>hid_t</em> <code>mem_type_id</code>
<dd>IN: Identifier of the attribute datatype (in memory).
<dt><em>const void *</em><code>buf</code>
<dd>IN: Data to be written.
</dl>
<dt><strong>Returns:</strong>
<dd>Returns a non-negative value if successful;
otherwise returns a negative value.
<dt><strong>Fortran90 Interface:</strong> h5awrite_f
<dd>
<pre>
SUBROUTINE h5awrite_f(attr_id, memtype_id, buf, dims, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier
INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype
! identifier (in memory)
TYPE, INTENT(IN) :: buf ! Data buffer; may be a scalar or
! an array
DIMENSION(*), INTEGER(HSIZE_T), INTENT(IN) :: dims
! Array to hold corresponding
! dimension sizes of data buffer buf;
! dim(k) has value of the k-th
! dimension of buffer buf;
! values are ignored if buf is
! a scalar
INTEGER, INTENT(OUT) :: hdferr ! Error code:
! 0 on success and -1 on failure
END SUBROUTINE h5awrite_f
</pre>
<!--<dt><strong>Non-C API(s):</strong>
<dd>
<img src="Graphics/Java.gif">
<img src="Graphics/C++.gif">
-->
</dl>
<!-- #BeginLibraryItem "/ed_libs/NavBar_RM.lbi" --><hr>
<center>
<table border=0 width=98%>
<tr><td valign=top align=left>
<a href="index.html">HDF5 documents and links</a> <br>
<a href="H5.intro.html">Introduction to HDF5</a> <br>
<a href="http://hdf.ncsa.uiuc.edu/HDF5/doc/UG/index.html">HDF5 User Guide</a> <br>
<!--
<a href="Glossary.html">Glossary</a><br>
-->
</td>
<td valign=top align=right>
And in this document, the
<a href="RM_H5Front.html">HDF5 Reference Manual</a>
<br>
<a href="RM_H5.html">H5</a>
<a href="RM_H5A.html">H5A</a>
<a href="RM_H5D.html">H5D</a>
<a href="RM_H5E.html">H5E</a>
<a href="RM_H5F.html">H5F</a>
<a href="RM_H5G.html">H5G</a>
<a href="RM_H5I.html">H5I</a>
<a href="RM_H5P.html">H5P</a>
<br>
<a href="RM_H5R.html">H5R</a>
<a href="RM_H5S.html">H5S</a>
<a href="RM_H5T.html">H5T</a>
<a href="RM_H5Z.html">H5Z</a>
<a href="Tools.html">Tools</a>
<a href="PredefDTypes.html">Datatypes</a>
</td></tr>
</table>
</center>
<hr>
<!-- #EndLibraryItem --><!-- #BeginLibraryItem "/ed_libs/Footer.lbi" --><address>
<a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a>
<br>
Describes HDF5 Release 1.6.2, February 2004
</address><!-- #EndLibraryItem --><SCRIPT LANGUAGE="JAVASCRIPT">
<!--
document.writeln("Last modified: 16 October 2003");
-->
</SCRIPT>
</body>
</html>
|