1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use super::tag::TagIndex;

#[derive(Clone, Debug, Default)]
pub struct ListOfUnitDefinitions {
    pub unit_definitions: Vec<TagIndex>, // UnitDefinitions
    pub parent: Option<TagIndex>,
}

#[derive(Clone, Debug, Default)]
pub struct UnitDefinition {
    pub id: Option<String>,
    pub list_of_units: Option<TagIndex>, // ListOfUnits
    pub parent: Option<TagIndex>,
}

#[derive(Clone, Debug, Default)]
pub struct ListOfUnits {
    pub units: Vec<TagIndex>, // Units
    pub parent: Option<TagIndex>,
}

#[derive(Clone, Debug, Default)]
pub struct Unit {
    pub kind: Option<String>, // UnitSId
    pub exponent: Option<f64>,
    pub scale: Option<i64>,
    pub multiplier: Option<f64>,
    pub parent: Option<TagIndex>,
}

#[derive(Clone, Debug)]
#[allow(dead_code)]
enum UnitSId {
    Ampere,
    Avogadro,
    Coulomb,
    Gray,
    Joule,
    Litre,
    Mole,
    Radian,
    Steradian,
    Weber,
    Dimensionless,
    Henry,
    Katal,
    Lumen,
    Newton,
    Tesla,
    Becquerel,
    Farad,
    Hertz,
    Kelvin,
    Lux,
    Ohm,
    Siemens,
    Volt,
    Candela,
    Gram,
    Item,
    Kilogram,
    Metre,
    Pascal,
    Sievert,
    Watt,
    Second,
}