ThingWorx C SDK
Classes
twInfoTable.h File Reference

ThingWorx twInfoTable and twDataShape definitions and functions. More...

#include "twOSPort.h"
#include "twBaseTypes.h"
#include "twList.h"

Go to the source code of this file.

Classes

struct  twDataShapeAspect
 Data shape aspect structure definition. More...
 
struct  twDataShapeEntry
 DataShape entry structure definition. More...
 
struct  twDataShape
 Data shape base structure definition. More...
 
struct  twInfoTableRow
 Info table row structure. More...
 
struct  twInfoTable
 Info table base structure. More...
 

Functions

Convenience Functions for Creating InfoTables
twInfoTabletwInfoTable_CreateFromPrimitive (const char *name, twPrimitive *value)
 Helper function to create a twInfoTable with a single field and single row containing a type and value specified by value. More...
 
twInfoTabletwInfoTable_CreateFromString (const char *name, char *value, char duplicate)
 Helper function to create a twInfoTable with a single field and single row containing a TW_STRING. More...
 
twInfoTabletwInfoTable_CreateFromNumber (const char *name, double value)
 Helper function to create a twInfoTable with a single field and single row containing a TW_NUMBER. More...
 
twInfoTabletwInfoTable_CreateFromInteger (const char *name, int32_t value)
 Helper function to create a twInfoTable with a single field and single row containing a TW_INTEGER. More...
 
twInfoTabletwInfoTable_CreateFromLocation (const char *name, twLocation *value)
 Helper function to create a twInfoTable with a single field and single row containing a TW_LOCATION. More...
 
twInfoTabletwInfoTable_CreateFromBlob (const char *name, char *value, int32_t length, char isImage, char duplicate)
 Helper function to create a twInfoTable with a single field and single row containing a TW_BLOB or TW_IMAGE. More...
 
twInfoTabletwInfoTable_CreateFromDatetime (const char *name, DATETIME value)
 Helper function to create a twInfoTable with a single field and single row containing a TW_DATETIME. More...
 
twInfoTabletwInfoTable_CreateFromBoolean (const char *name, char value)
 Helper function to create a twInfoTable with a single field and single row containing a TW_BOOLEAN. More...
 
Convenience Functions for Accessing InfoTable Values
int twInfoTable_GetString (twInfoTable *it, const char *name, int32_t row, char **value)
 Helper function to retrieve a TW_STRING from a twInfoTable. More...
 
int twInfoTable_GetNumber (twInfoTable *it, const char *name, int32_t row, double *value)
 Helper function to retrieve a TW_NUMBER from a twInfoTable. More...
 
int twInfoTable_GetInteger (twInfoTable *it, const char *name, int32_t row, int32_t *value)
 Helper function to retrieve a TW_INTEGER from a twInfoTable. More...
 
int twInfoTable_GetLocation (twInfoTable *it, const char *name, int32_t row, twLocation *value)
 Helper function to retrieve a TW_LOCATION from a twInfoTable. More...
 
int twInfoTable_GetBlob (twInfoTable *it, const char *name, int32_t row, char **value, int32_t *length)
 Helper function to retrieve a TW_BLOB from a twInfoTable. More...
 
int twInfoTable_GetDatetime (twInfoTable *it, const char *name, int32_t row, DATETIME *value)
 Helper function to retrieve a TW_DATETIME from a twInfoTable. More...
 
int twInfoTable_GetBoolean (twInfoTable *it, const char *name, int32_t row, char *value)
 Helper function to retrieve a TW_BOOLEAN from a twInfoTable. More...
 
int twInfoTable_GetPrimitive (twInfoTable *it, const char *name, int32_t row, twPrimitive **value)
 Helper function to retrieve a twPrimitive from a twInfoTable. More...
 
JSON Conversion Utils
Note
Using any of these functions will cause the cJSON library to be linked to your application, increasing the size of the application by ~22KB.
twInfoTabletwInfoTable_CreateFromJson (struct cJSON *json, char *singleEntryName)
 Helper function that creates a twInfoTable from a cJSON object. If the JSON object does not represent a valid twInfoTable, a twInfoTable with a single field, single row, of type JSON will be created. More...
 
