$component 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

## $component TCL engine command

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

### $component name

Return the name of the component as a string.

### $component doc

Return a string containing the documentation of the component defined in the `doc` attributes of the `.gen` description.

### $component version

Return a string containing the version of the component defined in the `version` attribute of the `.gen` description.

### $component lang

Return a string containing the programming language of the component codels defined in the `lang` attribute of the `.gen` description.

### $component email

Return a string containing the maintainer e-mail of the component defined in the `email` attribute of the `.gen` description.

### $component clockrate

Return a numeric floating point constant representing the period of the internal component clock in seconds. This is either the value defined in the `clock-rate` attributes of the `.gen` description, or the greatest common divisor of all the periods of periodic tasks if no `clock-rate` is defined. If the component has no periodic tasks, this raises an error.

### $component stack

Return a integer constant representing the minimum stack size of all tasks of the component.

### $component ids

Return the `ids` `struct` type of the component.

### $component require

Return a list of strings containing the requirement of the component defined in the `require` attribute of the `.gen` description.

### $component codels-require

Return a list of strings containing the requirement of the component defined in the `codels-require` attribute of the `.gen` description.

### $component events

Return a list of `events` defined by the component. This is the concatenation of all trigger events and yielded events of codels and the standard `start`, `stop` and `ether` events.

### $component throws

Return a list of `exceptions` possibly raised by the component. This is the concatenation of all exceptions defined in the component itself and its tasks and services.

### $component tasks

Return the list of tasks defined in the commponent.

### $component ports [[in|out|simple|multiple] …​]

Return the list of ports defined in the commponent. The list may be filtered by a keyword described below. Multiple keyword may be given: they are combined with an implicit 'or'.

Arguments

'in' | Return the input ports.
'out' | Return the output ports.
'simple' | Return the ports that are not of kind `multiple`.
'multiple' | Return the ports that are of kind `multiple`.

### $component services

Return the list of services defined in the commponent.

### $component remotes

Return the list of remote services defined in the commponent.

### $component codels [[validate|simple|fsm] …​]

Return the list of codels defined in the commponent. The list may be filtered by a keyword described below. Multiple keyword may be given: they are combined with an implicit 'or'.

Arguments

'validate' | Return the validation codels.
'simple' | Return the simple codels of functions.
'fsm' | Return the codels associated with activities and a state machine.

### $component types ['visibility'] ['filter']

Return the list of types defined in the commponent. The list may be filtered according to a particular `visiblity` and a `filter` function.

Arguments

'visibility' | Must be one of `public`, `private` or `external`. 'public' Return the types that are used in services or ports and are thus exposed to clients. 'private' Return the types that are only used internally in the component and do not appear in any interface. 'external' Return the types that are used by remote services.
'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).

### $component digest ['filter']

Return a string containing a MD5 hash of the commponent. The hash is computed using relevant data of ports (name, kind, type) and services (name, parameters direction and type). The list of objects used in the hash may be filtered according to a particular `filter` function.

Arguments

'filter' | The optional 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 object should be included (true) or excluded (false) from the hash computation.

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

Return a list describing the source location where that component 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.

### $component class

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