Up: Binding   [Contents][Index]


10.6.2.1 Using Injection

Binding of injected ports is done at a higher system level (see Components). A wild-card character (*) is used to achieve the binding of the provides port of a single instance to all injected requires ports.

Let’s take a logging interface as an example:

interface ilog
{
  ...
}
component logger
{
  provides ilog log;
  ...
}

Suppose a lot of components require logging:

...
component some_component12
{
  provides some_interface12 p;
  requires injected ilog l;
  ...
}
component some_component13 {
  provides some_interface13 p;
  requires injected ilog l;
  ...
}
...

then some system component can bind all logging in one go:

component some_system
{
  ...
  system
  {
    logger clog;
    ...
    some_component12 c12;
    some_component13 c13;
    ...
    clog.log <=> *;
  }
}

It is allowed to group some components in a sub system:

component some_sub_system
{
  ...
  system {
    ...
    some_component12 c12;
    some_component13 c13;
    ...
  }
}

and use the wild-card binding for that sub system:

component some_system
{
  ...
  system
  {
    logger clog;
    some_sub_system subsys;
    ...
    clog.log <=> subsys.*;
  }
}