struct cJSONtwDataShape_ToJson (twDataShape *ds, struct cJSON *parent)
 Helper function that outputs a twDataShape to a cJSON object. More...
 
struct cJSONtwInfoTable_ToJson (twInfoTable *it)
 Helper function that outputs a twInfoTable to a cJSON object. More...
 

DataShape Aspects

typedef struct twDataShapeAspect twDataShapeAspect
 Data shape aspect structure definition.
 
twDataShapeAspecttwDataShapeAspect_Create (const char *name, twPrimitive *value)
 Creates a new twDataShapeAspect structure. More...
 
twDataShapeAspecttwDataShapeAspect_CreateFromStream (twStream *s)
 Creates a new twDataShapeAspect structure from data in a twStream. More...
 
void twDataShapeAspect_Delete (void *aspect)
 Frees all memory associated with a twDataShapeAspect and all its owned substructures. More...
 

Data Shape Entries

typedef struct twDataShapeEntry twDataShapeEntry
 DataShape entry structure definition.
 
twDataShapeEntrytwDataShapeEntry_Create (const char *name, const char *description, enum BaseType type)
 Creates a new twDataShapeEntry structure. More...
 
twDataShapeEntrytwDataShapeEntry_CreateFromStream (struct twStream *s)
 Creates a new twDataShapeEntry structure from data in a twStream. More...
 
void twDataShapeEntry_Delete (void *entry)
 Frees all memory associated with a twDataShapeEntry structure and all its owned substructures. More...
 
int twDataShapeEntry_AddAspect (struct twDataShapeEntry *entry, const char *name, twPrimitive *value)
 Creates a new twDataShapeAspect with twDataShapeAspect::value value and adds it to the specified twDataShapeEntry entry. More...
 
uint32_t twDataShapeEntry_GetLength (struct twDataShapeEntry *entry)
 Retrieves the length of a twDataShapeEntry. More...
 
int twDataShapeEntry_ToStream (struct twDataShapeEntry *entry, twStream *s)
 Serializes a twDataShapeEntry to a twStream. More...
 

Data Shapes

typedef struct twDataShape twDataShape
 Data shape base structure definition.
 
twDataShapetwDataShape_Create (twDataShapeEntry *firstEntry)
 Creates a new twDataShape structure. More...
 
twDataShapetwDataShape_CreateFromStream (struct twStream *s)
 Creates a new twDataShape structure from data in a twStream. More...
 
void twDataShape_Delete (void *ds)
 Frees all memory associated with a twDataShape structure and all its owned substructures. More...
 
uint32_t twDataShape_GetLength (struct twDataShape *ds)
 Retrieves the length of a twDataShape. More...
 
int twDataShape_ToStream (struct twDataShape *ds, twStream *s)
 Serializes a twDataShape to a twStream. More...
 
int twDataShape_SetName (struct twDataShape *ds, char *name)
 Sets the name of a twDataShape. More...
 
int twDataShape_AddEntry (struct twDataShape *ds, struct twDataShapeEntry *entry)
 Adds a new twDataShapeEntry to a twDataShape. More...
 
int twDataShape_GetEntryIndex (struct twDataShape *ds, const char *name, int *index)
 Gets the index of the twDataShapeEntry with the specified name. More...
 

Info Table Rows

typedef struct twInfoTableRow twInfoTableRow
 Info table row structure.
 
twInfoTableRowtwInfoTableRow_Create (twPrimitive *firstEntry)
 Creates a new twInfoTableRow. More...
 
twInfoTableRowtwInfoTableRow_CreateFromStream (twStream *s)
 Creates a new twInfoTableRow from data in a twStream. More...
 
void twInfoTableRow_Delete (void *row)
 Deletes a twInfoTableRow structure and frees all memory associated with it. More...
 
int twInfoTableRow_GetCount (twInfoTableRow *row)
 Gets the number of fields in a twInfoTableRow. More...
 
