| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
<html> |
| 16 |
<head> |
| 17 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 18 |
<meta http-equiv="Content-Language" content="en-us"> |
| 19 |
<title>extends</title> |
| 20 |
</head> |
| 21 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 22 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 23 |
<tr> |
| 24 |
<td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td> |
| 25 |
</tr> |
| 26 |
</table> |
| 27 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 28 |
<tr> |
| 29 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 30 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 31 |
<td><a href="complement.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 32 |
<td><a href="connect.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 33 |
</tr> |
| 34 |
</table> |
| 35 |
<p><br clear="all"> |
| 36 |
</p> |
| 37 |
<hr> |
| 38 |
<h1>extends</h1> |
| 39 |
<hr align="left" width="75%"> |
| 40 |
<p>The keyword is used to specify the parent component type on which the new component type is based.</p> |
| 41 |
<p>In such a definition, the new type definition is referred to as the extended type, and the type definition following the |
| 42 |
extends keyword is referred to as the parent type. The effect of this definition is that the extended type will implicitly |
| 43 |
also contain all definitions from the parent type. It is called the effective type definition.</p> |
| 44 |
<p> It is allowed to have one component type extending several parent types in one definition, which have to be specified as |
| 45 |
a comma-separated list of types in the definition. Any of the parent types may also be defined by means of extension. |
| 46 |
The effective component type definition of the extended type is obtained as the collection of all constant, variable, |
| 47 |
template, timer and port definitions contributed by the parent types (determined recursively if a parent type is also |
| 48 |
defined by means of an extension) and the definitions declared in the extended type directly. The effective component |
| 49 |
type definition shall be name clash free.</p> |
| 50 |
<p>Related keywords:</p> |
| 51 |
<ul> |
| 52 |
<li><a href="type.html"><b><font face="Courier New" color="#003258" size="4">type</font></b></a></li> |
| 53 |
<li><a href="component.html"><b><font face="Courier New" color="#003258" size="4">component</font></b></a></li> |
| 54 |
</ul> |
| 55 |
<hr align="left" width="50%"> |
| 56 |
<div align="center"> |
| 57 |
<center> |
| 58 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 59 |
<tr> |
| 60 |
<td width="100%"> |
| 61 |
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>type component </b></font> <i>component_identifier </i> <font face="Courier New" color="#003258" size="5"><b>extends</b></font> <i>parent_component_type_identifier</i> <font face="Courier New" color="#003258" size="5"><b>{</b></font> |
| 62 |
[ <i>port_instance</i><font face="Courier New" color="#003258" size="5"><b>;</b></font> ] [ <i>const_def</i><font face="Courier New" color="#003258" size="5"><b>;</b></font> ] [ <i>var_instance</i><font |
| 63 |
face="Courier New" color="#003258" size="5"><b>;</b></font> ] [ <i>timer_instance</i><font face="Courier New" color="#003258" size="5"><b>;</b></font> ] <font face="Courier New" |
| 64 |
color="#003258" size="5"><b>};</b></font></h3> |
| 65 |
</td> |
| 66 |
</tr> |
| 67 |
</table> |
| 68 |
</center> |
| 69 |
</div> |
| 70 |
<ul> |
| 71 |
<li> |
| 72 |
<p>The <i>parent_component_type_identifier</i> specifies the component type to be extended</p> |
| 73 |
</li> |
| 74 |
</ul> |
| 75 |
<p></p> |
| 76 |
<hr align="left" width="50%"> |
| 77 |
<p>Example 1: |
| 78 |
<p><font face="Courier New">type component MyParentComponentType_CT {<br> |
| 79 |
port MyMessagePortType_PT P1_PCO;<br> |
| 80 |
const bitstring c_MyConst := â1001âB; <br> |
| 81 |
var integer v_MyVar; <br> |
| 82 |
timer T_MyTimer := 1.0; <br> |
| 83 |
} |
| 84 |
</p> |
| 85 |
|
| 86 |
<p><font face="Courier New">type component MyExtendedComponentType_CT extends MyParentComponentType_CT {<br> |
| 87 |
port MyOtherMessagePortType_PT P2_PCO;<br> |
| 88 |
const bitstring c_MyOtherConst := â0110âB; <br> |
| 89 |
var integer v_MyOtherVar; <br> |
| 90 |
timer T_MyOtherTimer := 2.0; <br> |
| 91 |
} |
| 92 |
</p> |
| 93 |
|
| 94 |
|
| 95 |
</font> |
| 96 |
<p>The component called MyExtendedComponentType_CT is declared by extending MyParentComponentType_CT. <br> |
| 97 |
The resulting extended component contains two ports (P1_PCO,P2_PCO) of type MyMessagePortType_PT, <br> |
| 98 |
two constants called c_MyConst and c_MyOtherConst, <br> |
| 99 |
two variables called v_MyVar and v_MyOtherVar <br> |
| 100 |
and two timers called T_MyTimer and T_MyOtherTimer.</p> |
| 101 |
<hr align="left" width="25%"> |
| 102 |
<hr align="left" width="25%"> |
| 103 |
<p><a HREF="BNF.html#componentdef">BNF definition</a> of <font face="Courier New"> extends</font></p> |
| 104 |
</body> |
| 105 |
</html> |