Unity: unit_struct Struct Reference

Unity 1.0 Parser for unit strings

- Main Page
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Data Fields

Data Fields
unit_struct Struct Reference

A single parsed unit. More...

`#include <unity.h>`

Collaboration diagram for unit_struct:
[legend]

## Data Fields
char | is_quoted_unit
| True (non-zero) if this unit was a ‘quoted’ unit.
struct unit_struct * | next
| A pointer to the next unit in the sequence.
float | power
| The power to which the unit is raised.
UnitTypes | type
| Indicates which type of unit this is.
FunctionApplication | f
| A contained function-of unit.
SimpleUnit | u
| A contained simple unit.

## Detailed Description

A single parsed unit.

This can be either a simple unit (corresponding to, for example, ‘MHz’) or a function of a sequence of units (corresponding to, for example, `log(V^2/mHz)`).

A unit can be ‘quoted’, indicating that it is to be parsed as an ‘unknown’ unit even if its name matches that of a ‘known’ unit (for example, `'B'` is a unit of ‘B’, and neither byte nor Bel, and the `'furlong'` is a ‘furlong’ and not, as it would otherwise be parsed, a femto-urlong). This mechanism is syntactically permitted only in the VOUnits syntax, and is used only for output and validity checks (see unity_check_unit), and not for processing. All ‘quoted’ units are classed as not ‘recognised’.

## Field Documentation

char is_quoted_unit

True (non-zero) if this unit was a ‘quoted’ unit.

This only makes sense for VOUnits units, and is used only when writing out units rather than in any processing.

float power

The power to which the unit is raised.

The specification `mm^(-2)` will result in a power of ‘-2’.

UnitTypes type

Indicates which type of unit this is.

If this is of type `simple_unit_type`, then the ‘u’ struct will be valid; if it is of type `function_application_type`, then ‘f’ will be valid.

The documentation for this struct was generated from the following file:

- unity.h

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines