Base Data Types
The HDB (and thus the web engine), stores data as data objects in data object repositories, not as rows in tables. A repository can only store objects of the data class to which it is initialized (the native data class). Thus, before a repository can be declared (created), the data class it will use, must be defined. Data classes are much as they would be in any computer language - they comprise one or more members which must be of a previously defined data type.
Some data types are fundamental C++ types, some have been adopted as standard by HadronZoo, others will be specific to the application. In order to provide an overall framework for data types, the HadronZoo library provides the hdbBasetype enumeration. This places data types in five groups as follows:-
Group 1: Fundamental C++ types (fixed size) | |||
BASETYPE_DOUBLE | 0x0101 | 64 bit floating point value | |
BASETYPE_INT64 | 0x0102 | 64-bit Signed integer | |
BASETYPE_INT32 | 0x0103 | 32-bit Signed integer | |
BASETYPE_INT16 | 0x0104 | 16-bit Signed integer | |
BASETYPE_BYTE | 0x0105 | 8-bit Signed integer | |
BASETYPE_UINT64 | 0x0106 | 64-bit Positive integer | |
BASETYPE_UINT32 | 0x0107 | 32-bit Positive integer | |
BASETYPE_UINT16 | 0x0108 | 16-bit Positive integer | |
BASETYPE_UBYTE | 0x0109 | 8-bit Positive integer | |
BASETYPE_BOOL | 0x010A | Either true or false, cannot be empty or have mutiple values | |
Group 2: HadronZoo Defined types (fixed size) | |||
BASETYPE_TBOOL | 0x0201 | Either true, false or don't know (empty). Cannot have mutiple values | |
BASETYPE_DOMAIN | 0x0202 | Internet domain | |
BASETYPE_EMADDR | 0x0203 | Email Address | |
BASETYPE_URL | 0x0204 | Universal Resource Locator | |
BASETYPE_IPADDR | 0x0205 | IP Address | |
BASETYPE_TIME | 0x0206 | No of seconds since midnight (4 bytes) | |
BASETYPE_SDATE | 0x0207 | No of days since Jan 1st year 0000 | |
BASETYPE_XDATE | 0x0208 | Full date and time | |
BASETYPE_STRING | 0x0209 | Single value string, can be indexed by value (e.g. First or last name) | |
BASETYPE_TEXT | 0x020A | Text document, can use free text indexation. Stored as part of a data object. | |
BASETYPE_TXTDOC | 0x020B | The same as TEXT but stored separately from the data object, in a binary datum repository. | |
BASETYPE_TXTSRC | 0x020C | Encoded document from which text could be extracted (if a suitable decoder is provided). | |
BASETYPE_BINARY | 0x020D | Binary object, assummed to be un-indexable (e.g. image). | |
Group 3: Application defined data enumerations | |||
BASETYPE_ENUM | 0x1001 | Data enumeration | |
Group 4: Application defined special text types | |||
BASETYPE_APPDEF | 0x2000 | String subject to special interpretation by the application (e.g. serial numbers). | |
Group 5: Standard and application defined data class | |||
BASETYPE_CLASS | 0x4000 | Sub-class (instances stored as part of host class instance). |
Note 1: In the actual hdbBasetype enum, defined in hzDatabase.h, the type names are prefixed with 'BASETYPE_'. However, for the purposes of this manual, this prefix is ignored.
Note 2: The data types in groups 1 and 2 are completely defined by the hdbBasetype and require no further qualification. By contrast, the application specific data types, groups 3, 4 and 5 do require further qualification, with the hdbBasetype serving only to state the data type is an enum, a string of a format peculiar to the application, or a data class.
Note 3: Groups 1, 2, 3 and 4 are atomic, meaning that their values are either fundamentally indivisible or are treated as indivisible by the HDB. However group 5, the data classes are composite, since they consist of one or more members.