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
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
|
<!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="http://www.nevrax.org/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="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=http://www.nevrax.com><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="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/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="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/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="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
</TABLE>
</TD></TR></TABLE></TD></TR></TABLE>
<!------ End Box ------>
</TD>
<TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!-- title -->
<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG SRC="http://www.nevrax.org/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="http://www.nevrax.org/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:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>logic_condition.cpp</h1><a href="logic__condition_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
00007 <font class="comment">/* Copyright, 2000 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
00027 <font class="preprocessor">#include "<a class="code" href="o__xml_8h.html">nel/misc/o_xml.h</a>"</font>
00028
00029 <font class="preprocessor">#include "<a class="code" href="logic__condition_8h.html">nel/logic/logic_condition.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="logic__variable_8h.html">nel/logic/logic_variable.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="logic__state__machine_8h.html">nel/logic/logic_state_machine.h</a>"</font>
00032
00033 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00034 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
00035
00036 <font class="keyword">namespace </font>NLLOGIC
00037 {
00038
00039 <font class="comment">//-------------------------------------------------</font>
00040 <font class="comment">// setLogicStateMachine :</font>
00041 <font class="comment">//</font>
00042 <font class="comment">//-------------------------------------------------</font>
<a name="l00043"></a><a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#a1">00043</a> <font class="keywordtype">void</font> CLogicComparisonBlock::setLogicStateMachine( CLogicStateMachine * logicStateMachine )
00044 {
00045 <font class="keywordflow">if</font>( logicStateMachine == 0 )
00046 {
00047 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LOGIC)<CLogicComparisonBlock::setLogicStateMachine> The state machine is null"</font>);
00048 }
00049 <font class="keywordflow">else</font>
00050 {
00051 <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#o0">_LogicStateMachine</a> = logicStateMachine;
00052 }
00053
00054 } <font class="comment">// setLogicStateMachine //</font>
00055
00056
00057 <font class="comment">//-------------------------------------------------</font>
00058 <font class="comment">// testLogic :</font>
00059 <font class="comment">//</font>
00060 <font class="comment">//-------------------------------------------------</font>
<a name="l00061"></a><a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#a2">00061</a> <font class="keywordtype">bool</font> CLogicComparisonBlock::testLogic()
00062 {
00063 CLogicVariable var;
00064 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#o0">_LogicStateMachine</a>->getVariable( <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m0">VariableName</a>, var ) == <font class="keyword">false</font> )
00065 {
00066 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LOGIC)<CLogicComparisonBlock::testLogic> The variable %s is unknown in the state machine"</font>,<a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m0">VariableName</a>.c_str());
00067 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00068 }
00069
00070 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m1">Operator</a> == <font class="stringliteral">"<"</font> ) <font class="keywordflow">return</font> ( var.getValue() < <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m2">Comparand</a> );
00071 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m1">Operator</a> == <font class="stringliteral">"<="</font> ) <font class="keywordflow">return</font> ( var.getValue() <= <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m2">Comparand</a> );
00072 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m1">Operator</a> == <font class="stringliteral">">"</font> ) <font class="keywordflow">return</font> ( var.getValue() > <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m2">Comparand</a> );
00073 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m1">Operator</a> == <font class="stringliteral">">="</font> ) <font class="keywordflow">return</font> ( var.getValue() >= <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m2">Comparand</a> );
00074 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m1">Operator</a> == <font class="stringliteral">"=="</font> ) <font class="keywordflow">return</font> ( var.getValue() == <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m2">Comparand</a> );
00075 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m1">Operator</a> == <font class="stringliteral">"!="</font> ) <font class="keywordflow">return</font> ( var.getValue() != <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m2">Comparand</a> );
00076
00077 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LOGIC)<CLogicComparisonBlock::testLogic> The comparison block operator %s is unknown"</font>,<a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m1">Operator</a>.c_str());
00078 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00079
00080 } <font class="comment">// testLogic //</font>
00081
00082
00083 <font class="comment">//-------------------------------------------------</font>
00084 <font class="comment">// serial :</font>
00085 <font class="comment">//</font>
00086 <font class="comment">//-------------------------------------------------</font>
00087 <font class="comment">/*void CLogicComparisonBlock::serial( IStream &f )</font>
00088 <font class="comment">{</font>
00089 <font class="comment"> f.xmlPush("COMPARISON_BLOCK");</font>
00090 <font class="comment"> </font>
00091 <font class="comment"> f.serial( VariableName );</font>
00092 <font class="comment"> f.serial( Operator );</font>
00093 <font class="comment"> f.serial( Comparand );</font>
00094 <font class="comment"> </font>
00095 <font class="comment"> f.xmlPop();</font>
00096 <font class="comment"></font>
00097 <font class="comment">} // serial //*/</font>
00098
<a name="l00099"></a><a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#a3">00099</a> <font class="keywordtype">void</font> CLogicComparisonBlock::write (xmlNodePtr node)<font class="keyword"> const</font>
00100 <font class="keyword"></font>{
00101 xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"COMPARISON_BLOCK"</font>, NULL);
00102 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"VariableName"</font>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m0">VariableName</a>.c_str());
00103 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Operator"</font>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m1">Operator</a>.c_str());
00104 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Comparand"</font>, (<font class="keyword">const</font> xmlChar*)toString(Comparand).c_str());
00105 }
00106
<a name="l00107"></a><a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#a4">00107</a> <font class="keywordtype">void</font> CLogicComparisonBlock::read (xmlNodePtr node)
00108 {
00109 <a class="code" href="namespaceNLLOGIC.html#a1">xmlCheckNodeName</a> (node, <font class="stringliteral">"COMPARISON_BLOCK"</font>);
00110
00111 <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m0">VariableName</a> = <a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"VariableName"</font>);
00112 <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m1">Operator</a> = <a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Operator"</font>);
00113 <a class="code" href="classNLLOGIC_1_1CLogicComparisonBlock.html#m2">Comparand</a> = atoiInt64(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Comparand"</font>).c_str());
00114 }
00115
00116
00117
00118
00119
00120
00121
00122 <font class="comment">//-------------------------------------------------</font>
00123 <font class="comment">// setLogicStateMachine :</font>
00124 <font class="comment">//</font>
00125 <font class="comment">//-------------------------------------------------</font>
<a name="l00126"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#a2">00126</a> <font class="keywordtype">void</font> CLogicConditionLogicBlock::setLogicStateMachine( CLogicStateMachine * logicStateMachine )
00127 {
00128 <font class="keywordflow">if</font>( logicStateMachine == 0 )
00129 {
00130 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LOGIC)<CCLogicConditionLogicBlock::setLogicStateMachine> The state machine is null"</font>);
00131 }
00132 <font class="keywordflow">else</font>
00133 {
00134 <font class="comment">// set the state machine of this node</font>
00135 <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#o0">_LogicStateMachine</a> = logicStateMachine;
00136
00137 <font class="comment">// set the state machine of the logic block </font>
00138 <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m2">ComparisonBlock</a>.setLogicStateMachine( logicStateMachine );
00139 }
00140
00141 } <font class="comment">// setLogicStateMachine //</font>
00142
00143
00144 <font class="comment">//-------------------------------------------------</font>
00145 <font class="comment">// testLogic :</font>
00146 <font class="comment">//</font>
00147 <font class="comment">//-------------------------------------------------</font>
<a name="l00148"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#a3">00148</a> <font class="keywordtype">bool</font> CLogicConditionLogicBlock::testLogic()
00149 {
00150 <font class="keywordflow">switch</font>( Type )
00151 {
00152 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s0">NOT</a> :
00153 {
00154 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00155 }
00156 <font class="keywordflow">break</font>;
00157
00158 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s1">COMPARISON</a> :
00159 {
00160 <font class="keywordflow">return</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m2">ComparisonBlock</a>.testLogic();
00161 }
00162 <font class="keywordflow">break</font>;
00163
00164 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s2">SUB_CONDITION</a> :
00165 {
00166 CLogicCondition <a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a>;
00167 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#o0">_LogicStateMachine</a>->getCondition(<a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m1">SubCondition</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a>) )
00168 {
00169 <font class="keywordflow">return</font> <a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a>.testLogic();
00170 }
00171 <font class="keywordflow">else</font>
00172 {
00173 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LOGIC)<CLogicConditionLogicBlock::testLogic> The subcondition \"%s\" is unknown in the state machine \"%s\""</font>,
00174 <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m1">SubCondition</a>.c_str(),<a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#o0">_LogicStateMachine</a>->getName().c_str());
00175 }
00176
00177 }
00178
00179 <font class="keywordflow">default</font> :
00180 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"(LOGIC)<CLogicConditionLogicBlock::testLogic> logic block type %d is unknown"</font>,<a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m0">Type</a>);
00181 }
00182
00183 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00184
00185 } <font class="comment">// testLogic //</font>
00186
00187
00188
00189 <font class="comment">//-------------------------------------------------</font>
00190 <font class="comment">// fillVarSet :</font>
00191 <font class="comment">//</font>
00192 <font class="comment">//-------------------------------------------------</font>
00193 <font class="keywordtype">void</font> CLogicConditionLogicBlock::fillVarSet( set<string>& condVars )
00194 {
00195 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m0">Type</a> == <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s1">COMPARISON</a> )
00196 {
00197 condVars.insert( <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m2">ComparisonBlock</a>.VariableName );
00198 }
00199 <font class="keywordflow">else</font>
00200 {
00201 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m0">Type</a> == <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s2">SUB_CONDITION</a> )
00202 {
00203 CLogicCondition <a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a>;
00204 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#o0">_LogicStateMachine</a>->getCondition(<a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m1">SubCondition</a>,<a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a>) )
00205 {
00206 <a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a>.fillVarSet( condVars );
00207 }
00208 }
00209 }
00210
00211 } <font class="comment">// fillVarSet //</font>
00212
00213
00214 <font class="comment">//-------------------------------------------------</font>
00215 <font class="comment">// serial :</font>
00216 <font class="comment">//</font>
00217 <font class="comment">//-------------------------------------------------</font>
00218 <font class="comment">/*void CLogicConditionLogicBlock::serial( IStream &f )</font>
00219 <font class="comment">{</font>
00220 <font class="comment"> f.xmlPush("CONDITION_LOGIC_BLOCK");</font>
00221 <font class="comment"></font>
00222 <font class="comment"> f.serialEnum( Type );</font>
00223 <font class="comment"> switch( Type )</font>
00224 <font class="comment"> {</font>
00225 <font class="comment"> case NOT : break;</font>
00226 <font class="comment"> </font>
00227 <font class="comment"> case COMPARISON :</font>
00228 <font class="comment"> {</font>
00229 <font class="comment"> f.serial( ComparisonBlock );</font>
00230 <font class="comment"> }</font>
00231 <font class="comment"> break;</font>
00232 <font class="comment"></font>
00233 <font class="comment"> case SUB_CONDITION :</font>
00234 <font class="comment"> {</font>
00235 <font class="comment"> f.serial( SubCondition );</font>
00236 <font class="comment"> }</font>
00237 <font class="comment"> break;</font>
00238 <font class="comment"> };</font>
00239 <font class="comment"> </font>
00240 <font class="comment"> f.xmlPop();</font>
00241 <font class="comment">};*/</font>
00242
<a name="l00243"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#a5">00243</a> <font class="keywordtype">void</font> CLogicConditionLogicBlock::write (xmlNodePtr node)<font class="keyword"> const</font>
00244 <font class="keyword"></font>{
00245 xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"CONDITION_LOGIC_NODE"</font>, NULL);
00246 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Type"</font>, (<font class="keyword">const</font> xmlChar*)toString(Type).c_str());
00247 <font class="keywordflow">switch</font>( Type )
00248 {
00249 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s0">NOT</a> : <font class="keywordflow">break</font>;
00250
00251 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s1">COMPARISON</a> :
00252 {
00253 <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m2">ComparisonBlock</a>.write(elmPtr);
00254 }
00255 <font class="keywordflow">break</font>;
00256
00257 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s2">SUB_CONDITION</a> :
00258 {
00259 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"SubCondition"</font>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m1">SubCondition</a>.c_str());
00260 }
00261 <font class="keywordflow">break</font>;
00262 };
00263 }
00264
<a name="l00265"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#a6">00265</a> <font class="keywordtype">void</font> CLogicConditionLogicBlock::read (xmlNodePtr node)
00266 {
00267 <a class="code" href="namespaceNLLOGIC.html#a1">xmlCheckNodeName</a> (node, <font class="stringliteral">"CONDITION_LOGIC_NODE"</font>);
00268
00269 <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m0">Type</a> = (TLogicConditionLogicBlockType)atoi(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Type"</font>).c_str());
00270 <font class="keywordflow">switch</font>( Type )
00271 {
00272 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s0">NOT</a> : <font class="keywordflow">break</font>;
00273
00274 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s1">COMPARISON</a> :
00275 {
00276 <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m2">ComparisonBlock</a>.read (node);
00277 }
00278 <font class="keywordflow">break</font>;
00279
00280 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#s3s2">SUB_CONDITION</a> :
00281 {
00282 <a class="code" href="classNLLOGIC_1_1CLogicConditionLogicBlock.html#m1">SubCondition</a> = <a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"SubCondition"</font>);
00283 }
00284 <font class="keywordflow">break</font>;
00285 };
00286 }
00287
00288 <font class="comment">//-----------------------------------------</font>
00289
00290
00291
00292 <font class="comment">//-------------------------------------------------</font>
00293 <font class="comment">// setLogicStateMachine :</font>
00294 <font class="comment">//</font>
00295 <font class="comment">//-------------------------------------------------</font>
<a name="l00296"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#a1">00296</a> <font class="keywordtype">void</font> CLogicConditionNode::setLogicStateMachine( CLogicStateMachine * logicStateMachine )
00297 {
00298 <font class="keywordflow">if</font>( logicStateMachine == 0 )
00299 {
00300 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LOGIC)<CLogicConditionNode::setLogicStateMachine> The state machine is null"</font>);
00301 }
00302 <font class="keywordflow">else</font>
00303 {
00304 <font class="comment">// set the state machine of this node</font>
00305 <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#o0">_LogicStateMachine</a> = logicStateMachine;
00306
00307 <font class="comment">// set the state machine of the logic block </font>
00308 <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m1">LogicBlock</a>.setLogicStateMachine( logicStateMachine );
00309
00310 <font class="comment">// set the state machine for the sub nodes</font>
00311 vector<CLogicConditionNode *>::iterator itNodes;
00312 <font class="keywordflow">for</font>( itNodes = <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.begin(); itNodes != <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.end(); ++itNodes )
00313 {
00314 (*itNodes)->setLogicStateMachine( logicStateMachine );
00315 }
00316 }
00317
00318 } <font class="comment">// setLogicStateMachine //</font>
00319
00320
00321 <font class="comment">//-------------------------------------------------</font>
00322 <font class="comment">// addNode :</font>
00323 <font class="comment">//</font>
00324 <font class="comment">//-------------------------------------------------</font>
<a name="l00325"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#a2">00325</a> <font class="keywordtype">void</font> CLogicConditionNode::addNode( CLogicConditionNode * node )
00326 {
00327 node->setLogicStateMachine( <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#o0">_LogicStateMachine</a> );
00328 <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.push_back( node );
00329
00330 } <font class="comment">// addToSubNodes //</font>
00331
00332
00333 <font class="comment">//-------------------------------------------------</font>
00334 <font class="comment">// testLogic :</font>
00335 <font class="comment">//</font>
00336 <font class="comment">//-------------------------------------------------</font>
<a name="l00337"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#a3">00337</a> <font class="keywordtype">bool</font> CLogicConditionNode::testLogic()
00338 {
00339 <font class="comment">// test the logic block</font>
00340 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m1">LogicBlock</a>.testLogic() == <font class="keyword">false</font> )
00341 {
00342 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00343 }
00344
00345 <font class="comment">// if there's no subtree we assess the subtree is true</font>
00346 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.size() == 0 )
00347 {
00348 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00349 }
00350
00351 <font class="comment">// test the subtree</font>
00352 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m1">LogicBlock</a>.isNotBlock() )
00353 {
00354 <font class="comment">// the subtree is false if at least one node is true</font>
00355 vector<CLogicConditionNode *>::iterator itNodes;
00356 <font class="keywordflow">for</font>( itNodes = <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.begin(); itNodes != <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.end(); ++itNodes )
00357 {
00358 <font class="keywordflow">if</font>( (*itNodes)->testLogic() == <font class="keyword">true</font> )
00359 {
00360 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00361 }
00362 }
00363
00364 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00365 }
00366 <font class="keywordflow">else</font>
00367 {
00368 <font class="comment">// the subtree is true if at least one node is true</font>
00369 vector<CLogicConditionNode *>::iterator itNodes;
00370 <font class="keywordflow">for</font>( itNodes = <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.begin(); itNodes != <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.end(); ++itNodes )
00371 {
00372 <font class="keywordflow">if</font>( (*itNodes)->testLogic() == <font class="keyword">true</font> )
00373 {
00374 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00375 }
00376 }
00377
00378 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00379 }
00380
00381 } <font class="comment">// testLogic //</font>
00382
00383
00384 <font class="comment">//-------------------------------------------------</font>
00385 <font class="comment">// fillVarSet :</font>
00386 <font class="comment">//</font>
00387 <font class="comment">//-------------------------------------------------</font>
00388 <font class="keywordtype">void</font> CLogicConditionNode::fillVarSet( set<string>& condVars )
00389 {
00390 <font class="keywordflow">if</font>( <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m0">Type</a> == <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#s2s1">LOGIC_NODE</a> )
00391 {
00392 <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m1">LogicBlock</a>.fillVarSet( condVars );
00393 }
00394
00395 vector<CLogicConditionNode *>::iterator itNode;
00396 <font class="keywordflow">for</font>( itNode = <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.begin(); itNode != <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.end(); ++itNode )
00397 {
00398 (*itNode)->fillVarSet( condVars );
00399 }
00400
00401 } <font class="comment">// fillVarSet //</font>
00402
00403
00404 <font class="comment">//-------------------------------------------------</font>
00405 <font class="comment">// serial :</font>
00406 <font class="comment">//</font>
00407 <font class="comment">//-------------------------------------------------</font>
00408 <font class="comment">/*void CLogicConditionNode::serial( IStream &f )</font>
00409 <font class="comment">{</font>
00410 <font class="comment"> f.xmlPush("CONDITION_NODE");</font>
00411 <font class="comment"> </font>
00412 <font class="comment"> f.serialEnum( Type );</font>
00413 <font class="comment"> switch( Type )</font>
00414 <font class="comment"> {</font>
00415 <font class="comment"> case TERMINATOR : break;</font>
00416 <font class="comment"> case LOGIC_NODE :</font>
00417 <font class="comment"> {</font>
00418 <font class="comment"> f.serial( LogicBlock );</font>
00419 <font class="comment"> if( f.isReading() )</font>
00420 <font class="comment"> {</font>
00421 <font class="comment"> uint32 sz;</font>
00422 <font class="comment"> f.serial( sz );</font>
00423 <font class="comment"> uint i;</font>
00424 <font class="comment"> for( i = 0; i < sz; i++ )</font>
00425 <font class="comment"> {</font>
00426 <font class="comment"> CLogicConditionNode * node = new CLogicConditionNode();</font>
00427 <font class="comment"> f.serial( *node );</font>
00428 <font class="comment"> _Nodes.push_back( node );</font>
00429 <font class="comment"> }</font>
00430 <font class="comment"> }</font>
00431 <font class="comment"> else</font>
00432 <font class="comment"> {</font>
00433 <font class="comment"> uint32 sz = _Nodes.size();</font>
00434 <font class="comment"> f.serial( sz );</font>
00435 <font class="comment"> vector<CLogicConditionNode *>::iterator itNode;</font>
00436 <font class="comment"> for( itNode = _Nodes.begin(); itNode != _Nodes.end(); ++itNode )</font>
00437 <font class="comment"> {</font>
00438 <font class="comment"> f.serial( **itNode );</font>
00439 <font class="comment"> }</font>
00440 <font class="comment"> }</font>
00441 <font class="comment"> }</font>
00442 <font class="comment"> break;</font>
00443 <font class="comment"> };</font>
00444 <font class="comment"></font>
00445 <font class="comment"> f.xmlPop();</font>
00446 <font class="comment"></font>
00447 <font class="comment">} // serial //*/</font>
00448
<a name="l00449"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#a6">00449</a> <font class="keywordtype">void</font> CLogicConditionNode::write (xmlNodePtr node)<font class="keyword"> const</font>
00450 <font class="keyword"></font>{
00451 xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"CONDITION_NODE"</font>, NULL);
00452 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Type"</font>, (<font class="keyword">const</font> xmlChar*)toString(Type).c_str());
00453
00454 <font class="keywordflow">switch</font>( Type )
00455 {
00456 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#s2s0">TERMINATOR</a> : <font class="keywordflow">break</font>;
00457 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#s2s1">LOGIC_NODE</a> :
00458 {
00459 <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m1">LogicBlock</a>.write(elmPtr);
00460 vector<CLogicConditionNode *>::const_iterator itNode = <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.begin();
00461 <font class="keywordflow">for</font>( ; itNode != <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.end(); ++itNode )
00462 {
00463 (*itNode)->write(elmPtr);
00464 }
00465 }
00466 <font class="keywordflow">break</font>;
00467 };
00468 }
00469
<a name="l00470"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#a7">00470</a> <font class="keywordtype">void</font> CLogicConditionNode::read (xmlNodePtr node)
00471 {
00472 <a class="code" href="namespaceNLLOGIC.html#a1">xmlCheckNodeName</a> (node, <font class="stringliteral">"CONDITION_NODE"</font>);
00473
00474 <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m0">Type</a> = (TConditionNodeType )atoi(<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Type"</font>).c_str());
00475 <font class="keywordflow">switch</font>( Type )
00476 {
00477 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#s2s0">TERMINATOR</a> : <font class="keywordflow">break</font>;
00478 <font class="keywordflow">case</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#s2s1">LOGIC_NODE</a> :
00479 {
00480 <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m1">LogicBlock</a>.read (node);
00481
00482 {
00483 <font class="comment">// Count the parent</font>
00484 <a class="code" href="types__nl_8h.html#a14">uint</a> nb = CIXml::countChildren (node, <font class="stringliteral">"CONDITION_NODE"</font>);
00485 <a class="code" href="types__nl_8h.html#a14">uint</a> i = 0;
00486 xmlNodePtr parent = CIXml::getFirstChildNode (node, <font class="stringliteral">"CONDITION_NODE"</font>);
00487 <font class="keywordflow">while</font> (i<nb)
00488 {
00489 <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#a0">CLogicConditionNode</a> *<a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a> = <font class="keyword">new</font> <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#a0">CLogicConditionNode</a>();
00490 <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>->read(parent);
00491 <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.push_back (<a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>);
00492
00493 <font class="comment">// Next parent</font>
00494 parent = CIXml::getNextChildNode (parent, <font class="stringliteral">"CONDITION_NODE"</font>);
00495 i++;
00496 }
00497 }
00498 }
00499 <font class="keywordflow">break</font>;
00500 };
00501 }
00502
00503 <font class="comment">//-------------------------------------------------</font>
00504 <font class="comment">// ~CLogicConditionNode :</font>
00505 <font class="comment">//</font>
00506 <font class="comment">//-------------------------------------------------</font>
<a name="l00507"></a><a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#a5">00507</a> CLogicConditionNode::~CLogicConditionNode()
00508 {
00509 vector<CLogicConditionNode *>::iterator itNodes;
00510 <font class="keywordflow">for</font>( itNodes = <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.begin(); itNodes != <a class="code" href="classNLLOGIC_1_1CLogicConditionNode.html#m2">_Nodes</a>.end(); ++itNodes )
00511 {
00512 <font class="keyword">delete</font> (*itNodes);
00513 }
00514
00515 } <font class="comment">// ~CLogicConditionNode //</font>
00516
00517
00518
00519
00520
00521
00522
00523 <font class="comment">//-------------------------------------------------</font>
00524 <font class="comment">// setLogicStateMachine :</font>
00525 <font class="comment">//</font>
00526 <font class="comment">//-------------------------------------------------</font>
<a name="l00527"></a><a class="code" href="classNLLOGIC_1_1CLogicCondition.html#a1">00527</a> <font class="keywordtype">void</font> CLogicCondition::setLogicStateMachine( CLogicStateMachine * logicStateMachine )
00528 {
00529 <font class="keywordflow">if</font>( logicStateMachine == 0 )
00530 {
00531 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LOGIC)<CLogicCondition::setLogicStateMachine> The state machine is null"</font>);
00532 }
00533 <font class="keywordflow">else</font>
00534 {
00535 <font class="comment">// init the logic state machine for each node</font>
00536 vector<CLogicConditionNode>::iterator itNodes;
00537 <font class="keywordflow">for</font>( itNodes = <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#m0">Nodes</a>.begin(); itNodes != <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#m0">Nodes</a>.end(); ++itNodes )
00538 {
00539 (*itNodes).setLogicStateMachine( logicStateMachine );
00540 }
00541 }
00542
00543 } <font class="comment">// setLogicStateMachine //</font>
00544
00545
00546 <font class="comment">//-------------------------------------------------</font>
00547 <font class="comment">// testLogic :</font>
00548 <font class="comment">//</font>
00549 <font class="comment">//-------------------------------------------------</font>
<a name="l00550"></a><a class="code" href="classNLLOGIC_1_1CLogicCondition.html#a5">00550</a> <font class="keywordtype">bool</font> CLogicCondition::testLogic()
00551 {
00552 vector<CLogicConditionNode>::iterator itNodes;
00553 <font class="keywordflow">for</font>( itNodes = <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#m0">Nodes</a>.begin(); itNodes != <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#m0">Nodes</a>.end(); ++itNodes )
00554 {
00555 <font class="keywordflow">if</font>( (*itNodes).testLogic() == <font class="keyword">false</font> )
00556 {
00557 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00558 }
00559 }
00560
00561 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00562
00563 } <font class="comment">// testLogic //</font>
00564
00565
00566
00567 <font class="comment">//-------------------------------------------------</font>
00568 <font class="comment">// fillVarSet :</font>
00569 <font class="comment">//</font>
00570 <font class="comment">//-------------------------------------------------</font>
00571 <font class="keywordtype">void</font> CLogicCondition::fillVarSet( set<string>& condVars )
00572 {
00573 vector<CLogicConditionNode>::iterator itNode;
00574 <font class="keywordflow">for</font>( itNode = <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#m0">Nodes</a>.begin(); itNode != <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#m0">Nodes</a>.end(); ++itNode )
00575 {
00576 (*itNode).fillVarSet( condVars );
00577 }
00578
00579 } <font class="comment">// fillVarSet //</font>
00580
00581
00582
00583 <font class="comment">//-------------------------------------------------</font>
00584 <font class="comment">// serial :</font>
00585 <font class="comment">//</font>
00586 <font class="comment">//-------------------------------------------------</font>
00587 <font class="comment">/*void CLogicCondition::serial( IStream &f )</font>
00588 <font class="comment">{</font>
00589 <font class="comment"> f.xmlPush("CONDITION");</font>
00590 <font class="comment"> </font>
00591 <font class="comment"> f.serial( _ConditionName );</font>
00592 <font class="comment"> f.serialCont( Nodes );</font>
00593 <font class="comment"></font>
00594 <font class="comment"> f.xmlPop();</font>
00595 <font class="comment"></font>
00596 <font class="comment">} // serial //*/</font>
00597
<a name="l00598"></a><a class="code" href="classNLLOGIC_1_1CLogicCondition.html#a7">00598</a> <font class="keywordtype">void</font> CLogicCondition::write (xmlNodePtr node)<font class="keyword"> const</font>
00599 <font class="keyword"></font>{
00600 xmlNodePtr elmPtr = xmlNewChild ( node, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"CONDITION"</font>, NULL);
00601 xmlSetProp (elmPtr, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Name"</font>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLLOGIC_1_1CLogicCondition.html#o0">_ConditionName</a>.c_str());
00602
00603 <a class="code" href="types__nl_8h.html#a14">uint</a> i;
00604 <font class="keywordflow">for</font> (i = 0; i < <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#m0">Nodes</a>.size(); i++)
00605 {
00606 <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#m0">Nodes</a>[i].write(elmPtr);
00607 }
00608 }
00609
<a name="l00610"></a><a class="code" href="classNLLOGIC_1_1CLogicCondition.html#a8">00610</a> <font class="keywordtype">void</font> CLogicCondition::read (xmlNodePtr node)
00611 {
00612 <a class="code" href="namespaceNLLOGIC.html#a1">xmlCheckNodeName</a> (node, <font class="stringliteral">"CONDITION"</font>);
00613
00614 <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#o0">_ConditionName</a> = <a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Name"</font>);
00615
00616 {
00617 <font class="comment">// Count the parent</font>
00618 <a class="code" href="types__nl_8h.html#a14">uint</a> nb = CIXml::countChildren (node, <font class="stringliteral">"CONDITION_NODE"</font>);
00619 <a class="code" href="types__nl_8h.html#a14">uint</a> i = 0;
00620 xmlNodePtr parent = CIXml::getFirstChildNode (node, <font class="stringliteral">"CONDITION_NODE"</font>);
00621 <font class="keywordflow">while</font> (i<nb)
00622 {
00623 CLogicConditionNode <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>;
00624 <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>.read(parent);
00625 <a class="code" href="classNLLOGIC_1_1CLogicCondition.html#m0">Nodes</a>.push_back (<a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>);
00626
00627 <font class="comment">// Next parent</font>
00628 parent = CIXml::getNextChildNode (parent, <font class="stringliteral">"CONDITION_NODE"</font>);
00629 i++;
00630 }
00631 }
00632 }
00633
00634
00635 } <font class="comment">// NLLOGIC</font>
</pre></div>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|