uint32_t twInfoTableRow_GetLength (twInfoTableRow *row)
 Gets the length of a twInfoTableRow. More...
 
int twInfoTableRow_AddEntry (twInfoTableRow *row, twPrimitive *entry)
 Adds a new twPrimitive to a twInfoTableRow. More...
 
twPrimitivetwInfoTableRow_GetEntry (twInfoTableRow *row, int index)
 Gets the twPrimitive value of an entry in a twInfoTableRow. More...
 
int twInfoTableRow_ToStream (twInfoTableRow *row, twStream *s)
 Serializes a twInfoTableRow to a twStream. More...
 

Info Tables

typedef struct twInfoTable twInfoTable
 Info table base structure.
 
twInfoTabletwInfoTable_Create (twDataShape *shape)
 Creates a new twInfoTable. More...
 
twInfoTabletwInfoTable_CreateFromStream (twStream *s)
 Creates a new twInfoTable from data in a twStream. More...
 
void twInfoTable_Delete (void *it)
 Frees all memory associated with a twInfoTable structure and all its owned substructures. More...
 
twInfoTabletwInfoTable_FullCopy (twInfoTable *it)
 Creates a new twInfoTable structure and copies all data from an existing twInfoTable structure to the newly created twInfoTable structure. More...
 
twInfoTabletwInfoTable_ZeroCopy (twInfoTable *it)
 Creates a new twInfoTable structure which inherits all pointers of an existing twInfoTable structure it. The pointers of it will be zeroed so that it may be safely deleted. More...
 
int twInfoTable_Compare (twInfoTable *p1, twInfoTable *p2)
 Compares two twInfoTable structures for equivalence. More...
 
int twInfoTable_AddRow (twInfoTable *it, twInfoTableRow *row)
 Adds a twInfoTableRow to a twInfoTable. More...
 
twInfoTableRowtwInfoTable_GetEntry (twInfoTable *it, int index)
 Retrieves the twInfoTableRow from a twInfoTable at the specified (zero based) index. More...
 
int twInfoTable_ToStream (twInfoTable *it, twStream *s)
 Serializes a twInfoTable to a twStream. More...
 

Detailed Description

ThingWorx twInfoTable and twDataShape definitions and functions.

Function Documentation

int twDataShape_AddEntry ( struct twDataShape ds,
struct twDataShapeEntry entry 
)

Adds a new twDataShapeEntry to a twDataShape.

Parameters
[in]dsA pointer to the twDataShape to add the entry to.
[in]entryA pointer to the twDataShapeEntry to add.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
Note
The ds twDataShape takes ownership of the entry twDataShapeEntry.
twDataShape* twDataShape_Create ( twDataShapeEntry firstEntry)

Creates a new twDataShape structure.

Parameters
[in]firstEntryA pointer to a twDataShapeEntry to seed the twDataShape with. If NULL and empty datashape is created.
Returns
A pointer to the newly allocated twDataShape. Returns NULL on failure.
Note
The calling function gains ownership of the twDataShape and is responsible for freeing it via twDataShape_Delete().
twDataShape* twDataShape_CreateFromStream ( struct twStream s)

Creates a new twDataShape structure from data in a twStream.

Parameters
[in]sA pointer to a twStream to parse.
Returns
A pointer to the newly allocated twDataShape. Returns NULL on failure.
Note
The calling function gains ownership of the twDataShape and is responsible for freeing it via twDataShape_Delete().
void twDataShape_Delete ( void *  ds)

Frees all memory associated with a twDataShape structure and all its owned substructures.

Parameters
[in]entryA pointer to the twDataShape structure to delete.
Returns
Nothing.
int twDataShape_GetEntryIndex ( struct twDataShape ds,
const char *  name,
int *  index 
)

Gets the index of the twDataShapeEntry with the specified name.

