IDS declaration

## 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

## IDS declaration

The `ids` declaration declares a private, internal data structure.

The internal data structure stores global data shared by the services. Access to this structure is controlled by Genom, that takes care of the proper synchronization between concurrent access.

An IDS definition is similar to a `struct` definition, and follows this syntax:

(19) `ids ::=` | `ids-name` `"{"` `member-list` `"}"` `";"`
(20) `ids-name ::=` | `"ids"`
(96) `member-list ::=` | `{` `member` `";"` `}` `member` `";"`
(97) `member ::=` | `(` `type-spec` `|` `member` `","` `)` `declarator`

The major difference with a regular `struct` is that an `ids` declaration can be reopened. Thus, several `ids` statements can be used to define an internal structure by independent chunks. This is useful for instance in case of included files.

### Example

This would define the `ids` for the component `foo`, using two separate declarations:

    component foo {
      ids {
        long state;
      };

      ids {
        double position;
        double velocity;
      };
    };