Next: , Up: Creating a Component   [Contents][Index]


3.3.1 Component Syntax

A component declaration is named, and introduces a list of provides and requires interfaces and optionally behaviour or a system.

1) component CompName
   // placeholder for component implemented in another programming language
   {
     provides CompInterface compinterface; // list of provided interfaces
     requires UsedInterface usedinterface; // list of required interfaces
    }
2) component CompName
   {
   // component with behaviour
     provides CompInterface compinterface; // list of provided interfaces
     requires UsedInterface usedinterface; // list of required interfaces
     behaviour   // behaviour
     { ...  }
   }
3) component CompName
   {
   // system component
     provides CompInterface compinterface; // list of provided interfaces
     requires UsedInterface usedinterface; // list of required interfaces
     system   // system
     { ...  }
   }

3.3.1.1 Examples

3.3.1.2 A component that will be implemented in another programming language

This component has no implementation. It represents a component implemented in another programming language.

component CompName
{
  provides CompInterface compinterface;
}

3.3.1.3 A Component Implementing One Interface and a Simple Behaviour

The following component implements one interface and a straightforward behaviour section.

component Leaf
{
  provides ISensor ctrl;
    behaviour
    {
        on ctrl.event(): { }
    }
}

3.3.1.4 A Component Decomposed Into Two Components

A component decomposed into two components where these components are connected via their ports.

component Composition
{
  provides CompInterface compinterface;
  system
  {
    Comp1 comp1instance;
    Comp2 comp2instance;
    comp1instance.port1 <=> comp2instance.port2;
  }
}

See also: