188 void swap2bytes(
char * bytes);
189 void swap4bytes(
char * bytes);
190 void swap8bytes(
char * bytes);
191 int stringToStream(
char *
string,
twStream * s);
192 char * streamToString(
twStream * s);
193 enum BaseType baseTypeFromString(
const char * s);
194 const char * baseTypeToString(
enum BaseType b);
struct twPrimitive twPrimitive
BaseType primitive structure.
twPrimitive * twPrimitive_FullCopy(twPrimitive *p)
Creates a new twPrimitive structure and copies all data from an existing twPrimitive structure to the...
Definition: twBaseTypes.c:902
twPrimitive * twPrimitive_CreateFromJson(struct cJSON *j, char *name, enum BaseType type)
Helper function to convert a cJSON object to a twPrimitive.
Definition: twBaseTypes.c:1182
struct twLocation twLocation
Location primitive structure.
int32_t integer
Definition: twBaseTypes.h:209
struct twPrimitive * variant
Definition: twBaseTypes.h:219
twPrimitive * twPrimitive_CreateVariant(twPrimitive *input)
Helper function to create a twPrimitive of type TW_VARIANT from a twPrimitive structure.
Definition: twBaseTypes.c:1148
twLocation location
Definition: twBaseTypes.h:212
double number
Definition: twBaseTypes.h:210
struct twStream twStream
Dynamically allocated byte array. Automatically expands its length as needed.
double latitude
Definition: twBaseTypes.h:178
twStream * twStream_Create()
Creates a new twStream structure.
Definition: twBaseTypes.c:263
char * data
Definition: twBaseTypes.h:36
twPrimitive * twPrimitive_CreateFromNumber(const double value)
Helper function to create a twPrimitive of type TW_NUMBER from a double.
Definition: twBaseTypes.c:1108
uint32_t length
Definition: twBaseTypes.h:207
int twStream_GetBytes(struct twStream *s, void *b, uint32_t count)
Copies count bytes of data from the twStream::data of a twStream into buf.
Definition: twBaseTypes.c:416
twStream * twStream_CreateFromFile(const char *fname)
Creates a stream from a file.
Definition: twBaseTypes.c:283
twPrimitive * twPrimitive_CreateFromStreamTyped(twStream *s, enum BaseType type)
Allocates a new twPrimitive structure of a specified type and populates it with data from a twStream...
Definition: twBaseTypes.c:471
char * ptr
Definition: twBaseTypes.h:37
int twStream_Reset(struct twStream *s)
Resets the position pointer of a twStream (twStream::ptr) to the beginning of that twStream's data (t...
Definition: twBaseTypes.c:436
Dynamically allocated byte array. Automatically expands its length as needed.
Definition: twBaseTypes.h:35
twStream * twStream_CreateFromCharArrayZeroCopy(const char *data, uint32_t length)
Allocates a new twStream structure and points twStream::data to an existing char array.
Definition: twBaseTypes.c:331
char * twStream_GetData(struct twStream *s)
Gets a pointer to the twStream::data of a twStream.
Definition: twBaseTypes.c:361
Wrappers for OS-specific functionality.
struct cJSON * twPrimitive_ToJson(const char *name, twPrimitive *p, struct cJSON *parent)
Helper function to convert a twPrimitive to a CJSON object.
Definition: twBaseTypes.c:1332
double longitude
Definition: twBaseTypes.h:179
twPrimitive * twPrimitive_ZeroCopy(twPrimitive *p)
Creates a new twPrimitive structure which inherits all pointers of an existing twPrimitive structure ...
Definition: twBaseTypes.c:889
char boolean
Definition: twBaseTypes.h:213
int twPrimitive_ToStream(twPrimitive *p, twStream *s)
Copies the data from a twPrimitive structure to a twStream structure.
Definition: twBaseTypes.c:665
char twPrimitive_IsTrue(twPrimitive *p1)
Compares a twPrimitive to "true". For booleans true is if the value is "true", for numeric and dattim...
Definition: twBaseTypes.c:829
int twStream_AddBytes(struct twStream *s, void *b, uint32_t count)
Adds data bytes to a twStream.
Definition: twBaseTypes.c:376
twPrimitive * twPrimitive_CreateFromLocation(const twLocation *value)
Helper function to create a twPrimitive of type TW_LOCATION from a location structure.
Definition: twBaseTypes.c:1116
char * twPrimitive_DecoupleStringAndDelete(twPrimitive *p)
Helper function to return the value of a TW_STRING family type, remove it from the twPrimitive p...
Definition: twBaseTypes.c:1164
twPrimitive * twPrimitive_CreateFromString(const char *value, char duplicate)
Helper function to create a twPrimitive of type TW_STRING from a null-terminated char array...
Definition: twBaseTypes.c:1104
twPrimitive * twPrimitive_CreateFromCurrentTime()
Helper function to create a twPrimitive of type TW_DATETIME from the current time.
Definition: twBaseTypes.c:1135
int32_t twStream_GetIndex(struct twStream *s)
Gets the ::twStream#index of a twStream.
Definition: twBaseTypes.c:366
Default settings for ThingWorx C SDK.
int twPrimitive_Compare(twPrimitive *p1, twPrimitive *p2)
Compares two twPrimitive structures for equivalence.
Definition: twBaseTypes.c:754
enum BaseType typeFamily
Definition: twBaseTypes.h:206
DATETIME datetime
Definition: twBaseTypes.h:211
Common definitions for C SDK.
twPrimitive * twPrimitive_CreateFromBoolean(const char value)
Helper function to create a twPrimitive of type TW_BOOLEAN from a char type.
Definition: twBaseTypes.c:1140
void twPrimitive_Delete(void *p)
Frees all memory associated with a twPrimitive and all of its owned substructures.
Definition: twBaseTypes.c:638
struct twInfoTable * infotable
Definition: twBaseTypes.h:218
twPrimitive * twPrimitive_Create()
Creates a new twPrimitive structure.
Definition: twBaseTypes.c:450
twPrimitive * twPrimitive_CreateFromDatetime(const DATETIME value)
Helper function to create a twPrimitive of type TW_DATETIME from a DATETIME type. ...
Definition: twBaseTypes.c:1131
union twPrimitive::@0 val
twPrimitive * twPrimitive_CreateFromVariable(const void *value, enum BaseType type, char duplicateCharArray, uint32_t blobLength)
Helper function to create a twPrimitive of any type from a void *.
Definition: twBaseTypes.c:951
Info table base structure.
Definition: twInfoTable.h:418
double elevation
Definition: twBaseTypes.h:180
twPrimitive * twPrimitive_CreateFromStream(twStream *s)
Creates a new twPrimitive structure and populates it with data from a twStream.
Definition: twBaseTypes.c:460
twPrimitive * twPrimitive_CreateFromBlob(const char *value, int32_t length, char isImage, char duplicate)
Helper function to create a twPrimitive of type TW_BLOB or TW_IMAGE from a char array.
Definition: twBaseTypes.c:1126
uint32_t length
Definition: twBaseTypes.h:38
char ownsData
Definition: twBaseTypes.h:40
int32_t twStream_GetLength(struct twStream *s)
Gets the twStream::length of a twStream.
Definition: twBaseTypes.c:371
twPrimitive * twPrimitive_CreateFromLocationAndDelete(const twLocation *value)
Helper function to create a twPrimitive of type TW_LOCATION from a location structure. Deletes the TW_LOCATION after creating the primitive.
Definition: twBaseTypes.c:1120
twPrimitive * twPrimitive_CreateFromInfoTable(struct twInfoTable *it)
Helper function to create a twPrimitive of type TW_INFOTABLE from a twInfoTable structure.
Definition: twBaseTypes.c:1144
Location primitive structure.
Definition: twBaseTypes.h:177
twPrimitive * twPrimitive_CreateFromInteger(const int32_t value)
Helper function to create a twPrimitive of type TW_INTEGER from an integral type (int, short, char).
Definition: twBaseTypes.c:1112
enum BaseType type
Definition: twBaseTypes.h:205
int32_t len
Definition: twBaseTypes.h:216
void twStream_Delete(void *s)
Frees all memory associated with a twStream and all of its owned substructures.
Definition: twBaseTypes.c:350
BaseType
Definition: twDefinitions.h:156
BaseType primitive structure.
Definition: twBaseTypes.h:204
char * data
Definition: twBaseTypes.h:215
uint32_t maxlength
Definition: twBaseTypes.h:39
twStream * twStream_CreateFromCharArray(const char *data, uint32_t length)
Creates a new twStream structure and copies the data from a char array to the new structure's twStrea...
Definition: twBaseTypes.c:307
Definition: gzappend.c:170