UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
units.h
1 /* units.h */
2 /* $Id: units.h,v 1.12 2008/10/23 11:32:56 vlad Exp $ */
3 #ifndef __units_h
4 #define __units_h
5 
6 
7 /*************************************************************
8  * Support for physical units of measure for different
9  * categories: length, velocity etc.
10  * Definitions and types.
11  *************************************************************/
12 
16 typedef enum
17 {
18  /* Known categories */
19  UC_NONE = 0,
20  UC_LINK,
22  UC_UPPERCASE,
23  UC_LOWERCASE,
25  UC_ISODATE,
29  /* Should be fixed forever */
30  UC_LENGTH = 10,
31  UC_VELOCITY,
32  UC_DENSITY,
33  UC_TIME,
34  UC_ANGLE,
35  UC_FREQUENCY,
36  UC_PRESSURE,
37 
38  UC_LAST
40 } CategoryId;
41 
42 
46 typedef enum
47 {
48  /* Known units of measure */
49 
50  U_DEFAULT = 0,
52  /* Units of length */
53  U_LENGTH_METERS,
54  U_LENGTH_FEET,
56  /* Units of velocity */
57  U_VELOCITY_METERS_PER_SECOND,
58  U_VELOCITY_FEET_PER_SECOND,
60  /* Units of density */
61  U_DENSITY_GRAM_PER_SM3,
63  /* Units of time */
64  U_TIME_SECOND,
65  U_TIME_MILLISECOND,
66  U_TIME_MICROSECOND,
68  /* Units of angle */
69  U_ANGLE_DEGREE,
70  U_ANGLE_DEGREE_MINUTE,
71  U_ANGLE_GRAD,
72  U_ANGLE_RADIAN,
73 
74  /* Units of frequency */
75  U_FREQUENCY_HZ,
76  U_FREQUENCY_RPM,
77  U_FREQUENCY_RADIAN_PER_SECOND,
79  /* Units for pressure */
80  UC_PRESSURE_PA,
82  U_LAST
84 } UnitId;
85 
86 
87 #ifdef __cplusplus
88 extern "C" {
89 #endif /* C++ */
90 
91 
94  double CategoryPrecision (CategoryId cat_id);
95 
98  int CategoryFracDigits (CategoryId cat_id);
99 
100 
102  const char* CategoryToString (CategoryId cat_id);
103 
105  CategoryId CategoryFromString (const char* s);
106 
108  const char* UnitToString (UnitId unit_id);
109 
110 
111 
112 #ifdef __cplusplus
113 };
114 #endif /* C++ */
115 
116 
117 #endif /* units.h */