#include <string.h>
#include <stdlib.h>
#include <hdf5.h>
#include "bstrlib.h"
#include "gmalloc.h"
#include "globals.h"
Go to the source code of this file.
|
herr_t | H5ATTRset_attribute (hid_t obj_id, const_bstring attr_name, hid_t type_id, size_t rank, hsize_t *dims, const_bstring attr_data) |
|
herr_t | H5ATTRset_attribute_string (hid_t obj_id, const_bstring attr_name, const_bstring attr_data, hsize_t attr_size, int cset) |
| H5ATTRset_attribute_string sets the value of a string attribute. More...
|
|
herr_t | H5ATTRget_attribute (hid_t loc_id, const_bstring attr_name, hid_t type_id, void *data) |
|
hsize_t | H5ATTRget_attribute_string (hid_t obj_id, const_bstring attr_name, bstring data, int *cset) |
| H5ATTRget_attribute_string gets the value of a string attribute. More...
|
|
hsize_t | H5ATTRget_attribute_vlen_string_array (hid_t obj_id, const char *attr_name, char ***data, int *cset) |
|
herr_t | H5ATTRfind_attribute (hid_t loc_id, const_bstring attr_name) |
|
herr_t | H5ATTRget_type_ndims (hid_t loc_id, const_bstring attr_name, hid_t *type_id, H5T_class_t *class_id, size_t *type_size, int *rank) |
|
herr_t | H5ATTRget_dims (hid_t loc_id, const_bstring attr_name, hsize_t *dims) |
|
hsize_t H5ATTRget_attribute_string |
( |
hid_t |
obj_id, |
|
|
const_bstring |
attr_name, |
|
|
bstring |
data, |
|
|
int * |
cset |
|
) |
| |
H5ATTRget_attribute_string gets the value of a string attribute.
- See also
- H5ATTRset_attribute_string()
- Parameters
-
[in] | obj_id | The id of the object to which the attribute should be attached. This is usually a group. |
[in] | attr_name | The name of the attribute to be set. |
[out] | attr_data | The value for the attribute, as a safe string. |
[in] | cset | The character set for the string. Valid values are: H5T_CSET_ASCII and H5T_CSET_UTF8. |
- Returns
- On success it returns the length of the string, on failure it returns ERROR (-1).
- Example
- Read the value of the
descriptor
metadata item.
2 bstring desc_value=bfromcstr("");
3 bstring descriptor = bfromcstr("descriptor");
4 if( H5ATTRget_attribute_string( object_id, descriptor,desc_value,
5 H5T_CSET_ASCII) == ERROR){
6 printf("ERROR getting the attribute value\n");
9 ...use the desc_value ....
- Details
- This function is normally called by GS_GetStringAttribute, which is the preferred function for getting values of string attributes.
H5ATTRset_attribute_string sets the value of a string attribute.
- See also
- H5ATTRget_attribute_string()
- Parameters
-
[in] | obj_id | The id of the object to which the attribute should be attached. This is usually a group. |
[in] | attr_name | The name of the attribute to be set. |
[in] | attr_data | The value for the attribute, as a safe string. |
[in] | attr_size | The number of characters in attr_data . |
[in] | cset | The character set for the string. Valid values are: H5T_CSET_ASCII and H5T_CSET_UTF8. |
- Returns
- On success it returns SUCCESS (0), on failure it returns ERROR (-1).
- Example
- Set the value of
descriptor
to "Arizona".
2 bstring descriptor=bfromcstr("descriptor");
3 bstring arizona = bfromcstr("Arizona");
4 if( H5ATTRset_attribute_string( object_id, descriptor,
5 arizona,7,H5T_CSET_ASCII)
7 printf("ERROR setting the attribute value\n");
- Details
- This function is normally called by GS_SetStringAttribute, which is the preferred function for setting values of string attributes.