![]() |
![]() |
![]() |
![]() |
![]() |
The keyword is used to specify the parent component type on which the new component type is based.
In such a definition, the new type definition is referred to as the extended type, and the type definition following the extends keyword is referred to as the parent type. The effect of this definition is that the extended type will implicitly also contain all definitions from the parent type. It is called the effective type definition.
It is allowed to have one component type extending several parent types in one definition, which have to be specified as a comma-separated list of types in the definition. Any of the parent types may also be defined by means of extension. The effective component type definition of the extended type is obtained as the collection of all constant, variable, template, timer and port definitions contributed by the parent types (determined recursively if a parent type is also defined by means of an extension) and the definitions declared in the extended type directly. The effective component type definition shall be name clash free.
Related keywords:
type component component_identifier extends parent_component_type_identifier { [ port_instance; ] [ const_def; ] [ var_instance; ] [ timer_instance; ] }; |
The parent_component_type_identifier specifies the component type to be extended
Example 1:
type component MyParentComponentType_CT {
port MyMessagePortType_PT P1_PCO;
const bitstring c_MyConst := â1001âB;
var integer v_MyVar;
timer T_MyTimer := 1.0;
}
type component MyExtendedComponentType_CT extends MyParentComponentType_CT {
port MyOtherMessagePortType_PT P2_PCO;
const bitstring c_MyOtherConst := â0110âB;
var integer v_MyOtherVar;
timer T_MyOtherTimer := 2.0;
}
The component called MyExtendedComponentType_CT is declared by extending MyParentComponentType_CT.
The resulting extended component contains two ports (P1_PCO,P2_PCO) of type MyMessagePortType_PT,
two constants called c_MyConst and c_MyOtherConst,
two variables called v_MyVar and v_MyOtherVar
and two timers called T_MyTimer and T_MyOtherTimer.
BNF definition of extends