ThingWorx C SDK
Macros
Declaration Macros for Things, Shapes and Templates

Macros

#define TW_DECLARE_SHAPE(aThingName, shapeName, thing_namespace)   const char* _tw_thing_name=aThingName;const char* _tw_thing_namespace = thing_namespace;const char* _tw_shape_name=shapeName;TW_UNUSED_VARIABLE(_tw_thing_namespace);TW_UNUSED_VARIABLE(_tw_thing_name);TW_UNUSED_VARIABLE(_tw_shape_name);
 Declares a set of standard variables defining a ThingShape. This macro is used to establish the ThingName, ShapeName and Namespace used in future macro calls. More...
 
#define TW_SHAPE(aThingName, shapeName, thing_namespace)   const char* _tw_thing_name=aThingName;const char* _tw_thing_namespace = thing_namespace;const char* _tw_shape_name=shapeName;TW_UNUSED_VARIABLE(_tw_thing_namespace);TW_UNUSED_VARIABLE(_tw_thing_name);TW_UNUSED_VARIABLE(_tw_shape_name);
 A briefer version of TW_DECLARE_SHAPE. Declares a set of standard variables defining a ThingShape. This macro is used to establish the ThingName, ShapeName and Namespace used in future macro calls. More...
 
#define TW_DECLARE_TEMPLATE(aThingName, templateName, inheritsTemplate)   const char* _tw_thing_name=aThingName;const char* _tw_thing_namespace = TW_NO_NAMESPACE;const char* _tw_template_name=templateName;twExt_InheritFromTemplate(aThingName, inheritsTemplate);TW_UNUSED_VARIABLE(_tw_thing_name);TW_UNUSED_VARIABLE(_tw_thing_namespace);TW_UNUSED_VARIABLE(_tw_template_name);
 Declares a set of standard variables defining a ThingTemplate. This macro is used to establish the ThingName, TemplateName and Namespace used in future macro calls. More...
 
#define TW_TEMPLATE(aThingName, templateName, inheritsTemplate)   const char* _tw_thing_name=aThingName;const char* _tw_thing_namespace = TW_NO_NAMESPACE;const char* _tw_template_name=templateName;twExt_InheritFromTemplate(aThingName, inheritsTemplate);TW_UNUSED_VARIABLE(_tw_thing_name);TW_UNUSED_VARIABLE(_tw_thing_namespace);TW_UNUSED_VARIABLE(_tw_template_name);
 A briefer version of TW_DECLARE_TEMPLATE. Declares a set of standard variables defining a ThingTemplate. This macro is used to establish the ThingName, TemplateName and Namespace used in future macro calls. More...
 
#define TW_DECLARE_EVENT(eventName, eventDescription, eventDataShape)   twApi_RegisterEvent(TW_THING, _tw_thing_name, eventName, eventDescription, eventDataShape);
 Creates a definition for an Event your application intends to emit at some point in the future and allows you to associate a DataShape describing the event's payload data. More...
 
#define TW_EVENT(eventName, eventDescription, eventDataShape)   twApi_RegisterEvent(TW_THING, _tw_thing_name, eventName, eventDescription, eventDataShape)
 

Detailed Description

Macro Definition Documentation

#define TW_DECLARE_EVENT (   eventName,
  eventDescription,
  eventDataShape 
)    twApi_RegisterEvent(TW_THING, _tw_thing_name, eventName, eventDescription, eventDataShape);

Creates a definition for an Event your application intends to emit at some point in the future and allows you to associate a DataShape describing the event's payload data.

A briefer version of TW_DECLARE_EVENT. Creates a definition for an Event your application intends to emit at some point in the future and allows you to associate a DataShape describing the event's payload data.

