We’re here to help you

Menu

Creating a Component

Three types of components can be defined in Dezyne:

  • The first type is a component that has only a name defined and has no implementation. In Dezyne this is a placeholder for a component that is implemented in a regular programming language.

  • The second type is a component that has an implementation marked by the ‘behaviour’ keyword.

  • The third type is a component decomposed into others that has an implementation marked by the 'system' keyword. The system specifies contained component instances, see further Decomposing a component.

Syntax

A component declaration is named and introduces a list of provides and requires interfaces, and it may include a behaviour specification in a "behaviour {…​}" block or a system composition in a "system {…​}" block.

1) component CompName
   // placeholder for component implemented in a regular 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
     { ... }
   }

Examples

A component that will be implemented in a regular programming language

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

component CompName
{
  provides CompInterface compinterface;
}

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(): { }
    }
}

A component decomposed into two components

A component decomposed into two components where these components are connected via their ports. See further Decomposing a component

component Composition
{
  provides CompInterface compinterface;

  system
  {
    Comp1 comp1instance;
    Comp2 comp2instance;

    comp1instance.port1 <=> comp2instance.port2;
  }
}

If you have questions that weren’t answered by this Guide,
let our support team help you out.

Enjoy this article? Don't forget to share.
google-site-verification:google656c7703ab521151.html