aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a06138.html
blob: 19e4a3abf0a40b4794ecb92527ba5dc25321bac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: pacs_client.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex">  <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>pacs_client.h</h1><a href="a04715.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <span class="comment">/* Copyright, 2001 Nevrax Ltd.</span>
00008 <span class="comment"> *</span>
00009 <span class="comment"> * This file is part of NEVRAX NEL.</span>
00010 <span class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</span>
00011 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
00012 <span class="comment"> * the Free Software Foundation; either version 2, or (at your option)</span>
00013 <span class="comment"> * any later version.</span>
00014 <span class="comment"></span>
00015 <span class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</span>
00016 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span>
00017 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
00018 <span class="comment"> * General Public License for more details.</span>
00019 <span class="comment"></span>
00020 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
00021 <span class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</span>
00022 <span class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</span>
00023 <span class="comment"> * MA 02111-1307, USA.</span>
00024 <span class="comment"> */</span>
00025 
00026 <span class="preprocessor">#ifndef NL_PACS_CLIENT_H</span>
00027 <span class="preprocessor"></span><span class="preprocessor">#define NL_PACS_CLIENT_H</span>
00028 <span class="preprocessor"></span>
00029 <span class="preprocessor">#include "<a class="code" href="a05023.html">stdnet.h</a>"</span>
00030 
00031 <span class="preprocessor">#include "<a class="code" href="a04388.html">nel/net/inet_address.h</a>"</span>
00032 <span class="preprocessor">#include "<a class="code" href="a04102.html">nel/net/callback_client.h</a>"</span>
00033 <span class="preprocessor">#include "<a class="code" href="a04667.html">nel/net/naming_client.h</a>"</span>
00034 
00035 <span class="preprocessor">#include "<a class="code" href="a05192.html">nel/pacs/u_move_primitive.h</a>"</span>
00036 <span class="preprocessor">#include "<a class="code" href="a05175.html">nel/pacs/u_collision_desc.h</a>"</span>
00037 
<a name="l00038"></a><a class="code" href="a04715.html#a0">00038</a> <span class="preprocessor">#define NLNET_PACS_PROTOCOL_VERSION 1</span>
00039 <span class="preprocessor"></span>
00040 <span class="keyword">namespace </span>NLNET 
00041 {
00042 
00043 TCallbackItem PacsCallbackArray[];
00044 
<a name="l00052"></a><a class="code" href="a03035.html">00052</a> <span class="keyword">class </span><a class="code" href="a03035.html">CPacsClient</a>
00053 {
00054         <span class="keyword">friend</span> <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientn0">cbPacsAnswer</a> (<a class="code" href="a02918.html">CMessage</a> &amp;msgin, <a class="code" href="a02303.html">TSockId</a> <a class="code" href="a05333.html#a132">from</a>, <a class="code" href="a02306.html">CCallbackNetBase</a> &amp;netbase);
00055 <span class="keyword">public</span>:
00056 
<a name="l00058"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClienta1">00058</a>         <a class="code" href="a03035.html#NLNET_1_1CPacsClienta1">CPacsClient</a>()
00059         {
00060                 <span class="comment">// No connexion</span>
00061                 _Server=NULL;
00062         }
00063 
<a name="l00064"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClienta6">00064</a>         <a class="code" href="a03035.html#NLNET_1_1CPacsClienta6">~CPacsClient</a>()
00065         {
00066                 <a class="code" href="a03035.html#NLNET_1_1CPacsClienta2">disconnect</a> ();
00067         }
00068 
00069         <span class="keywordtype">bool</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClienta0">connect</a> ();
00070 
<a name="l00071"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClienta2">00071</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClienta2">disconnect</a> ()
00072         {
00073                 <span class="keywordflow">if</span> (_Server)
00074                 {
00075                         _Server-&gt;<a class="code" href="a02305.html#NLNET_1_1CCallbackClienta8">disconnect</a> ();
00076                         <span class="keyword">delete</span> _Server;
00077                 }
00078         }
00079 
<a name="l00085"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClienta3">00085</a>         <span class="keywordtype">void</span>    <a class="code" href="a03035.html#NLNET_1_1CPacsClienta3">initMessage</a> ()
00086         {
00087                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02918.html#NLNET_1_1CMessagea4">clear</a> ();
00088                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02918.html#NLNET_1_1CMessagea60">setType</a> (<span class="stringliteral">"PACS"</span>);
00089                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a> ((<a class="code" href="a04558.html#a11">uint32</a>)<a class="code" href="a04715.html#a0">NLNET_PACS_PROTOCOL_VERSION</a>);
00090         }
00091 
<a name="l00097"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClienta4">00097</a>         <span class="keywordtype">void</span>    <a class="code" href="a03035.html#NLNET_1_1CPacsClienta4">sendMessage</a> ()
00098         {
00099                 <span class="comment">// Checks</span>
00100                 <a class="code" href="a04199.html#a6">nlassert</a> (_Server);
00101 
00102                 <span class="comment">// Close the message</span>
00103                 <span class="keywordtype">bool</span> nlFalse=<span class="keyword">false</span>;
00104                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlFalse);
00105 
00106                 <span class="comment">// Send the message</span>
00107                 _Server-&gt;<a class="code" href="a02305.html#NLNET_1_1CCallbackClienta33">send</a> (<a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>);
00108         }
00109 
<a name="l00113"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClienta5">00113</a>         <span class="keywordtype">void</span>    <a class="code" href="a03035.html#NLNET_1_1CPacsClienta5">update</a> ()
00114         {
00115                 <span class="comment">// Checks</span>
00116                 <a class="code" href="a04199.html#a6">nlassert</a> (_Server);
00117 
00118                 _Server-&gt;<a class="code" href="a02305.html#NLNET_1_1CCallbackClienta43">update</a> ();
00119         }
00120 
00122 
<a name="l00132"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2084_0">00132</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2084_0">rayTest</a> (<span class="keywordtype">double</span> p0, <span class="keywordtype">double</span> p1, <a class="code" href="a04558.html#a11">uint32</a> testId)
00133         {
00134                 <span class="comment">// Append to the current message</span>
00135                 std::string name=<span class="stringliteral">"RY"</span>;
00136                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00137                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, p0, p1, testId);
00138         }
00139         
00141 
<a name="l00149"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2085_0">00149</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2085_0">addPrimitive</a> (<a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew14">NLPACS::UMovePrimitive::TUserData</a> <span class="keywordtype">id</span>)
00150         {
00151                 <span class="comment">// Append to the current message</span>
00152                 std::string name=<span class="stringliteral">"AD"</span>;
00153                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00154                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <span class="keywordtype">id</span>);
00155         }
00156         
<a name="l00164"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2085_2">00164</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2085_2">removePrimitive</a> (<a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew14">NLPACS::UMovePrimitive::TUserData</a> <span class="keywordtype">id</span>)
00165         {
00166                 <span class="comment">// Append to the current message</span>
00167                 std::string name=<span class="stringliteral">"RV"</span>;
00168                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00169                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <span class="keywordtype">id</span>);
00170         }
00171         
<a name="l00180"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2085_1">00180</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2085_1">evalCollision</a> (<a class="code" href="a04558.html#a11">uint32</a> evalId, <span class="keywordtype">double</span> deltaTime)
00181         {
00182                 <span class="comment">// Append to the current message</span>
00183                 std::string name=<span class="stringliteral">"EV"</span>;
00184                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00185                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, evalId, deltaTime);
00186         }
00187 
<a name="l00197"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2085_3">00197</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2085_3">testMove</a> (<a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew14">NLPACS::UMovePrimitive::TUserData</a> <span class="keywordtype">id</span>, <span class="keyword">const</span> <a class="code" href="a03664.html">NLMISC::CVectorD</a>&amp; speed, <span class="keywordtype">double</span> deltaTime)
00198         {
00199                 <span class="comment">// Append to the current message</span>
00200                 std::string name=<span class="stringliteral">"TS"</span>;
00201                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00202                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <span class="keywordtype">id</span>, const_cast&lt;NLMISC::CVectorD&amp;&gt; (speed), deltaTime);
00203         }
00204         
00206         
<a name="l00215"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_5">00215</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_5">setCurrentPrimitive</a> (<a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew14">NLPACS::UMovePrimitive::TUserData</a> <span class="keywordtype">id</span>)
00216         {
00217                 <span class="comment">// Append to the current message</span>
00218                 std::string name=<span class="stringliteral">"CU"</span>;
00219                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00220                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <span class="keywordtype">id</span>);
00221         }
00222         
<a name="l00230"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_10">00230</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_10">setPrimitiveType</a> (NLPACS::UMovePrimitive::TType <a class="code" href="a04223.html#a581">type</a>)
00231         {
00232                 <span class="comment">// Append to the current message</span>
00233                 std::string name=<span class="stringliteral">"TY"</span>;
00234                 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a627">t</a>=(<a class="code" href="a04558.html#a11">uint32</a>)<a class="code" href="a04223.html#a581">type</a>;
00235                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00236                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <a class="code" href="a04223.html#a627">t</a>);
00237         }
00238         
<a name="l00246"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_12">00246</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_12">setReactionType</a> (NLPACS::UMovePrimitive::TReaction <a class="code" href="a04223.html#a581">type</a>)
00247         {
00248                 <span class="comment">// Append to the current message</span>
00249                 std::string name=<span class="stringliteral">"RT"</span>;
00250                 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a627">t</a>=(<a class="code" href="a04558.html#a11">uint32</a>)<a class="code" href="a04223.html#a581">type</a>;
00251                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00252                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <a class="code" href="a04223.html#a627">t</a>);
00253         }
00254         
<a name="l00262"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_14">00262</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_14">setTriggerType</a> (NLPACS::UMovePrimitive::TTrigger <a class="code" href="a04223.html#a581">type</a>)
00263         {
00264                 <span class="comment">// Append to the current message</span>
00265                 std::string name=<span class="stringliteral">"TT"</span>;
00266                 <a class="code" href="a04558.html#a11">uint32</a> <a class="code" href="a04223.html#a627">t</a>=(<a class="code" href="a04558.html#a11">uint32</a>)<a class="code" href="a04223.html#a581">type</a>;
00267                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00268                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <a class="code" href="a04223.html#a627">t</a>);
00269         }
00270         
<a name="l00278"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_4">00278</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_4">setCollisionMask</a> (<a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew10">NLPACS::UMovePrimitive::TCollisionMask</a> mask)
00279         {
00280                 <span class="comment">// Append to the current message</span>
00281                 std::string name=<span class="stringliteral">"CT"</span>;
00282                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00283                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, mask);
00284         }
00285         
<a name="l00293"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_8">00293</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_8">setOcclusionMask</a> (<a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew10">NLPACS::UMovePrimitive::TCollisionMask</a> mask)
00294         {
00295                 <span class="comment">// Append to the current message</span>
00296                 std::string name=<span class="stringliteral">"OT"</span>;
00297                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00298                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, mask);
00299         }
00300         
<a name="l00308"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_7">00308</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_7">setObstacle</a> (<span class="keywordtype">bool</span> obstacle)
00309         {
00310                 <span class="comment">// Append to the current message</span>
00311                 std::string name=<span class="stringliteral">"OB"</span>;
00312                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00313                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, obstacle);
00314         }
00315         
<a name="l00323"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_9">00323</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_9">setOrientation</a> (<span class="keywordtype">double</span> orientation)
00324         {
00325                 <span class="comment">// Append to the current message</span>
00326                 std::string name=<span class="stringliteral">"OR"</span>;
00327                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00328                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, orientation);
00329         }
00330         
<a name="l00338"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_3">00338</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_3">setAbsorption</a> (<span class="keywordtype">float</span> absorption)
00339         {
00340                 <span class="comment">// Append to the current message</span>
00341                 std::string name=<span class="stringliteral">"AB"</span>;
00342                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00343                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, absorption);
00344         }
00345         
<a name="l00354"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_13">00354</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_13">setSize</a> (<span class="keywordtype">float</span> <a class="code" href="a04223.html#a632">width</a>, <span class="keywordtype">float</span> <a class="code" href="a04223.html#a634">depth</a>)
00355         {
00356                 <span class="comment">// Append to the current message</span>
00357                 std::string name=<span class="stringliteral">"SZ"</span>;
00358                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00359                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <a class="code" href="a04223.html#a632">width</a>, <a class="code" href="a04223.html#a634">depth</a>);
00360         }
00361         
<a name="l00369"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_6">00369</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_6">setHeight</a> (<span class="keywordtype">float</span> <a class="code" href="a04223.html#a633">height</a>)
00370         {
00371                 <span class="comment">// Append to the current message</span>
00372                 std::string name=<span class="stringliteral">"HE"</span>;
00373                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00374                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <a class="code" href="a04223.html#a633">height</a>);
00375         }
00376         
<a name="l00384"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_11">00384</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_11">setRadius</a> (<span class="keywordtype">float</span> radius)
00385         {
00386                 <span class="comment">// Append to the current message</span>
00387                 std::string name=<span class="stringliteral">"RD"</span>;
00388                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00389                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, radius);
00390         }
00391         
<a name="l00400"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_1">00400</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_1">globalMove</a> (<span class="keyword">const</span> <a class="code" href="a03664.html">NLMISC::CVectorD</a>&amp; position)
00401         {
00402                 <span class="comment">// Append to the current message</span>
00403                 std::string name=<span class="stringliteral">"GM"</span>;
00404                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00405                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, const_cast&lt;NLMISC::CVectorD&amp;&gt; (position));
00406         }
00407         
<a name="l00418"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_2">00418</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_2">relativeMove</a> (<span class="keyword">const</span> <a class="code" href="a03664.html">NLMISC::CVectorD</a>&amp; speed)
00419         {
00420                 <span class="comment">// Append to the current message</span>
00421                 std::string name=<span class="stringliteral">"RM"</span>;
00422                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00423                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, const_cast&lt;NLMISC::CVectorD&amp;&gt; (speed));
00424         }
00425         
<a name="l00433"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_0">00433</a>         <span class="keywordtype">void</span> <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2086_0">getPositionSpeed</a> (<a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew14">NLPACS::UMovePrimitive::TUserData</a> <span class="keywordtype">id</span>)
00434         {
00435                 <span class="comment">// Append to the current message</span>
00436                 std::string name=<span class="stringliteral">"PS"</span>;
00437                 <span class="keywordtype">bool</span> nlTrue=<span class="keyword">true</span>;
00438                 <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (nlTrue, name, <span class="keywordtype">id</span>);
00439         }
00440 
00441 <span class="keyword">protected</span>:
00442 
00444 
<a name="l00448"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_1">00448</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span>    <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_1">messageCallback</a> ()
00449         {}
00450 
<a name="l00457"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_2">00457</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span>    <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_2">rayTestCallback</a> (<a class="code" href="a04558.html#a11">uint32</a> testId, <span class="keywordtype">bool</span> testResult)
00458         {}
00459 
<a name="l00467"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_4">00467</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span>    <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_4">triggerCallback</a> (<a class="code" href="a04558.html#a11">uint32</a> evalId, <span class="keyword">const</span> std::vector&lt;NLPACS::UTriggerInfo&gt;&amp; triggerInfo)
00468         {}
00469 
<a name="l00476"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_3">00476</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span>    <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_3">testMoveCallback</a> (<a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew14">NLPACS::UMovePrimitive::TUserData</a> <span class="keywordtype">id</span>, <span class="keywordtype">bool</span> testResult)
00477         {}
00478 
<a name="l00486"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_0">00486</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span>    <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_0">getPositionSpeedCallback</a> (<a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew14">NLPACS::UMovePrimitive::TUserData</a> <span class="keywordtype">id</span>, <span class="keyword">const</span> <a class="code" href="a03664.html">NLMISC::CVectorD</a> &amp;position, <span class="keyword">const</span> <a class="code" href="a03664.html">NLMISC::CVectorD</a> &amp;speed)
00487         {}
00488 
00489 <span class="keyword">private</span>:
<a name="l00490"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_6">00490</a>         <a class="code" href="a02305.html">CCallbackClient</a>         *_Server;
<a name="l00491"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">00491</a>         <a class="code" href="a02918.html">CMessage</a>                        <a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_5">_Message</a>;
00492 };
00493 
00494 <span class="comment">// Callback to listen to the server</span>
<a name="l00495"></a><a class="code" href="a05379.html#a224">00495</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="a05379.html#a224">cbPacsAnswer</a> (<a class="code" href="a02918.html">CMessage</a> &amp;msgin, <a class="code" href="a02303.html">TSockId</a> from, <a class="code" href="a02306.html">CCallbackNetBase</a> &amp;netbase)
00496 {
00497         <span class="comment">// Get the client pointer</span>
00498         <a class="code" href="a03035.html">CPacsClient</a> *client=(<a class="code" href="a03035.html">CPacsClient</a>*)(<a class="code" href="a04558.html#a15">uint</a>)<a class="code" href="a05333.html#a132">from</a>-&gt;appId ();
00499 
00500         <span class="comment">// Check stream</span>
00501         msgin.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a> ((<a class="code" href="a04558.html#a11">uint32</a>)<a class="code" href="a04715.html#a0">NLNET_PACS_PROTOCOL_VERSION</a>);
00502 
00503         <span class="comment">// Message callback</span>
00504         client-&gt;<a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_1">messageCallback</a> ();
00505 
00506         <span class="keywordtype">bool</span> again;
00507         msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (again);
00508         
00509         <span class="keywordflow">while</span> (again)
00510         {
00511                 <span class="comment">// Read the message sub string</span>
00512                 std::string subMessage;
00513                 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (subMessage);
00514 
00515                 <span class="comment">// This code can work only if sizeof (uint) == sizeof (void*)</span>
00516                 <a class="code" href="a04199.html#a6">nlassert</a> (<span class="keyword">sizeof</span> (<a class="code" href="a04558.html#a15">uint</a>)==<span class="keyword">sizeof</span> (<span class="keywordtype">void</span>*));
00517 
00518                 <span class="comment">// Raytrace callback ?</span>
00519                 <span class="keywordflow">if</span> (subMessage==<span class="stringliteral">"RY"</span>)
00520                 {
00521                         <span class="comment">// Read test id and test result</span>
00522                         <a class="code" href="a04558.html#a11">uint32</a> testId;
00523                         <span class="keywordtype">bool</span> testResult;
00524                         msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (testId, testResult);
00525 
00526                         <span class="comment">// Call the callback</span>
00527                         client-&gt;<a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_2">rayTestCallback</a> (testId, testResult);
00528                 }
00529                 <span class="comment">// Trigger callback ?</span>
00530                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (subMessage==<span class="stringliteral">"TR"</span>)
00531                 {
00532                         <span class="comment">// Read eval id and trigger info</span>
00533                         <a class="code" href="a04558.html#a11">uint32</a> evalId;
00534                         std::vector&lt;NLPACS::UTriggerInfo&gt; triggerInfo;
00535                         msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (evalId);
00536                         msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea54">serialCont</a> (triggerInfo);
00537 
00538                         <span class="comment">// Call the callback</span>
00539                         client-&gt;<a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_4">triggerCallback</a> (evalId, triggerInfo);
00540                 }
00541                 <span class="comment">// Test move callback ?</span>
00542                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (subMessage==<span class="stringliteral">"TM"</span>)
00543                 {
00544                         <span class="comment">// Read the primitive id and test result</span>
00545                         <a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew14">NLPACS::UMovePrimitive::TUserData</a> <span class="keywordtype">id</span>;
00546                         <span class="keywordtype">bool</span> testResult;
00547                         msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (<span class="keywordtype">id</span>, testResult);
00548                         
00549                         <span class="comment">// Call the callback    </span>
00550                         client-&gt;<a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_3">testMoveCallback</a> (<span class="keywordtype">id</span>, testResult);
00551                 }
00552                 <span class="comment">// Test move callback ?</span>
00553                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (subMessage==<span class="stringliteral">"PS"</span>)
00554                 {
00555                         <span class="comment">// Read the primitive id and test result</span>
00556                         <a class="code" href="a02947.html#NLPACS_1_1UMovePrimitivew14">NLPACS::UMovePrimitive::TUserData</a> <span class="keywordtype">id</span>;
00557                         <a class="code" href="a03664.html">NLMISC::CVectorD</a> position;
00558                         <a class="code" href="a03664.html">NLMISC::CVectorD</a> speed;
00559                         msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (<span class="keywordtype">id</span>, position, speed);
00560                         
00561                         <span class="comment">// Call the callback    </span>
00562                         client-&gt;<a class="code" href="a03035.html#NLNET_1_1CPacsClientz2087_0">getPositionSpeedCallback</a> (<span class="keywordtype">id</span>, position, speed);
00563                 }
00564                 <span class="keywordflow">else</span>
00565                         <a class="code" href="a05378.html#a294">NLMISC::nlError</a> (<span class="stringliteral">"Pacs client: unkown sub message string"</span>);
00566 
00567                 <span class="comment">// Next message ?</span>
00568                 msgin.<a class="code" href="a02271.html#NLNET_1_1CMessagea41">serial</a> (again);
00569         }
00570 }
00571 
<a name="l00572"></a><a class="code" href="a05379.html#a96">00572</a> <span class="keyword">static</span> <a class="code" href="a03900.html">TCallbackItem</a> <a class="code" href="a05379.html#a96">PacsCallbackArray</a>[] =
00573 {
00574         { <span class="stringliteral">"PACS_ASW"</span>, <a class="code" href="a05379.html#a224">cbPacsAnswer</a> }
00575 };
00576 
<a name="l00577"></a><a class="code" href="a03035.html#NLNET_1_1CPacsClienta0">00577</a> <span class="keyword">inline</span>  <span class="keywordtype">bool</span> CPacsClient::connect ()
00578 {
00579         <span class="comment">// Create a connexion</span>
00580         _Server = <span class="keyword">new</span> <a class="code" href="a02305.html">CCallbackClient</a>;
00581 
00582         <span class="comment">// Look up for PACS service</span>
00583         CNamingClient::lookupAndConnect (<span class="stringliteral">"PS"</span>, *_Server);
00584         <span class="keywordflow">if</span> (_Server-&gt;<a class="code" href="a02305.html#NLNET_1_1CCallbackClienta6">connected</a>())
00585         {
00586                 <span class="comment">// Add callback array</span>
00587                 _Server-&gt;<a class="code" href="a02306.html#NLNET_1_1CCallbackServera0">addCallbackArray</a> (<a class="code" href="a05379.html#a96">PacsCallbackArray</a>, <span class="keyword">sizeof</span> (<a class="code" href="a05379.html#a96">PacsCallbackArray</a>) / <span class="keyword">sizeof</span> (<a class="code" href="a05379.html#a96">PacsCallbackArray</a>[0]));
00588 
00589                 <span class="comment">// This code can work only if sizeof (uint) == sizeof (void*)</span>
00590                 <a class="code" href="a04199.html#a6">nlassert</a> (<span class="keyword">sizeof</span> (<a class="code" href="a04558.html#a15">uint</a>)==<span class="keyword">sizeof</span> (<span class="keywordtype">void</span>*));
00591                 _Server-&gt;<a class="code" href="a02295.html#NLNET_1_1CCallbackClienta24">id</a> ()-&gt;<a class="code" href="a02303.html#NLNET_1_1CServerBufSocka2">setAppId</a> ((<a class="code" href="a04558.html#a13">uint64</a>)(<a class="code" href="a04558.html#a15">uint</a>)<span class="keyword">this</span>);
00592 
00593                 <span class="comment">// Return ok</span>
00594                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
00595         }
00596         <span class="keywordflow">else</span>
00597         {
00598                 <span class="keywordflow">return</span> <span class="keyword">false</span>;
00599         }
00600 }
00601 
00602 } <span class="comment">// NLNET</span>
00603 
00604 
00605 <span class="preprocessor">#endif // NL_PACS_CLIENT_H</span>
00606 <span class="preprocessor"></span>
00607 <span class="comment">/* End of pacs_client.h */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:30:38 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>