Parameters
eventNameconst char * [in] The identifying name for this Event.
eventDescriptionconst char * [in] An optional text description of the meaning of this event. If not provided use TW_NO_DESCRIPTION.
eventDataShapetwDataShape * [in] A DataShape describing the payload delivered with this event. Use the TW_MAKE_DATASHAPE macro to create a DataShape for this parameter.
Returns
TW_OK on success, {TW_INVALID_PARAM, TW_ERROR_ALLOCATING_MEMORY,TW_NULL_OR_INVALID_API_SINGLETON,TW_ERROR_ITEM_EXISTS} on failure
#define TW_DECLARE_SHAPE (   aThingName,
  shapeName,
  thing_namespace 
)    const char* _tw_thing_name=aThingName;const char* _tw_thing_namespace = thing_namespace;const char* _tw_shape_name=shapeName;TW_UNUSED_VARIABLE(_tw_thing_namespace);TW_UNUSED_VARIABLE(_tw_thing_name);TW_UNUSED_VARIABLE(_tw_shape_name);

Declares a set of standard variables defining a ThingShape. This macro is used to establish the ThingName, ShapeName and Namespace used in future macro calls.

Parameters
aThingNameconst char * [in] The name of the Thing that will be using this Shape.
shapeNameconst char * [in] The name of the Shape being declared.
thing_namespaceconst char * [in] a string used to prevent naming conflicts when different shapes are used together.
Returns
This macro does not return any value
#define TW_DECLARE_TEMPLATE (   aThingName,
  templateName,
  inheritsTemplate 
)    const char* _tw_thing_name=aThingName;const char* _tw_thing_namespace = TW_NO_NAMESPACE;const char* _tw_template_name=templateName;twExt_InheritFromTemplate(aThingName, inheritsTemplate);TW_UNUSED_VARIABLE(_tw_thing_name);TW_UNUSED_VARIABLE(_tw_thing_namespace);TW_UNUSED_VARIABLE(_tw_template_name);

Declares a set of standard variables defining a ThingTemplate. This macro is used to establish the ThingName, TemplateName and Namespace used in future macro calls.

Parameters
aThingNameconst char * [in] The name of the Thing that will be using this Template.
templateNameconst char * [in] The name of the Template being declared.
inheritsTemplateconst char * [in] the name of the registered template that this thing should be based on.
Returns
This macro does not return any value
#define TW_SHAPE (   aThingName,
  shapeName,
  thing_namespace 
)    const char* _tw_thing_name=aThingName;const char* _tw_thing_namespace = thing_namespace;const char* _tw_shape_name=shapeName;TW_UNUSED_VARIABLE(_tw_thing_namespace);TW_UNUSED_VARIABLE(_tw_thing_name);TW_UNUSED_VARIABLE(_tw_shape_name);

A briefer version of TW_DECLARE_SHAPE. Declares a set of standard variables defining a ThingShape. This macro is used to establish the ThingName, ShapeName and Namespace used in future macro calls.

Parameters
aThingNameconst char * [in] The name of the Thing that will be using this Shape.
shapeNameconst char * [in] The name of the Shape being declared.
thing_namespaceconst char * [in] a string used to prevent naming conflicts when different shapes are used together.
Returns
This macro does not return any value
#define TW_TEMPLATE (   aThingName,
  templateName,
  inheritsTemplate 
)    const char* _tw_thing_name=aThingName;const char* _tw_thing_namespace = TW_NO_NAMESPACE;const char* _tw_template_name=templateName;twExt_InheritFromTemplate(aThingName, inheritsTemplate);TW_UNUSED_VARIABLE(_tw_thing_name);TW_UNUSED_VARIABLE(_tw_thing_namespace);TW_UNUSED_VARIABLE(_tw_template_name);

A briefer version of TW_DECLARE_TEMPLATE. Declares a set of standard variables defining a ThingTemplate. This macro is used to establish the ThingName, TemplateName and Namespace used in future macro calls.

Parameters
aThingNameconst char * [in] The name of the Thing that will be using this Template.
templateNameconst char * [in] The name of the Template being declared.
inheritsTemplateconst char * [in] the name of the registered template that this thing should be based on.*
Returns
This macro does not return any value