Parameters
[in]dsA pointer to the twDataShape to get the index from.
[in]nameThe name of the field to get the index of.
[out]indexThe field index (0 based) of name if successful.
Returns
#TW_OK is successful, positive integral on error code (see twErrors.h) if an error was encountered.
uint32_t twDataShape_GetLength ( struct twDataShape ds)

Retrieves the length of a twDataShape.

Parameters
[in]entryA pointer to the twDataShape to retrieve the length of.
Returns
The length of entry.
Note
The length returned is calculated as if it were serialized to a twStream.
int twDataShape_SetName ( struct twDataShape ds,
char *  name 
)

Sets the name of a twDataShape.

Parameters
[in]dsA pointer to the twDataShape to set the name of.
[in]sThe name to set the twDataShape to.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
Note
The ds twDataShape does not take ownership of the s string.
struct cJSON* twDataShape_ToJson ( twDataShape ds,
struct cJSON parent 
)

Helper function that outputs a twDataShape to a cJSON object.

Parameters
[in]dsThe twDataShape to convert.
[in]parentThe optional parent twDataShape to add the result to.
Returns
A pointer to the newly allocated cJSON object. Returns NULL if an error was encountered.
int twDataShape_ToStream ( struct twDataShape ds,
twStream s 
)

Serializes a twDataShape to a twStream.

Parameters
[in]entryA pointer to the twDataShape to serialize.
[in,out]sA pointer to the twStream to serialize to.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
twDataShapeAspect* twDataShapeAspect_Create ( const char *  name,
twPrimitive value 
)

Creates a new twDataShapeAspect structure.

Parameters
[in]nameName of the aspect.
[in]valueA pointer to a primitive containing the BaseType and value of the aspect.
Returns
A pointer to the newly allocated twDataShapeAspect. Returns NULL on failure.
Note
The calling function gains ownership of the returned twDataShapeAspect and is responsible for freeing it via twDataShapeAspect_Delete().
twDataShapeAspect* twDataShapeAspect_CreateFromStream ( twStream s)

Creates a new twDataShapeAspect structure from data in a twStream.

Parameters
[in]streamA pointer to the twStream to parse.
Returns
A pointer to the newly allocated twDataShapeAspect. Returns NULL on failure.
Note
The calling function gains ownership of the returned twDataShapeAspect and is responsible for freeing it via twDataShapeAspect_Delete().
void twDataShapeAspect_Delete ( void *  aspect)

Frees all memory associated with a twDataShapeAspect and all its owned substructures.

Parameters
[in]aspectA pointer to the twDataShapeAspect to delete.
Returns
Nothing.
int twDataShapeEntry_AddAspect ( struct twDataShapeEntry entry,
const char *  name,
twPrimitive value 
)

Creates a new twDataShapeAspect with twDataShapeAspect::value value and adds it to the specified twDataShapeEntry entry.

Parameters
[in]entryA pointer to the twDataShapeEntry to add the twDataShapeAspect to.
[in]nameName of the aspect.
[in]valueA pointer to a primitive containing the BaseType and value of the aspect.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
Note
The twDataShapeEntry entry will gain ownership of the newly allocated twDataShapeAspect.
twDataShapeEntry* twDataShapeEntry_Create ( const char *  name,
const char *  description,
enum BaseType  type 
)

Creates a new twDataShapeEntry structure.

Parameters
[in]nameName of the field.
[in]valueA description of the field.
[in]typeThe BaseType associated with the field.
Returns
A pointer to the newly allocated twDataShapeEntry. Returns NULL on failure.
Note
The calling function gains ownership of the returned twDataShapeEntry and is responsible for freeing it via twDataShapeEntry_Delete().
twDataShapeEntry* twDataShapeEntry_CreateFromStream ( struct twStream s)

Creates a new twDataShapeEntry structure from data in a twStream.

Parameters
[in]sA pointer to the twStream to parse.
Returns
A pointer to the newly allocated twDataShapeEntry. Returns NULL on failure.
Note
The calling function gains ownership of the returned twDataShapeEntry and is responsible for freeing it via twDataShapeEntry_Delete().
void twDataShapeEntry_Delete ( void *  entry)

