[Back to Interface] [Prev] [Next]

SDsetattr/sfsnatt/sfscatt

intn SDsetattr(int32 obj_id, char *attr_name, int32 data_type, int32 count, VOIDP values)

obj_id IN:

Identifier of the object the attribute is to be attached to

attr_name IN:

Name of the attribute

data_type IN:

Data type of the values in the attribute

count IN:

Total number of values to be stored in the attribute

values IN:

Data values to be stored in the attribute

Purpose

Attaches an attribute to an object.

Return value

Returns SUCCEED (or 0) if successful and FAIL (or -1) otherwise.

Description

SDsetattr attaches the attribute to the object specified by the obj_id parameter. The attribute is defined by its name, attr_name, data type, data_type, number of attribute values, count, and the attribute values, values. SDsetattr provides a generic way for users to define metadata. It implements the label = value data abstraction.

The value of obj_id can be an SD interface identifier (sd_id), returned by SDcreate, a data set identifier (sds_id), returned by SDselect, or a dimension identifier (dim_id), returned by SDgetdimid.

If an SD interface identifier (sd_id) is specified as the obj_id parameter, a global attribute is created which applies to all objects in the file. If a data set identifier (sds_id) is specified as the obj_id parameter, an attribute is attached to the specified data set. If a dimension identifier (dim_id) is specified as the obj_id parameter, an attribute is attached to the specified dimension.

The attr_name argument can be any ASCII string.

The data_type parameter can contain any data type supported by the HDF library. These data types are listed in Table 1A in Section I of this manual.

Attribute values are passed in the parameter values. The number of attribute values is defined by the count parameter. If more than one value is stored, all values must have the same data type. If an attribute with the given name, data type and number of values exists, it will be overwritten.

Note that there are two FORTRAN-77 versions of this routine; sfsnatt and sfscatt. The sfsnatt routine writes numeric attribute data and sfscatt writes character attribute data.

FORTRAN

integer function sfsnatt(obj_id, attr_name, data_type, count, values)

integer obj_id, data_type, count

character*(*) attr_name

<valid numeric data type> values(*)

integer function sfscatt(obj_id, attr_name, data_type, count, values)

integer obj_id, data_type, count

character*(*) attr_name, values



[Back to Interface] [Prev] [Next]

hdfhelp@ncsa.uiuc.edu
HDF Reference Manual - 07/29/98, NCSA HDF Development Group.