ThingWorx Edge C SDK > How to Set Up an Application > Defining Properties > ThingWorx Base Types (C SDK Details)
ThingWorx Base Types (C SDK Details)
To represent the data in your model, ThingWorx provides Data Shapes. A Data Shape is a named set of field definitions and related metadata. Each field in a Data Shape has a data type. ThingWorx has a defined set of base types for defining fields in a Data Shape. The following table briefly describes the base types defined in ThingWorx.
Base Types
Base Type Name
Description (C SDK Details)
TW_NOTHING
An empty value.
TW_STRING
A modified UTF8 encoded string. Data and length are stored in val.bytes and val.len, respectively. The twPrimitive owns the data pointer and will free it when deleted. TW_STRING types are null terminated.
TW_NUMBER
A C double value, stored in val.double.
TW_BOOLEAN
A value that can be either true or false. Represented as a single char, stored in val.boolean.
TW_DATETIME
An unsigned 64-bit value representing milliseconds since the epoch 1/1/1970. Data is stored in val.datetime.
TW_INFOTABLE
For the C SDK, a pointer to a complex structure and stored in val.infotable. The twPrimitive owns this pointer and will free up the memory pointed to when the twPrimitive is deleted.
Refer to Getting to Know Infotables in the ThingWorx Concepts section of this help center for more information.
TW_LOCATION
A structure consisting of three double floating point values – longitude, latitude, and elevation. Stored as val.location.
TW_BLOB
A pointer to a character array. Data and length are stored in val.bytes and val.len, respectively. Differs from TW_STRING in that the array may contain nulls. The twPrimitive owns the data pointer and will free it when deleted.
TW_IMAGE
Identical to TW_BLOB except for the type difference.
TW_INTEGER
A number that can be written without a fractional component.
TW_VARIANT
Pointer to a structure that contain a type enum and a twPrimitive value. The pointer is stored as val.variant. The twPrimitive owns the pointer and will free the structure when deleted.
TW_XML,TW_JSON, TW_QUERY, TW_HYPERLINK, TW_IMAGELINK, TW_PASSWORD, TW_HTML, TW_TEXT, TW_TAGS, TW_GUID,TW_THINGNAME, TW_THINGSHAPENAME, TW_THINGTEMPLATENAME, TW_DATASHAPENAME, TW_MASHUPNAME, TW_MENUNAME, TW_BASETYPENAME, TW_USERNAME, TW_GROUPNAME, TW_CATEGORYNAME, TW_STATEDEFINITIONNAME, TW_STYLEDEFINITIONNAME, TW_MODELTAGVOCABULARYNAME, TW_DATATAGVOCABULARYNAME, TW_NETWORKNAME, TW_MEDIAENTITYNAME, TW_APPLICATIONKEYNAME, TW_LOCALIZATIONTABLENAME, TW_ORGANIZATIONNAME
These base types are all of the TW_STRING family and are stored similarly.
Was this helpful?