Titan Core Initial Contribution
[deliverable/titan.core.git] / help / info / component.html
1 <!--
2 Copyright (c) 2000-2014 Ericsson Telecom AB
3
4 All rights reserved. This program and the accompanying materials
5 are made available under the terms of the Eclipse Public License v1.0
6 which accompanies this distribution, and is available at
7 http://www.eclipse.org/legal/epl-v10.html
8 -->
9 <html>
10 <head>
11 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
12 <meta http-equiv="Content-Language" content="en-us">
13 <title>component</title>
14 </head>
15 <body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258">
16 <table align="left" border="0" cellspacing="0" cellpadding="0" valign=top>
17 <tr>
18 <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>
19 </tr>
20 </table>
21 <table border="0" align="right" cellpadding="0" cellspacing="0">
22 <tr>
23 <td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td>
24 <td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td>
25 <td><a href="complement.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
26 <td><a href="connect.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td>
27 </tr>
28 </table>
29 <p><br clear="all">
30 </p>
31 <hr>
32 <h1>component</h1>
33 <hr align="left" width="75%">
34 <p>The keyword is used to define a test component type.
35 <ul>
36 <li>Test component is an entity on which test behavior is executed</li>
37 <li>Test component is owner of the test ports</li>
38 <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>
39 <li>Several test components can run in parallel – each executes independently</li>
40 </ul>
41 <p>Related keywords:</p>
42 <ul>
43 <li><a href="type.html"><b><font face="Courier New" color="#003258" size="4">type</font></b></a></li>
44 <li><a href="port.html"><b><font face="Courier New" color="#003258" size="4">port</font></b></a></li>
45 <li><a href="const.html"><b><font face="Courier New" color="#003258" size="4">const</font></b></a></li>
46 <li><a href="var.html"><b><font face="Courier New" color="#003258" size="4">var</font></b></a></li>
47 <li><a href="timer.html"><b><font face="Courier New" color="#003258" size="4">timer</font></b></a></li>
48 </ul>
49 <hr align="left" width="50%">
50 <div align="center">
51 <center>
52 <table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
53 <tr>
54 <td width="100%">
55 <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>
56 [ <i>port_instance</i><font face="Courier New" color="#003258" size="5"><b>;</b></font> ]&nbsp; [ <i>const_def</i><font face="Courier New" color="#003258" size="5"><b>;</b></font> ]&nbsp; [ <i>var_instance</i><font
57 face="Courier New" color="#003258" size="5"><b>;</b></font> ]&nbsp; [ <i>timer_instance</i><font face="Courier New" color="#003258" size="5"><b>;</b></font> ] <font face="Courier New"
58 color="#003258" size="5"><b>};</b></font></h3>
59 </td>
60 </tr>
61 </table>
62 </center>
63 </div>
64 <ul>
65 <li>
66 <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>
67 </li>
68 <li>
69 <p><i>component_identifier</i> is the&nbsp;name used to refer to the component. Must begin with a letter, may contain letters, numbers and underscore characters.&nbsp;<br>
70 According to the&nbsp; Naming convention, the suffix <b> _CT</b> is recommended.</p>
71 </li>
72 <li>
73 <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"
74 size="4">port</font></b></a>.</p>
75 </li>
76 <li>
77 <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"
78 target="_blank"><b><font face="Courier New" color="#003258" size="4">const</font></b></a>.</p>
79 </li>
80 <li>
81 <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"
82 target="_blank"><b><font face="Courier New" color="#003258" size="4">var</font></b></a>.</p>
83 </li>
84 <li>
85 <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"
86 target="_blank"><b><font face="Courier New" color="#003258" size="4">timer</font></b></a>.</p>
87 </li>
88 </ul>
89 <p>Every element within the curly brackets may be repeated.</p>
90 <hr align="left" width="50%">
91 <p>Example 1:
92 <p><font face="Courier New">type component MyComponentType_CT {<br>
93 &nbsp;&nbsp;&nbsp;port MyMessagePortType_PT P1_PCO,P2_PCO;<br>
94 &nbsp;&nbsp;&nbsp;const bitstring c_MyConst := ’1001’B;&nbsp;<br>
95 &nbsp;&nbsp;&nbsp;var integer v_MyVar;&nbsp;<br>
96 &nbsp;&nbsp;&nbsp;timer T_MyTimer := 1.0;&nbsp;<br>
97 }</font>
98 <p>The component called MyComponentType_CT is declared.&nbsp;<br>
99 It contains two ports (P1_PCO,P2_PCO) of type MyMessagePortType_PT,&nbsp;<br>
100 a constant called c_MyConst which equals 1001,&nbsp;<br>
101 a variable called v_MyVar&nbsp;<br>
102 and a timer called T_MyTimer with a default value of 1 second.</p>
103 <hr align="left" width="25%">
104 <hr align="left" width="25%">
105 <p><a HREF="BNF.html#componentdef">BNF definition</a> of <font face="Courier New"> component</font></p>
106 </body>
107 </html>
This page took 0.039369 seconds and 5 git commands to generate.