IDL Template types

## Contents

- Your rights

- Introduction

- Component model

- Component description file

  - Preprocessing

  - Elements of a description file

  - Data type and constant definitions

  - Module declaration

  - Component declaration

  - Interface declaration

  - IDS declaration

  - Port declaration

  - Task declaration

  - Service declaration

  - Codel declaration

  - Identifiers and reserved keywords

  - Pragmas

  - Grammar reference

- GenoM IDL mappings

- Running GenoM

- Tutorials

- Templates

## IDL Template types

The template types are:

(88) `template-type-spec ::=` | `sequence-type` `|` `optional-type` `|` `string-type` `|` `fixed-type`

### Sequences

A sequence is a one-dimensional array with two characteristics: a maximum size (which is fixed at compile time) and a length (which is determined at run time).

(89) `sequence-type ::=` | `"sequence"` `"<"` `simple-type-spec` `(` `">"` `|` `","` `positive-int-const` `">"` `)`

The second parameter in a sequence declaration indicates the maximum size of the sequence. If a positive integer constant is specified for the maximum size, the sequence is termed a bounded sequence. If no maximum size is specified, size of the sequence is unspecified (unbounded).

Prior to passing a bounded or unbounded sequence as a function argument (or as a field in a structure or union), the length of the sequence must be set in a language- mapping dependent manner. After receiving a sequence as an input parameter, the length of the returned sequence will have been set; this value may be obtained in a language-mapping dependent manner.

A sequence type may be used as the type parameter for another sequence type. For example, the following: declares an “unbounded sequence of unbounded sequence of long”.

    sequence< sequence<long> >

Note that for nested sequence declarations, white space must be used to separate the two “>” tokens ending the declaration so they are not parsed as a single “>>”

### Optional

Optional types represent a value that may or may not be present.

(90) `optional-type ::=` | `"optional"` `"<"` `simple-type-spec` `">"`

The parameter of the 'optional' declaration describes the data type of the value.

### Strings

A string is similar to a sequence of char.

(91) `string-type ::=` | `"string"` `[` `"<"` `positive-int-const` `">"` `]`

The argument to the string declaration is the maximum size of the string. If a positive integer maximum size is specified, the string is termed a bounded string; if no maximum size is specified, the string is termed an unbounded string. Strings are singled out as a separate type because many languages have special built-in functions or standard library functions for string manipulation. A separate string type may permit substantial optimization in the handling of strings compared to what can be done with sequences of general types.

### Fixed type

The ﬁxed data type represents a fixed-point decimal number

(92) `fixed-type ::=` | `"fixed"` `[` `"<"` `positive-int-const` `","` `positive-int-const` `">"` `]`

Caution | Fixed types are not properly handled in existing genom templates. You must not use them at the moment.