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

## $service TCL engine command

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

### $service name

Return the name of the service as a string.

### $service kind

Return a string that is either `attribute`, `function` or `activity` depending on the kind of service.

### $service visibility

Return either `hidden` or `default` depending on the visibility of the service.

### $service component

Return the component object in which the service is defined.

### $service doc

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

### $service before

Return a list of services that cannot run until this service has been executed sucessfully at least once.

### $service after

Return a list of services that must must have been successfully executed at least once before this service can run.

### $service interrupts

Return a list of services that will be interrupted whenever this service is executed.

### $service task

Return the task object in which the service is defined, or an error if the service has no task context (i.e. the service is an `attribute` or a `function).

### $service throws

Return a list of `exceptions` possibly raised by the service.

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

Return the list of codels defined in the service. 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.

### $service params [[local|in|out|inout] …​]

Return the list of parameters of the service. One or several direction filter may be specified to filter the list according to the or’ed combination of the directions.

Arguments

'local' | The parameters that are private to the running instance of the service.
'in' | The parameters that input to the service.
'out' | The parameters that output by the service.
'inout' | The parameters that both input to and output by the service.

### $service fsm ['state'] [type|codel]

When called without argument, `$service fsm` returns the list of states defined in the finite state machine of the service.

When called with one of the states (or state name) as argument, optionally followed by the `codel` keyword, the procedure returns the codel object associated with that state.

When called with one of the states name as argument and the `type` keyword, the type object associated with that state is returned.

### $service mutex

Return a list of `codels` that may access internal resources used by the service. All these codels cannot run when the service is running.

### $service digest

Return a string containing a MD5 hash of the service. The hash is computed using the service name and the ordered list of parameters direction and type.

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

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

### $service class

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