$type TCL engine command

## Contents

- Your rights

- Introduction

- Component model

- Component description file

- GenoM IDL mappings

- Running GenoM

- Tutorials

- Templates

  - Skeleton

  - Mappings

  - Interactive

  - Creating Templates

    - `template` command

    - `engine` command

    - `dotgen` command

    - `language` command

    - `$type` command

    - `$component` command

    - `$port` command

    - `$task` command

    - `$service` command

    - `$codel` command

    - `$param` command

## $type TCL engine command

Those commands manipulate IDL type objects and return information about them. They all take a type object as their first argument, noted `$type` in the following command descriptions. Such an object is typically returned by other procedures, such as `dotgen types`.

### $type kind

Return a string describing the nature of the IDL type, such as `long`, `double`, `struct` …​

### $type name

Return the name of the IDL type. No namespace components are included in the result.

### $type fullname

Return the fully qualified name of the IDL type. The result includes the namespace hierarchy in which the type is defined and the last component is the result of `$type name`.

### $type scope

Return the list of lexical scopes in which the type is defined. Each element of the list contains two values: the nature of the scope and its name. The nature of the scope will be either `module` for IDL modules, or `struct` if the type is defined inside an IDL `struct`.

### $type fixed

Return a boolean indicating if the type is of fixed, constant size (true) or not (false).

### $type final

Return a new type object with all aliases resolved. For `const` types, this returns the type of the constant. For `typedef`, this return the first non-aliased type. For `struct` and `union` members, this returns the type of the member.

### $type parent

Return the parent type of a nested type definition, or raise an error if the type is not nested.

### $type nested

Return the nested types defined by the given type

### $type types ['filter']

Return the list of all types that are recursively used by the given type. In other words, this is the list of types that must be known in order to completely define the given `$type`.

For all basic types such as `long`, `double` and so forth, the returned list is empty. For enumerated types, the result is the list of enumerators. For aggregates such as `struct`, `union` or `exception`, the result is the list of all members, expanded recursively with the same rules. Finally, for `array`s or `sequence`s, this returns the type of the array or sequence elements, recursively expanded.

Arguments

'filter' | The optional filter can be used to filter out some elements from the type list. The filter must be a tcl anonymous function (see tcl `[apply]` command) that accepts one argument that is a genom object. It must return a boolean to indicate whether the type should be included (true) or excluded (false).

### $type type

Return the underlying type of a type that contains another type definition. For instance, this procedure invoked on an `array` or `sequence` type returns the element type. It returns the aliased type for `typedef`.

### $type length

Return the length of an `array`, `sequence` or `string` type.

### $type value

Return the value associated with a `const` type.

### $type valuekind

Return the nature of the value associated with a `const` type.

### $type members

Return a list of types defined by the given `struct`, `union` or `enum` type.

### $type discriminator

Return the discriminator of the given `union`.

### $type port

Return the port object referenced by the given `port`.

### $type remote

Return the remote object referenced by the given `remote`.

### $type cname

Return a string representing the type name in the current language.

### $type mangle

Return a string uniquely describing the given type, suitable for use as an identifier in source code written in the current programming language.

### $type mapping

Return an ASCII string representing the implementation (definition) of the given type, suitable for use in source code written in the current programming language.

### $type declarator ['var'] ['qualifier']

Return the declarator for $type with optional 'qualifier' or for a variable 'var' of that type, in the current language.

Arguments

'var' | The variable being declared. If not given, an abstract declarator is returned.

### $type address 'var'

Return an expression representing the address of a variable of the given type in the current language.

Arguments

'var' | The variable of which the address must be taken.

### $type argument value|reference ['var']

Return an expression that declares a parameter 'var' of the given type, passed by value or reference according to the second parameter.

Arguments

'var' | The argument name being declared. If not given, an abstract declarator is returned.

### $type pass value|reference 'var'

Return an expression that passes a variable 'var' of the given type as a function parameter. The variable is passed by value or reference according to second argument.

Arguments

'var' | The variable that must be passed.

### $type dereference value|reference 'var'

Return an expression that retrieves the value of a parameter 'var', passed by value or reference according to the second argument.

Arguments

'var' | The argument name.

### $type digest

Return an ASCII representaion (32 characters) of an MD5 digest of the given type. This is useful for implementing a cheap runtime verification that two types match.

### $type masquerade

Return any value defined in a `#pragma masquerade` for that type, if the current template matches the corresponding parameter of the `#pragma`. See `#pragma masquerade`.

### $type loc [file|line|column|context]

Return a list describing the source location where that type is defined. The list contains four elements: the file name, the line number, the column number and the original component context of the definition. If an optional argument is given, only the corresponding element is returned.

### $type class

Always returns the string "type". Useful to determine at runtime that the object is a type object.