Next: , Previous: , Up: Individual Armour cases   [Contents]


7.3.2 ArmourIIPRB (IllegalInProvidesReturnsBool)

A provided interface may have an illegal in-event with a bool return type. The system diagram shows the armour at the provides port of the Dezyne component:

ArmourIIPRB

We only deal with one bool in-event and one void out-event. The Strict interface specifies that the in-event is illegal.

interface IStrict
{
  in bool ia();
  out void oa();

  behaviour
  {
    on ia: illegal;
    on inevitable: oa;
  }
}

The Robust interface allows both an in-event and an out-event’. In the case of the in-event it always replies ’false’.

interface IRobust
{
  in bool ia();
  out void oa();

  behaviour
  {
    on ia: {reply(false);}
    on inevitable: oa;
  }
}

In the armour the occurrance of an illegal in-event is logged and ’false’ is replied. An out-event from the requires port is simply passed to the provides port.

component ArmourIIPRB // IStrict to IRobust
{
  provides IRobust pRobust;
  requires IStrict rStrict;
  requires injected ILogger iLog;

  behaviour {
    on pRobust.ia(): {reply(false); iLog.Log($"In-event ia is illegal in port"$);} // armour illegal ia
    on rStrict.oa(): pRobust.oa();
  }
}

The full armour example code including the client and overall system component is here:

Basic example: ArmourIIPRB
Example with error handling: ArmourIIPRBError