Studio:SCL Data Types

From STRIDE Wiki
Revision as of 00:09, 21 August 2009 by Timd (talk | contribs) (Text replace - 'Category: SCL' to 'Category:Studio:SCL')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

SCL Data Types

Data can optionally be associated with messages, remote function calls (RFCs), and trace points. The STRIDE Communication Language (SCL) defines the allowable data types used for describing the contents, and specifies the set of constraints required to enable the runtime environment to properly marshal the data across platform boundaries. Data is specified using the standard syntax found in the C language and a defined set of pragmas. The SCL supports all C basic data types, bit fields, enumerations, structures, unions, typedefs, arrays, and pointers. In addition, the SCL supports the C++-style tag name used for enumerations, structures, and unions. Any combination of these types can be used when defining data, with only a limited set of constraints.

The different data objects associated with a message are the command payload, response payload, OutPointers, and function pointers.

  • Command and response payloads and their names are the defined data structures that represent the contents of the message.
  • OutPointers represent the pointer data defined in the command payload but populated as part of the response. OutPointers only contain pointer data that has been assigned an OUT or INOUT directional attribute.
  • A function pointer data type as written in ANSI C merely specifies the format of the prototype. The format of the prototype is the data type of the return value and the datatypes of the parameters, if any. The scl_ptr_flist pragma is therefore required by the SCL compiler to indicate which SCL-compatible interfaces are associated with a particular function pointer data type.

Pointers that have been assigned the IN directional attribute are considered to be part of the corresponding payload. All pointers are required to have an assigned directional attribute. The command data represents the input required by the service Owner. The response data, which includes the response payload and OutPointers, represents the output generated by the service Owner.

The following data objects are also associated with a function:

  • The ParameterList represents the data passed into the function by the user and processed by the owner. Pointers assigned the IN directional attribute are considered to be part of the ParameterList.
  • The Return Value represents the data returned by the function owner, such as output data.
  • The OutPointer represents the pointer data defined as part of the ParameterList but populated as part of the output, such as output data generated by the owner. As with messages, OutPointers only contain pointer data that has been assigned the OUT or INOUT directional attribute.

Basic Data Types

The SCL supports the following basic data types:

  • char
  • int
  • float
  • double

The SCL also supports the following qualifiers:

  • unsigned char
  • short int
  • unsigned short int
  • long int
  • unsigned long int

The short and long qualifiers provide different integer lengths. Int is typically used to represent the natural integer size of the platform being used, while short and long represent 16-bit and 32-bit integers, respectively. Int is often omitted from the declaration when using these qualifiers.

The following example demonstrates how to use basic data types with qualifiers:

#define MY_SMID1 1 + ( MT_ONE | ST_CMD_VAL )
#define MY_FUNC1 2

typedef short MyShort;

void MyFunc1(short MyShort);

#pragma scl_msg(MY_SMID1, MyShort)
#pragma scl_function(MY_FUNC1, MyFunc1)

See Also

  • SCL Pragmas
  • Refer to the SCL Wizard section of the STRIDE Online Help for information on how to create SCL pragmas.