![]() |
das2C
das core C utilities (v3)
|
Physical data values, including time, and their units. More...
Data Structures | |
| struct | das_time |
| Basic date-time structure used throughout the Das1 & Das2 utilities. More... | |
Macros | |
| #define | DAS_BS_NULL ((das_byte_seq){NULL, 0}) |
| Convenience macros for an empty byte sequence fat pointer. | |
Typedefs | |
| typedef const char * | das_units |
| Handle SI and other units, with accommodations for Epoch systems, from units.h. | |
Enumerations | |
| enum | das_val_type { vtUnknown = 0 , vtUByte = 1 , vtByte = 2 , vtUShort = 3 , vtShort = 4 , vtUInt = 5 , vtInt = 6 , vtULong = 7 , vtLong = 8 , vtFloat = 9 , vtDouble = 10 , vtTime = 11 , vtIndex = 12 , vtText = 13 , vtByteSeq = 15 , vtComposite = 16 } |
| Enumeration of value classes: what one whole externally indexable thing is – a number, a calendar time, a string, or a composite of simple elements. More... | |
Functions | |
| DAS_API const char * | das_enc_fromStr (const char *sEncType) |
| Resolve a wire-encoding string to its canonical schema value. | |
| DAS_API const char * | das_sem_default (das_val_type vt, das_units units) |
| Suggest a default semantic for a (value type, units) pair. | |
| DAS_API das_val_type | das_vt_default (const char *sSemantic) |
| Given a semantic meaning, suggest a default value type. | |
| DAS_API const char * | das_sem_fromStr (const char *sSemantic) |
| Resolve a semantic string to its canonical schema value. | |
Variables | |
| DAS_API const char * | DAS_ENC_BYTE |
| The EncodingType pattern from das-basic-stream-v3.0.xsd namely: byte,ubyte,BEint,BEuint,BEreal,LEint,LEuint,LEreal,utf8,blob,base64 . | |
| DAS_API const char * | DAS_SEM_BLOB |
| Value meanings, which are a higher level concept then the plain storage information. | |
Physical data values, including time, and their units.
No units, a pure number such as a linear ratio.
| typedef const char* das_units |
Handle SI and other units, with accommodations for Epoch systems, from units.h.
Note that although these are strings, Units_fromStr() should be be used to get a reference to the enumerated string since pointer equality comparison is done in the code. Thus UnitType objects created using the functions in this module satisfy the rule:
The Epoch Time unit types understood by this library are:
As it stands the library currently does not understand SI prefixes, so each scaled unit has it's own entry. This should change.
And if you don't know what else to use, try this:
| enum das_val_type |
Enumeration of value classes: what one whole externally indexable thing is – a number, a calendar time, a string, or a composite of simple elements.
This is the presentation vocabulary used by datums and variables. Array STORAGE uses only the simple subset; see das_elem_type below for the storage-element view of the same numbering.
| DAS_API const char * das_enc_fromStr | ( | const char * | sEncType | ) |
Resolve a wire-encoding string to its canonical schema value.
An encoding names how values are serialized in a packet, orthogonal to how they are stored (das_val_type) or interpreted (semantic). The vocabulary is CLOSED – exactly the DAS_ENC_* set, the schema's EncodingType pattern – and not application-expandable. This is the one place an encoding string is validated; output is a canonical DAS_ENC_* pointer, so callers may compare the result by pointer.
| sEncType | an encoding string from a stream header (may be NULL). |
| DAS_API const char * das_sem_default | ( | das_val_type | vt, |
| das_units | units | ||
| ) |
Suggest a default semantic for a (value type, units) pair.
Calendar units win over the value type: a TT2000 / us2000 / ... field is a datetime whatever integer or real it is stored as.
To relate this to the schema, vt here roughly corresponds to the "storage" attribute for a variable
| DAS_API const char * das_sem_fromStr | ( | const char * | sSemantic | ) |
Resolve a semantic string to its canonical schema value.
A variable's semantic is how its values are meant to be interpreted, orthogonal to how they are stored. So a vtText field may values meant as integers, or a vtLong of TT2000 times. So storage answers "what bytes?" but semantic answers "what do they mean, and what operations make sense?".
This is the single place wire spellings are normalized (liberal-in): "int" and 'integer' both maps to DAS_SEM_INT. Output is always a canonical DAS_SEM_* singleton pointer defined above.
| sSemantic | a semantic string from a stream header (may be NULL). |
|
extern |
The EncodingType pattern from das-basic-stream-v3.0.xsd namely: byte,ubyte,BEint,BEuint,BEreal,LEint,LEuint,LEreal,utf8,blob,base64 .
An encoding says how values are serialized into a packet.
An encoding plus the element size in bytes picks the storage type. Each value is a singleton so we can compare pointers.
@See das_enc_fromStr().
|
extern |
Value meanings, which are a higher level concept then the plain storage information.
Taken from das-basic-stream-v3.0.xsd, namely: bool, datetime, integer, real, string, blob A semantic is how values are interpreted, which can be orthogonal to how they're stored. For example a TT2000 integer and a UTC string are both datetime's, but in radically different representations.
Using singleton pointers here again for speed.