Create or update a non-sharable attribute¶
saf_put_attribute
is a function defined in utils.c.
Synopsis:
-
int
saf_put_attribute
(SAF_ParMode pmode, ss_pers_t *obj, const char *name, hid_t type, int count, const void *value)¶
Formal Arguments:
pmode
: One of the parallel modes.obj
: The handle to the object the attribute is to be associated with.name
: The name of the attribute.type
: The datatype of the attribute.count
: The number of items of typetype
pointed to by *value
.value
: The attribute value(s) (an array ofcount
value(s) of typetype
).
Description: This function provides a method by which generic, non-sharable attributes may be added to an object. Attributes are pieces of meta data which fall outside the scope of the sharable data model (i.e., things which are not fields) but which are often useful for conveying additional information. The meaning of a particular attribute is determined by convention, requiring additional, apriori agreement between the writer and the reader (often in the form of documentation or word of mouth) as to the meaning and intent of a given attribute/value pair.
If type
is H5T_C_S1
(which isn’t very useful by itself since it’s just a one-byte string that’s always the NUL
character) then a temporary datatype is created which is exactly as long as the value
string including its NUL
terminator. value
in this case should be a pointer to char.
Be aware that querying the attribute for its
datatype will not return H5T_C_S1
unless the string was empty.
Preconditions:
pmode
must be valid. (low-cost)obj
must not be null. (low-cost)name
must not be null. (low-cost)count
must be non-negative. (low-cost)- If count is non-zero,
value
must not be null. (low-cost) - Database in which object exists must not be open for read-only access. (no-cost)
Return Value: The constant SAF__SUCCESS
is returned when this function is successful. Otherwise this function either returns
an error number or throws an exception, depending on the value of the library’s error handling property.
Parallel Notes: Depends on pmode
See Also:
- Attributes: Introduction for current chapter