Access a varying-length structure
A varying-length structure contains the following information:
- Private members, which are not revealed to the DataBlade® API programmer
- Public members, which you can access with DataBlade® API functions
After you allocate a varying-length structure, you can
access the public members of this structure with the DataBlade®
API accessor functions
in the following table.
Accessor function name | Description |
---|---|
mi_get_varlen() | Obtains from the varying-length descriptor the length of the varying-length data |
mi_get_vardata() | Obtains from the varying-length descriptor the data pointer to the data contained in the data portion |
mi_get_vardata_align() | Obtains from the varying-length descriptor the data pointer to the data contained in the data portion, adjusting for any initial padding required to align the data on a specified byte boundary |
mi_set_varlen() | Sets the length of the varying-length data in the varying-length descriptor |
mi_set_vardata() | Sets the data in the data portion of the varying-length structure |
mi_set_vardata_align() | Sets the data in the data portion of the varying-length structure, adding any initial padding required to align the data on a specified byte boundary |
mi_set_varptr() | Sets the data pointer in the varying-length descriptor to the location of a data portion that you allocate |
Restriction: To a DataBlade®
API module, the varying-length
structure is an opaque C data structure. Do not access its internal
fields directly. The internal structure of the varying-length structure
might change in future releases. Therefore, to create portable code,
always use the accessor functions for this structure to obtain and
store values.