Frees all memory associated with a twDataShapeEntry structure and all its owned substructures.

Parameters
[in]entryA pointer to the twDataShapeEntry structure to delete.
Returns
Nothing.
uint32_t twDataShapeEntry_GetLength ( struct twDataShapeEntry entry)

Retrieves the length of a twDataShapeEntry.

Parameters
[in]entryA pointer to the twDataShapeEntry to retrieve the length of.
Returns
The length of entry.
Note
The length returned is calculated as if it were serialized to a twStream.
int twDataShapeEntry_ToStream ( struct twDataShapeEntry entry,
twStream s 
)

Serializes a twDataShapeEntry to a twStream.

Parameters
[in]entryA pointer to the twDataShapeEntry to serialize.
[in,out]sA pointer to the twStream to serialize to.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
Note
The calling function retains ownership of the s pointer and is responsible for freeing it via twStream_Delete().
int twInfoTable_AddRow ( twInfoTable it,
twInfoTableRow row 
)

Adds a twInfoTableRow to a twInfoTable.

Parameters
[in]itA pointer to the twInfoTable to add the twInfoTableRow to.
[in]rowA pointer to the twInfoTableRow to add.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
Note
The it twInfoTable will gain ownership of the row twInfoTableRow.
int twInfoTable_Compare ( twInfoTable p1,
twInfoTable p2 
)

Compares two twInfoTable structures for equivalence.

Parameters
[in]p1A pointer to the twInfoTable to compare against.
[in]p2A pointer to the twInfoTable to compare.
Returns
0 if the two twInfoTable structures are identical, 1 if they are not, -1 if an error was encountered.
twInfoTable* twInfoTable_Create ( twDataShape shape)

Creates a new twInfoTable.

Parameters
[in]shapeA pointer to the twDataShape that the twInfoTable will use.
Returns
A pointer to the newly allocated twInfoTable. Returns NULL on failure.
Note
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
twInfoTable* twInfoTable_CreateFromBlob ( const char *  name,
char *  value,
int32_t  length,
char  isImage,
char  duplicate 
)

Helper function to create a twInfoTable with a single field and single row containing a TW_BLOB or TW_IMAGE.

