2.5.2. Hierarchical behavior of special-purpose behaviors

The use of special purpose behaviors is optional. If they are missing for a component, the corresponding behaviors of all subcomponents of the component are called recursively. If a special purpose behavior is specified however, it is responsible for explicitly calling the subcomponents. This is easily done using the composition keyword as shown in Example 2.18:

Example 2.18. Calling a subcomponent

behavior reset(int level)
{
   // reset subcomponents
   composition.reset(level);
   // reset state variables
   status = 0;
   counter = 0;
   control = 0;
}

A missing special purpose behavior B is equivalent to:

behavior B
{
   composition.B();
}

Note

If the composition statement is not present in a special purpose behavior, the corresponding behaviors of the subcomponents are never called and this might have undesirable effects.

A missing special purpose behavior is not equivalent to an empty special purpose behavior.

Copyright © 2007-2010 ARM Limited. All rights reserved.ARM DUI 0372I
Non-Confidential