Query unit characteristics¶
saf_describe_unit
is a function defined in unit.c.
Synopsis:
-
int
saf_describe_unit
(SAF_ParMode pmode, SAF_Unit *unit, char **name, char **abbr, char **url, double *scale, double *offset, double *logbase, double *logcoef, SAF_Quantity *quantity)¶
Formal Arguments:
unit
: Unit about which to retrieve information.name
: If non-null then upon return this will point to an allocated copy of the unit singular name.abbr
: If non-null then upon return this will point to an allocated copy of the unit singular abbreviation.url
: If non-null then upon return this will point to an allocated copy of theurl
for the unit’s documentation.scale
: If non-null then upon return *scale
will be the scale factor for the unit.offset
: If non-null then upon return *offset
will be the offset for the unit.logbase
: If non-null then upon return *logbase
will be the logarithm base for the unit. The returned value zero indicates no logarithm is applied.logcoef
: If non-null then upon return *logcoef
will be the multiplier of the logarithmic scale.quantity
: If non-null then upon return this will point to the handle of the quantity on which this unit is based. If theunit
has not been defined yet (such as calling this function immediately after saf_declare_unit) then the quantity handle will be initialized to a null link.
Description: Given a unit
, this function returns any information which is known about that unit.
Preconditions:
pmode
must be valid. (low-cost)unit
must be a valid unit handle. (low-cost)
Return Value: A non-negative value is returned on success. Failure is indicated by a negative return value or the raising of an exception, depending on the error handling property of the library.
See Also:
- saf_declare_unit: 21.1: Declare a new unit
- Units: Introduction for current chapter