Parameters
[in]nameThe name to assign to the field.
[in]valueA pointer to the char array containing the blob or image.
[in]lengthThe length of the array.
[in]isImageFlag indicating whether value is an TW_IMAGE (#TRUE) or a TW_BLOB (#FALSE).
[in]duplicateFlag to indicate duplication preference. If set to TRUE, value will be copied. If set to FALSE, the twInfoTable will take ownership of /p value.
Returns
A pointer to the resulting twInfoTable. Returns NULL if an error was encountered.
Note
The created twInfoTable does not take ownership of the twLocation pointer.
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
twInfoTable* twInfoTable_CreateFromBoolean ( const char *  name,
char  value 
)

Helper function to create a twInfoTable with a single field and single row containing a TW_BOOLEAN.

Parameters
[in]nameThe name to assign to the field.
[in]valueThe boolean value to create the twInfoTable from.
Returns
A pointer to the resulting twInfoTable. Returns NULL if an error was encountered.
Note
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
twInfoTable* twInfoTable_CreateFromDatetime ( const char *  name,
DATETIME  value 
)

Helper function to create a twInfoTable with a single field and single row containing a TW_DATETIME.

Parameters
[in]nameThe name to assign to the field.
[in]valueThe DATETIME value to create the twInfoTable from.
Returns
A pointer to the resulting twInfoTable. Returns NULL if an error was encountered.
Note
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
twInfoTable* twInfoTable_CreateFromInteger ( const char *  name,
int32_t  value 
)

Helper function to create a twInfoTable with a single field and single row containing a TW_INTEGER.

Parameters
[in]nameThe name to assign to the field.
[in]valueThe value to create the twInfoTable from.
Returns
A pointer to the resulting twInfoTable. Returns NULL if an error was encountered.
Note
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
twInfoTable* twInfoTable_CreateFromJson ( struct cJSON json,
char *  singleEntryName 
)

Helper function that creates a twInfoTable from a cJSON object. If the JSON object does not represent a valid twInfoTable, a twInfoTable with a single field, single row, of type JSON will be created.

Parameters
[in]jsonThe cJSON object to convert to a twInfoTable.
[in]singleEntryNameThe name of the field to use for a single entry table (may be NULL, defaults to "_content_").
Returns
A pointer to the newly allocated twInfoTable. Returns NULL if an error was encountered.
Note
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
Warning
Using this function will cause the cJSON library to be linked to your application, increasing the size of the application by ~22KB.
twInfoTable* twInfoTable_CreateFromLocation ( const char *  name,
twLocation value 
)

Helper function to create a twInfoTable with a single field and single row containing a TW_LOCATION.

Parameters
[in]nameThe name to assign to the field.
[in]valueA pointer to the twLocation structure to create the twInfoTable from.
Returns
A pointer to the resulting twInfoTable. Returns NULL if an error was encountered.
Note
The created twInfoTable does not take ownership of the twLocation pointer.
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
twInfoTable* twInfoTable_CreateFromNumber ( const char *  name,
double  value 
)

Helper function to create a twInfoTable with a single field and single row containing a TW_NUMBER.

Parameters
[in]nameThe name to assign to the field.
[in]valueThe value to create the twInfoTable from.
Returns
A pointer to the resulting twInfoTable. Returns NULL if an error was encountered.
Note
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
twInfoTable* twInfoTable_CreateFromPrimitive ( const char *  name,
twPrimitive value 
)

Helper function to create a twInfoTable with a single field and single row containing a type and value specified by value.

Parameters
[in]nameThe name to assign to the field.
[in]valueA pointer to the twPrimitive structure to create the twInfoTable from.
Returns
A pointer to the resulting twInfoTable. Returns NULL if an error was encountered.
Note
The returned twInfoTable will not take ownership of the twPrimitive . The ownership of the twPrimitive is retained by the calling function and must be freed via twPrimitive_Delete().
twInfoTable* twInfoTable_CreateFromStream ( twStream s)

Creates a new twInfoTable from data in a twStream.

Parameters
[in]sA pointer to the twStream to parse.
Returns
A pointer to the newly allocated twInfoTable. Returns NULL on failure.
Note
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
twInfoTable* twInfoTable_CreateFromString ( const char *  name,
char *  value,
char  duplicate 
)

Helper function to create a twInfoTable with a single field and single row containing a TW_STRING.

Parameters
[in]nameThe name to assign to the field.
[in]valueA pointer to the string to create the twInfoTable from.
[in]duplicateFlag to indicate duplication preference. If set to TRUE, value will be copied. If set to FALSE, the twInfoTable will take ownership of /p value.
Returns
A pointer to the resulting twInfoTable. Returns NULL if an error was encountered.
Note
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
void twInfoTable_Delete ( void *  it)

Frees all memory associated with a twInfoTable structure and all its owned substructures.

Parameters
[in]entryA pointer to the twInfoTable structure to delete.
Returns
Nothing.
twInfoTable* twInfoTable_FullCopy ( twInfoTable it)

Creates a new twInfoTable structure and copies all data from an existing twInfoTable structure to the newly created twInfoTable structure.

Parameters
[in]itA pointer to the twInfoTable to be copied from.
Returns
A pointer to the newly allocated structure. Returns NULL on error.
Note
The original twInfoTable structure it will not be modified. The calling function will therefore retain ownership of it and is responsible for freeing it via twInfoTable_Delete().
The calling function will gain ownership of the returned structure and will be responsible for freeing it via twInfoTable_Delete().
int twInfoTable_GetBlob ( twInfoTable it,
const char *  name,
int32_t  row,
char **  value,
int32_t *  length 
)

Helper function to retrieve a TW_BLOB from a twInfoTable.

Parameters
[in]itA pointer to the twInfoTable to get the value from.
[in]nameThe name of the field to retrieve.
[in]rowThe (zero based) index of the row from which to retrieve the value.
[in]valueA pointer to store the retrieved data in.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
int twInfoTable_GetBoolean ( twInfoTable it,
const char *  name,
int32_t  row,
char *  value 
)

Helper function to retrieve a TW_BOOLEAN from a twInfoTable.

Parameters
[in]itA pointer to the twInfoTable to get the value from.
[in]nameThe name of the field to retrieve.
[in]rowThe (zero based) index of the row from which to retrieve the value.
[in]valueA pointer to store the retrieved data in.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
int twInfoTable_GetDatetime ( twInfoTable it,
const char *  name,
int32_t  row,
DATETIME value 
)

Helper function to retrieve a TW_DATETIME from a twInfoTable.

Parameters
[in]itA pointer to the twInfoTable to get the value from.
[in]nameThe name of the field to retrieve.
[in]rowThe (zero based) index of the row from which to retrieve the value.
[in]valueA pointer to store the retrieved data in.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
twInfoTableRow* twInfoTable_GetEntry ( twInfoTable it,
int  index 
)

Retrieves the twInfoTableRow from a twInfoTable at the specified (zero based) index.

Parameters
[in]itA pointer to the twInfoTable to retrieve the twInfoTableRow from.
[in]indexThe zero based index of the twInfoTableRow to retrieve.
Returns
A pointer to the twInfoTableRow retrieved. Returns NULL if an error was encountered.
Note
The twInfoTable will retain ownership of the twInfoTableRow. The calling function should not</not> delete/free it.
int twInfoTable_GetInteger ( twInfoTable it,
const char *  name,
int32_t  row,
int32_t *  value 
)

Helper function to retrieve a TW_INTEGER from a twInfoTable.

Parameters
[in]itA pointer to the twInfoTable to get the value from.
[in]nameThe name of the field to retrieve.
[in]rowThe (zero based) index of the row from which to retrieve the value.
[in]valueA pointer to store the retrieved data in.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
int twInfoTable_GetLocation ( twInfoTable it,
const char *  name,
int32_t  row,
twLocation value 
)

Helper function to retrieve a TW_LOCATION from a twInfoTable.

Parameters
[in]itA pointer to the twInfoTable to get the value from.
[in]nameThe name of the field to retrieve.
[in]rowThe (zero based) index of the row from which to retrieve the value.
[in]valueA pointer to store the retrieved data in.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
int twInfoTable_GetNumber ( twInfoTable it,
const char *  name,
int32_t  row,
double *  value 
)

Helper function to retrieve a TW_NUMBER from a twInfoTable.

Parameters
[in]itA pointer to the twInfoTable to get the value from.
[in]nameThe name of the field to retrieve.
[in]rowThe (zero based) index of the row from which to retrieve the value.
[in]valueA pointer to store the retrieved data in.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
int twInfoTable_GetPrimitive ( twInfoTable it,
const char *  name,
int32_t  row,
twPrimitive **  value 
)

Helper function to retrieve a twPrimitive from a twInfoTable.

Parameters
[in]itA pointer to the twInfoTable to get the value from.
[in]nameThe name of the field to retrieve.
[in]rowThe (zero based) index of the row from which to retrieve the value.
[in]valueA pointer to store the retrieved data in.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
int twInfoTable_GetString ( twInfoTable it,
const char *  name,
int32_t  row,
char **  value 
)

Helper function to retrieve a TW_STRING from a twInfoTable.

Parameters
[in]itA pointer to the twInfoTable to get the value from.
[in]nameThe name of the field to retrieve.
[in]rowThe (zero based) index of the row from which to retrieve the value.
[in]valueA pointer to store the retrieved data in.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
struct cJSON* twInfoTable_ToJson ( twInfoTable it)

Helper function that outputs a twInfoTable to a cJSON object.

Parameters
[in]itThe twInfoTable to convert.
Returns
A pointer to the newly allocated cJSON object. Returns NULL if an error was encountered.
Note
The caller will gain ownership of the cJSON object and is responsible for deleting it via cJSON_Delete().
Warning
Using this function will cause the cJSON library to be linked to your application, increasing the size of the application by ~22KB.
int twInfoTable_ToStream ( twInfoTable it,
twStream s 
)

Serializes a twInfoTable to a twStream.

Parameters
[in]itA pointer to the twInfoTable to serialize.
[in,out]sA pointer to the twStream to serialize to.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
twInfoTable* twInfoTable_ZeroCopy ( twInfoTable it)

Creates a new twInfoTable structure which inherits all pointers of an existing twInfoTable structure it. The pointers of it will be zeroed so that it may be safely deleted.

Parameters
[in]itA pointer to the twInfoTable to be copied from and zeroed.
Returns
A pointer to the newly allocated twInfoTable. Returns NULL on failure.
Note
The calling function gains ownership of the returned twInfoTable and is responsible for freeing it via twInfoTable_Delete().
twInfoTable_ZeroCopy() does not free /p it. It only zeros the pointers of it so that the base structure it may be deleted without modifying the newly created twInfoTable. The calling function must still free it via twInfoTable_Delete().
int twInfoTableRow_AddEntry ( twInfoTableRow row,
twPrimitive entry 
)

Adds a new twPrimitive to a twInfoTableRow.

Parameters
[in]rowA pointer to the twInfoTableRow to add the entry to.
[in]entryA pointer to the twPrimitive to add.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
Note
The ds twInfoTableRow takes ownership of the entry twPrimitive.
twInfoTableRow* twInfoTableRow_Create ( twPrimitive firstEntry)

Creates a new twInfoTableRow.

Parameters
[in]firstEntryA pointer to a twPrimitive to seed the twInfoTableRow with.
Returns
A pointer to the newly allocated twInfoTableRow. Returns NULL on failure.
Note
The calling function gains ownership of the returned twInfoTableRow and is responsible for freeing it via twInfoTableRow_Delete().
twInfoTableRow* twInfoTableRow_CreateFromStream ( twStream s)

Creates a new twInfoTableRow from data in a twStream.

Parameters
[in]sA pointer to the twStream to parse.
Returns
A pointer to the newly allocated twInfoTableRow. Returns NULL on failure.
Note
The calling function gains ownership of the returned twInfoTableRow and is responsible for freeing it via twInfoTableRow_Delete().
void twInfoTableRow_Delete ( void *  row)

Deletes a twInfoTableRow structure and frees all memory associated with it.

Parameters
[in]entryA pointer to the twInfoTableRow structure to delete.
Returns
Nothing.
int twInfoTableRow_GetCount ( twInfoTableRow row)

Gets the number of fields in a twInfoTableRow.

Parameters
[in]rowA pointer to the twInfoTableRow get the number of fields of.
Returns
The number of fields in row if successful, positive integral on error code (see twErrors.h) if an error was encountered.
twPrimitive* twInfoTableRow_GetEntry ( twInfoTableRow row,
int  index 
)

Gets the twPrimitive value of an entry in a twInfoTableRow.

Parameters
[in]rowA pointer to the twInfoTableRow to get the value from.
[in]indexThe (zero based) index of the field to retrieve.
Returns
A pointer to the twPrimitive at index index of row. Returns NULL if an error occurred.
uint32_t twInfoTableRow_GetLength ( twInfoTableRow row)

Gets the length of a twInfoTableRow.

Parameters
[in]rowA pointer to the twInfoTableRow get the length of.
Returns
The length of row.
Note
The length returned is calculated as if it were serialized to a twStream.
int twInfoTableRow_ToStream ( twInfoTableRow row,
twStream s 
)

Serializes a twInfoTableRow to a twStream.

Parameters
[in]rowA pointer to the twInfoTableRow to serialize.
[in,out]sA pointer to the twStream to serialize to.
Returns
#TW_OK if successful, positive integral on error code (see twErrors.h) if an error was encountered.
Note
The calling function retains ownership of s and is responsible for freeing it via twStream_Delete().