| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
<html> |
| 15 |
<head> |
| 16 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 17 |
<meta http-equiv="Content-Language" content="en-us"> |
| 18 |
<title>component</title> |
| 19 |
</head> |
| 20 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 21 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 22 |
<tr> |
| 23 |
<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> |
| 24 |
</tr> |
| 25 |
</table> |
| 26 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 27 |
<tr> |
| 28 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 29 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 30 |
<td><a href="complement.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 31 |
<td><a href="connect.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 32 |
</tr> |
| 33 |
</table> |
| 34 |
<p><br clear="all"> |
| 35 |
</p> |
| 36 |
<hr> |
| 37 |
<h1>component</h1> |
| 38 |
<hr align="left" width="75%"> |
| 39 |
<p>The keyword is used to define a test component type. |
| 40 |
<ul> |
| 41 |
<li>Test component is an entity on which test behavior is executed</li> |
| 42 |
<li>Test component is owner of the test ports</li> |
| 43 |
<li>Constants, variable and timers declared in the component type are visible from all functions and test cases, which execute on that very component type</li> |
| 44 |
<li>Several test components can run in parallel - each executes independently</li> |
| 45 |
</ul> |
| 46 |
<p>Related keywords:</p> |
| 47 |
<ul> |
| 48 |
<li><a href="type.html"><b><font face="Courier New" color="#003258" size="4">type</font></b></a></li> |
| 49 |
<li><a href="extends.html"><b><font face="Courier New" color="#003258" size="4">extends</font></b></a></li> |
| 50 |
<li><a href="port.html"><b><font face="Courier New" color="#003258" size="4">port</font></b></a></li> |
| 51 |
<li><a href="const.html"><b><font face="Courier New" color="#003258" size="4">const</font></b></a></li> |
| 52 |
<li><a href="var.html"><b><font face="Courier New" color="#003258" size="4">var</font></b></a></li> |
| 53 |
<li><a href="timer.html"><b><font face="Courier New" color="#003258" size="4">timer</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>{</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 <a href="type.html"><font face="Courier New" color="#003258" size="4"><b>type</a> component</b></font> keywords introduce the component definition.</p> |
| 73 |
</li> |
| 74 |
<li> |
| 75 |
<p><i>component_identifier</i> is the name used to refer to the component. Must begin with a letter, may contain letters, numbers and underscore characters. <br> |
| 76 |
According to the Naming convention, the suffix <b> _CT</b> is recommended.</p> |
| 77 |
</li> |
| 78 |
<li> |
| 79 |
<p><i>port_instance</i> identifies the ports owned by the port. For the syntax see the initial keyword <a href="port.html"><b><font face="Courier New" color="#003258" |
| 80 |
size="4">port</font></b></a>.</p> |
| 81 |
</li> |
| 82 |
<li> |
| 83 |
<p><i>const_def</i> defines constants visible from all functions and test cases, which execute on that very component type. For the syntax see the initial keyword <a href="const.html" |
| 84 |
target="_blank"><b><font face="Courier New" color="#003258" size="4">const</font></b></a>.</p> |
| 85 |
</li> |
| 86 |
<li> |
| 87 |
<p><i>var_instance</i> identifies variables visible from all functions and test cases, which execute on that very component type. For the syntax see the initial keyword <a href="var.html" |
| 88 |
target="_blank"><b><font face="Courier New" color="#003258" size="4">var</font></b></a>.</p> |
| 89 |
</li> |
| 90 |
<li> |
| 91 |
<p><i>timer_instance</i> identifies timers visible from all functions and test cases, which execute on that very component type. For the syntax see the initial keyword <a href="timer.html" |
| 92 |
target="_blank"><b><font face="Courier New" color="#003258" size="4">timer</font></b></a>.</p> |
| 93 |
</li> |
| 94 |
</ul> |
| 95 |
<p>Every element within the curly brackets may be repeated.</p> |
| 96 |
<hr align="left" width="50%"> |
| 97 |
<p>Example 1: |
| 98 |
<p><font face="Courier New">type component MyComponentType_CT {<br> |
| 99 |
port MyMessagePortType_PT P1_PCO,P2_PCO;<br> |
| 100 |
const bitstring c_MyConst := â1001âB; <br> |
| 101 |
var integer v_MyVar; <br> |
| 102 |
timer T_MyTimer := 1.0; <br> |
| 103 |
}</font> |
| 104 |
<p>The component called MyComponentType_CT is declared. <br> |
| 105 |
It contains two ports (P1_PCO,P2_PCO) of type MyMessagePortType_PT, <br> |
| 106 |
a constant called c_MyConst which equals 1001, <br> |
| 107 |
a variable called v_MyVar <br> |
| 108 |
and a timer called T_MyTimer with a default value of 1 second.</p> |
| 109 |
<hr align="left" width="25%"> |
| 110 |
<hr align="left" width="25%"> |
| 111 |
<p><a HREF="BNF.html#componentdef">BNF definition</a> of <font face="Courier New"> component</font></p> |
| 112 |
</body> |
| 113 |
</html> |