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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
|
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>nevrax.org : docs</TITLE>
<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF='/'><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF='/'><b>nevrax.com</B></FONT></A> </TD>
</TR>
</TABLE>
<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>
<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
<TR>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!------ Begin Box ------>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
<TABLE cellspacing=0 cellpadding=1 border=0>
<tr><td ALIGN=middle><a class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
</TABLE>
</TD></TR></TABLE></TD></TR></TABLE>
<!------ End Box ------>
</TD>
<TD WIDTH=15><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD ALIGN=left valign=top><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!-- title -->
<TABLE background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
<!-- block -->
<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
<TD><B>Documentation</B></TD>
<TD ALIGN=RIGHT> </td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>pacs_client.h</h1><a href="pacs__client_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025
00026 <font class="preprocessor">#ifndef NL_PACS_CLIENT_H</font>
00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_PACS_CLIENT_H</font>
00028 <font class="preprocessor"></font>
00029 <font class="preprocessor">#include "<a class="code" href="stdnet_8h.html">stdnet.h</a>"</font>
00030
00031 <font class="preprocessor">#include "<a class="code" href="inet__address_8h.html">nel/net/inet_address.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="callback__client_8h.html">nel/net/callback_client.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="naming__client_8h.html">nel/net/naming_client.h</a>"</font>
00034
00035 <font class="preprocessor">#include "<a class="code" href="u__move__primitive_8h.html">nel/pacs/u_move_primitive.h</a>"</font>
00036 <font class="preprocessor">#include "<a class="code" href="u__collision__desc_8h.html">nel/pacs/u_collision_desc.h</a>"</font>
00037
<a name="l00038"></a><a class="code" href="pacs__client_8h.html#a0">00038</a> <font class="preprocessor">#define NLNET_PACS_PROTOCOL_VERSION 1</font>
00039 <font class="preprocessor"></font>
00040 <font class="keyword">namespace </font>NLNET
00041 {
00042
00043 TCallbackItem <a class="code" href="namespaceNLNET.html#a23">PacsCallbackArray</a>[];
00044
<a name="l00052"></a><a class="code" href="classNLNET_1_1CPacsClient.html">00052</a> <font class="keyword">class </font>CPacsClient
00053 {
00054 <font class="keyword">friend</font> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a83">cbPacsAnswer</a> (CMessage &msgin, <a class="code" href="namespaceNLNET.html#a0">TSockId</a> from, CCallbackNetBase &netbase);
00055 <font class="keyword">public</font>:
00056
<a name="l00058"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a0">00058</a> <a class="code" href="classNLNET_1_1CPacsClient.html#a0">CPacsClient</a>()
00059 {
00060 <font class="comment">// No connexion</font>
00061 <a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>=NULL;
00062 }
00063
<a name="l00064"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a1">00064</a> <a class="code" href="classNLNET_1_1CPacsClient.html#a1">~CPacsClient</a>()
00065 {
00066 <a class="code" href="classNLNET_1_1CPacsClient.html#a3">disconnect</a> ();
00067 }
00068
00069 <font class="keywordtype">bool</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a2">connect</a> ();
00070
<a name="l00071"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a3">00071</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a3">disconnect</a> ()
00072 {
00073 <font class="keywordflow">if</font> (_Server)
00074 {
00075 <a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>->disconnect ();
00076 <font class="keyword">delete</font> <a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>;
00077 }
00078 }
00079
<a name="l00085"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a4">00085</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a4">initMessage</a> ()
00086 {
00087 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.clear ();
00088 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.setType (<font class="stringliteral">"PACS"</font>);
00089 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serialCheck ((<a class="code" href="types__nl_8h.html#a10">uint32</a>)<a class="code" href="pacs__client_8h.html#a0">NLNET_PACS_PROTOCOL_VERSION</a>);
00090 }
00091
<a name="l00097"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a5">00097</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a5">sendMessage</a> ()
00098 {
00099 <font class="comment">// Checks</font>
00100 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>);
00101
00102 <font class="comment">// Close the message</font>
00103 <font class="keywordtype">bool</font> nlFalse=<font class="keyword">false</font>;
00104 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlFalse);
00105
00106 <font class="comment">// Send the message</font>
00107 <a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>->send (<a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>);
00108 }
00109
<a name="l00113"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a6">00113</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a6">update</a> ()
00114 {
00115 <font class="comment">// Checks</font>
00116 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>);
00117
00118 <a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>->update ();
00119 }
00120
00122
<a name="l00132"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a7">00132</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a7">rayTest</a> (<font class="keywordtype">double</font> p0, <font class="keywordtype">double</font> p1, <a class="code" href="types__nl_8h.html#a10">uint32</a> testId)
00133 {
00134 <font class="comment">// Append to the current message</font>
00135 std::string name=<font class="stringliteral">"RY"</font>;
00136 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00137 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, p0, p1, testId);
00138 }
00139
00141
<a name="l00149"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a8">00149</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a8">addPrimitive</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s1">NLPACS::UMovePrimitive::TUserData</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
00150 {
00151 <font class="comment">// Append to the current message</font>
00152 std::string name=<font class="stringliteral">"AD"</font>;
00153 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00154 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
00155 }
00156
<a name="l00164"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a9">00164</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a9">removePrimitive</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s1">NLPACS::UMovePrimitive::TUserData</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
00165 {
00166 <font class="comment">// Append to the current message</font>
00167 std::string name=<font class="stringliteral">"RV"</font>;
00168 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00169 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
00170 }
00171
<a name="l00180"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a10">00180</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a10">evalCollision</a> (<a class="code" href="types__nl_8h.html#a10">uint32</a> evalId, <font class="keywordtype">double</font> deltaTime)
00181 {
00182 <font class="comment">// Append to the current message</font>
00183 std::string name=<font class="stringliteral">"EV"</font>;
00184 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00185 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, evalId, deltaTime);
00186 }
00187
<a name="l00197"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a11">00197</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a11">testMove</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s1">NLPACS::UMovePrimitive::TUserData</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVectorD.html">NLMISC::CVectorD</a>& speed, <font class="keywordtype">double</font> deltaTime)
00198 {
00199 <font class="comment">// Append to the current message</font>
00200 std::string name=<font class="stringliteral">"TS"</font>;
00201 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00202 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, const_cast<NLMISC::CVectorD&> (speed), deltaTime);
00203 }
00204
00206
<a name="l00215"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a12">00215</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a12">setCurrentPrimitive</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s1">NLPACS::UMovePrimitive::TUserData</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
00216 {
00217 <font class="comment">// Append to the current message</font>
00218 std::string name=<font class="stringliteral">"CU"</font>;
00219 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00220 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
00221 }
00222
<a name="l00230"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a13">00230</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a13">setPrimitiveType</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s12">NLPACS::UMovePrimitive::TType</a> <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)
00231 {
00232 <font class="comment">// Append to the current message</font>
00233 std::string name=<font class="stringliteral">"TY"</font>;
00234 <a class="code" href="types__nl_8h.html#a10">uint32</a> <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>=(uint32)<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>;
00235 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00236 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
00237 }
00238
<a name="l00246"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a14">00246</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a14">setReactionType</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s13">NLPACS::UMovePrimitive::TReaction</a> <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)
00247 {
00248 <font class="comment">// Append to the current message</font>
00249 std::string name=<font class="stringliteral">"RT"</font>;
00250 <a class="code" href="types__nl_8h.html#a10">uint32</a> <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>=(uint32)<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>;
00251 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00252 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
00253 }
00254
<a name="l00262"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a15">00262</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a15">setTriggerType</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s14">NLPACS::UMovePrimitive::TTrigger</a> <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>)
00263 {
00264 <font class="comment">// Append to the current message</font>
00265 std::string name=<font class="stringliteral">"TT"</font>;
00266 <a class="code" href="types__nl_8h.html#a10">uint32</a> <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>=(uint32)<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>;
00267 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00268 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
00269 }
00270
<a name="l00278"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a16">00278</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a16">setCollisionMask</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s0">NLPACS::UMovePrimitive::TCollisionMask</a> mask)
00279 {
00280 <font class="comment">// Append to the current message</font>
00281 std::string name=<font class="stringliteral">"CT"</font>;
00282 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00283 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, mask);
00284 }
00285
<a name="l00293"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a17">00293</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a17">setOcclusionMask</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s0">NLPACS::UMovePrimitive::TCollisionMask</a> mask)
00294 {
00295 <font class="comment">// Append to the current message</font>
00296 std::string name=<font class="stringliteral">"OT"</font>;
00297 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00298 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, mask);
00299 }
00300
<a name="l00308"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a18">00308</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a18">setObstacle</a> (<font class="keywordtype">bool</font> obstacle)
00309 {
00310 <font class="comment">// Append to the current message</font>
00311 std::string name=<font class="stringliteral">"OB"</font>;
00312 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00313 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, obstacle);
00314 }
00315
<a name="l00323"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a19">00323</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a19">setOrientation</a> (<font class="keywordtype">double</font> orientation)
00324 {
00325 <font class="comment">// Append to the current message</font>
00326 std::string name=<font class="stringliteral">"OR"</font>;
00327 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00328 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, orientation);
00329 }
00330
<a name="l00338"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a20">00338</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a20">setAbsorption</a> (<font class="keywordtype">float</font> absorption)
00339 {
00340 <font class="comment">// Append to the current message</font>
00341 std::string name=<font class="stringliteral">"AB"</font>;
00342 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00343 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, absorption);
00344 }
00345
<a name="l00354"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a21">00354</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a21">setSize</a> (<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a391">depth</a>)
00355 {
00356 <font class="comment">// Append to the current message</font>
00357 std::string name=<font class="stringliteral">"SZ"</font>;
00358 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00359 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a391">depth</a>);
00360 }
00361
<a name="l00369"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a22">00369</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a22">setHeight</a> (<font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>)
00370 {
00371 <font class="comment">// Append to the current message</font>
00372 std::string name=<font class="stringliteral">"HE"</font>;
00373 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00374 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>);
00375 }
00376
<a name="l00384"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a23">00384</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a23">setRadius</a> (<font class="keywordtype">float</font> radius)
00385 {
00386 <font class="comment">// Append to the current message</font>
00387 std::string name=<font class="stringliteral">"RD"</font>;
00388 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00389 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, radius);
00390 }
00391
<a name="l00400"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a24">00400</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a24">globalMove</a> (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVectorD.html">NLMISC::CVectorD</a>& position)
00401 {
00402 <font class="comment">// Append to the current message</font>
00403 std::string name=<font class="stringliteral">"GM"</font>;
00404 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00405 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, const_cast<NLMISC::CVectorD&> (position));
00406 }
00407
<a name="l00418"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a25">00418</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a25">relativeMove</a> (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVectorD.html">NLMISC::CVectorD</a>& speed)
00419 {
00420 <font class="comment">// Append to the current message</font>
00421 std::string name=<font class="stringliteral">"RM"</font>;
00422 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00423 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, const_cast<NLMISC::CVectorD&> (speed));
00424 }
00425
<a name="l00433"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a26">00433</a> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#a26">getPositionSpeed</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s1">NLPACS::UMovePrimitive::TUserData</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>)
00434 {
00435 <font class="comment">// Append to the current message</font>
00436 std::string name=<font class="stringliteral">"PS"</font>;
00437 <font class="keywordtype">bool</font> nlTrue=<font class="keyword">true</font>;
00438 <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>.serial (nlTrue, name, <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>);
00439 }
00440
00441 <font class="keyword">protected</font>:
00442
00444
<a name="l00448"></a><a class="code" href="classNLNET_1_1CPacsClient.html#b0">00448</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#b0">messageCallback</a> ()
00449 {}
00450
<a name="l00457"></a><a class="code" href="classNLNET_1_1CPacsClient.html#b1">00457</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#b1">rayTestCallback</a> (<a class="code" href="types__nl_8h.html#a10">uint32</a> testId, <font class="keywordtype">bool</font> testResult)
00458 {}
00459
<a name="l00467"></a><a class="code" href="classNLNET_1_1CPacsClient.html#b2">00467</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#b2">triggerCallback</a> (<a class="code" href="types__nl_8h.html#a10">uint32</a> evalId, <font class="keyword">const</font> std::vector<NLPACS::UTriggerInfo>& triggerInfo)
00468 {}
00469
<a name="l00476"></a><a class="code" href="classNLNET_1_1CPacsClient.html#b3">00476</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#b3">testMoveCallback</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s1">NLPACS::UMovePrimitive::TUserData</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, <font class="keywordtype">bool</font> testResult)
00477 {}
00478
<a name="l00486"></a><a class="code" href="classNLNET_1_1CPacsClient.html#b4">00486</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNLNET_1_1CPacsClient.html#b4">getPositionSpeedCallback</a> (<a class="code" href="classNLPACS_1_1UMovePrimitive.html#s1">NLPACS::UMovePrimitive::TUserData</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVectorD.html">NLMISC::CVectorD</a> &position, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVectorD.html">NLMISC::CVectorD</a> &speed)
00487 {}
00488
00489 <font class="keyword">private</font>:
<a name="l00490"></a><a class="code" href="classNLNET_1_1CPacsClient.html#o0">00490</a> CCallbackClient *<a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>;
<a name="l00491"></a><a class="code" href="classNLNET_1_1CPacsClient.html#o1">00491</a> CMessage <a class="code" href="classNLNET_1_1CPacsClient.html#o1">_Message</a>;
00492 };
00493
00494 <font class="comment">// Callback to listen to the server</font>
<a name="l00495"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a83">00495</a> <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNLNET.html#a83">cbPacsAnswer</a> (CMessage &msgin, <a class="code" href="namespaceNLNET.html#a0">TSockId</a> from, CCallbackNetBase &netbase)
00496 {
00497 <font class="comment">// Get the client pointer</font>
00498 CPacsClient *client=(CPacsClient*)(uint)from->appId ();
00499
00500 <font class="comment">// Check stream</font>
00501 msgin.serialCheck ((<a class="code" href="types__nl_8h.html#a10">uint32</a>)<a class="code" href="pacs__client_8h.html#a0">NLNET_PACS_PROTOCOL_VERSION</a>);
00502
00503 <font class="comment">// Message callback</font>
00504 client->messageCallback ();
00505
00506 <font class="keywordtype">bool</font> again;
00507 msgin.serial (again);
00508
00509 <font class="keywordflow">while</font> (again)
00510 {
00511 <font class="comment">// Read the message sub string</font>
00512 std::string subMessage;
00513 msgin.serial (subMessage);
00514
00515 <font class="comment">// This code can work only if sizeof (uint) == sizeof (void*)</font>
00516 <a class="code" href="debug_8h.html#a6">nlassert</a> (<font class="keyword">sizeof</font> (<a class="code" href="types__nl_8h.html#a14">uint</a>)==<font class="keyword">sizeof</font> (<font class="keywordtype">void</font>*));
00517
00518 <font class="comment">// Raytrace callback ?</font>
00519 <font class="keywordflow">if</font> (subMessage==<font class="stringliteral">"RY"</font>)
00520 {
00521 <font class="comment">// Read test id and test result</font>
00522 <a class="code" href="types__nl_8h.html#a10">uint32</a> testId;
00523 <font class="keywordtype">bool</font> testResult;
00524 msgin.serial (testId, testResult);
00525
00526 <font class="comment">// Call the callback</font>
00527 client->rayTestCallback (testId, testResult);
00528 }
00529 <font class="comment">// Trigger callback ?</font>
00530 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (subMessage==<font class="stringliteral">"TR"</font>)
00531 {
00532 <font class="comment">// Read eval id and trigger info</font>
00533 <a class="code" href="types__nl_8h.html#a10">uint32</a> evalId;
00534 std::vector<NLPACS::UTriggerInfo> triggerInfo;
00535 msgin.serial (evalId);
00536 msgin.serialCont (triggerInfo);
00537
00538 <font class="comment">// Call the callback</font>
00539 client->triggerCallback (evalId, triggerInfo);
00540 }
00541 <font class="comment">// Test move callback ?</font>
00542 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (subMessage==<font class="stringliteral">"TM"</font>)
00543 {
00544 <font class="comment">// Read the primitive id and test result</font>
00545 <a class="code" href="classNLPACS_1_1UMovePrimitive.html#s1">NLPACS::UMovePrimitive::TUserData</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>;
00546 <font class="keywordtype">bool</font> testResult;
00547 msgin.serial (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, testResult);
00548
00549 <font class="comment">// Call the callback </font>
00550 client->testMoveCallback (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, testResult);
00551 }
00552 <font class="comment">// Test move callback ?</font>
00553 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (subMessage==<font class="stringliteral">"PS"</font>)
00554 {
00555 <font class="comment">// Read the primitive id and test result</font>
00556 <a class="code" href="classNLPACS_1_1UMovePrimitive.html#s1">NLPACS::UMovePrimitive::TUserData</a> <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>;
00557 <a class="code" href="classNLMISC_1_1CVectorD.html">NLMISC::CVectorD</a> position;
00558 <a class="code" href="classNLMISC_1_1CVectorD.html">NLMISC::CVectorD</a> speed;
00559 msgin.serial (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, position, speed);
00560
00561 <font class="comment">// Call the callback </font>
00562 client->getPositionSpeedCallback (<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>, position, speed);
00563 }
00564 <font class="keywordflow">else</font>
00565 <a class="code" href="namespaceNLMISC.html#a236">NLMISC::nlError</a> (<font class="stringliteral">"Pacs client: unkown sub message string"</font>);
00566
00567 <font class="comment">// Next message ?</font>
00568 msgin.serial (again);
00569 }
00570 }
00571
00572 <font class="keyword">static</font> TCallbackItem <a class="code" href="namespaceNLNET.html#a23">PacsCallbackArray</a>[] =
00573 {
00574 { <font class="stringliteral">"PACS_ASW"</font>, <a class="code" href="namespaceNLNET.html#a83">cbPacsAnswer</a> }
00575 };
00576
<a name="l00577"></a><a class="code" href="classNLNET_1_1CPacsClient.html#a2">00577</a> <font class="keyword">inline</font> <font class="keywordtype">bool</font> CPacsClient::connect ()
00578 {
00579 <font class="comment">// Create a connexion</font>
00580 <a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a> = <font class="keyword">new</font> CCallbackClient;
00581
00582 <font class="comment">// Look up for PACS service</font>
00583 CNamingClient::lookupAndConnect (<font class="stringliteral">"PS"</font>, *<a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>);
00584 <font class="keywordflow">if</font> (<a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>->connected())
00585 {
00586 <font class="comment">// Add callback array</font>
00587 <a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>->addCallbackArray (<a class="code" href="namespaceNLNET.html#a23">PacsCallbackArray</a>, <font class="keyword">sizeof</font> (<a class="code" href="namespaceNLNET.html#a23">PacsCallbackArray</a>) / <font class="keyword">sizeof</font> (<a class="code" href="namespaceNLNET.html#a23">PacsCallbackArray</a>[0]));
00588
00589 <font class="comment">// This code can work only if sizeof (uint) == sizeof (void*)</font>
00590 <a class="code" href="debug_8h.html#a6">nlassert</a> (<font class="keyword">sizeof</font> (<a class="code" href="types__nl_8h.html#a14">uint</a>)==<font class="keyword">sizeof</font> (<font class="keywordtype">void</font>*));
00591 <a class="code" href="classNLNET_1_1CPacsClient.html#o0">_Server</a>->id ()->setAppId ((<a class="code" href="types__nl_8h.html#a12">uint64</a>)(<a class="code" href="types__nl_8h.html#a14">uint</a>)<font class="keyword">this</font>);
00592
00593 <font class="comment">// Return ok</font>
00594 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00595 }
00596 <font class="keywordflow">else</font>
00597 {
00598 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00599 }
00600 }
00601
00602 } <font class="comment">// NLNET</font>
00603
00604
00605 <font class="preprocessor">#endif // NL_PACS_CLIENT_H</font>
00606 <font class="preprocessor"></font>
00607 <font class="comment">/* End of pacs_client.h */</font>
</pre></div>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|