Declare a new unit

saf_declare_unit is a function defined in unit.c.

Synopsis:

SAF_Unit * saf_declare_unit(SAF_ParMode pmode, SAF_Db *db, const char *name, const char *abbr, const char *url, SAF_Unit *unit)

Formal Arguments:

  • db: The database in which to create the new unit.
  • name: Optional singular unit name.
  • abbr: Optional singular abbreviation
  • url: Optional documentation url.
  • unit: [OUT] Optional unit handle to initialize and return.

Description: This function declares a new unit whose product of quantity powers is unity. The client is expected to multiply powers of other quantities or units into this new unit via saf_multiply_unit.

Preconditions:

  • pmode must be valid. (low-cost)

Return Value: A new unit handle is returned on success. Otherwise a SAF__ERROR_HANDLE is returned or an exception is raised, depending on the error handling property of the library.

See Also: