aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/logic__state__machine_8cpp-source.html
blob: b04adbf86a573647e45db2102ef79a5f0ac0c118 (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
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
705
706
707
708
709
710
711
712
713
714
715
716
<!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>&nbsp;<A CLASS=uplinks HREF='/'><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</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>
&nbsp;

<!-- 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>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>logic_state_machine.cpp</h1><a href="logic__state__machine_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="logic__state__machine_8h.html">nel/logic/logic_state_machine.h</a>"</font>
00028 
00029 <font class="preprocessor">#include "<a class="code" href="service_8h.html">nel/net/service.h</a>"</font>
00030 
00031 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
00032 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00033 <font class="keyword">using</font> <font class="keyword">namespace </font>NLNET;
00034 
00035 <font class="keyword">namespace </font>NLLOGIC
00036 {
00037 
00038 <font class="comment">// test if a string is valid considering a filter and a motif</font>
00039 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLLOGIC.html#a3">testNameWithFilter</a>( <a class="code" href="types__nl_8h.html#a5">sint8</a> filter, string motif, string varName );
00040 
00041 <font class="keywordtype">void</font> <a class="code" href="namespaceNLLOGIC.html#a1">xmlCheckNodeName</a> (xmlNodePtr &amp;node, <font class="keyword">const</font> <font class="keywordtype">char</font> *nodeName)
00042 {
00043         <font class="comment">// Check node name</font>
00044         <font class="keywordflow">if</font> ( node == NULL || ((<font class="keyword">const</font> <font class="keywordtype">char</font>*)node-&gt;name == NULL) || (strcmp ((<font class="keyword">const</font> <font class="keywordtype">char</font>*)node-&gt;name, nodeName) != 0) )
00045         {
00046 
00047                 <font class="comment">// try to find a child</font>
00048                 <font class="keywordflow">if</font> (node != NULL)
00049                 {
00050                         node = CIXml::getFirstChildNode (node, nodeName);
00051                         <font class="keywordflow">if</font> ( node != NULL &amp;&amp; ((<font class="keyword">const</font> <font class="keywordtype">char</font>*)node-&gt;name != NULL) &amp;&amp; (strcmp ((<font class="keyword">const</font> <font class="keywordtype">char</font>*)node-&gt;name, nodeName) == 0) )
00052                         {
00053                                 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"check node %s ok in the child"</font>, nodeName);
00054                                 <font class="keywordflow">return</font>;
00055                         }
00056                 }
00057 
00058                 <font class="comment">// Make an error message</font>
00059                 <font class="keywordtype">char</font> tmp[512];
00060                 <a class="code" href="namespaceNLMISC.html#a203">smprintf</a> (tmp, 512, <font class="stringliteral">"LogicStateMachine STATE_MACHINE XML Syntax error in block line %d, node %s should be %s"</font>, 
00061                         (<font class="keywordtype">int</font>)node-&gt;content, node-&gt;name, nodeName);
00062                 
00063                 <a class="code" href="debug_8h.html#a1">nlinfo</a> (tmp);
00064                 <a class="code" href="debug_8h.html#a12">nlstop</a>;
00065                 <font class="keywordflow">throw</font> EXmlParsingError (tmp);
00066         }
00067 
00068         <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"check node %s ok"</font>, nodeName);
00069 }
00070 
00071 std::string <a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (xmlNodePtr node, <font class="keyword">const</font> <font class="keywordtype">char</font> *propName)
00072 {
00073         <font class="keyword">const</font> <font class="keywordtype">char</font> *name = (<font class="keyword">const</font> <font class="keywordtype">char</font>*)xmlGetProp (node, (xmlChar*)propName);
00074         <font class="keywordflow">if</font> (name)
00075         {
00076                 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"get prop %s = %s"</font>, propName, name);
00077                 string n = name;
00078                 xmlFree ((<font class="keywordtype">void</font>*)name);
00079                 <font class="keywordflow">return</font> n;
00080         }
00081         <font class="keywordflow">else</font>
00082         {
00083                 <font class="comment">// Make an error message</font>
00084                 <font class="keywordtype">char</font> tmp[512];
00085                 <a class="code" href="namespaceNLMISC.html#a203">smprintf</a> (tmp, 512, <font class="stringliteral">"LogicStateMachine XML Syntax error in block %s line %d, aguments Name not found"</font>, 
00086                         node-&gt;name, (<font class="keywordtype">int</font>)node-&gt;content);
00087                 <font class="keywordflow">throw</font> EXmlParsingError (tmp);
00088                 <font class="keywordflow">return</font> <font class="stringliteral">""</font>;
00089         }
00090 }
00091 
00092 
00093 <font class="comment">//---------------------------------------------------</font>
00094 <font class="comment">// setCurrentState :</font>
00095 <font class="comment">// </font>
00096 <font class="comment">//---------------------------------------------------</font>
<a name="l00097"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a7">00097</a> <font class="keywordtype">void</font> CLogicStateMachine::setCurrentState( string stateName )
00098 {
00099         map&lt;string,CLogicState&gt;::iterator itStates = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.find( stateName );
00100         <font class="keywordflow">if</font>( itStates != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.end() )
00101         {
00102                 (*itStates).second.exitState();
00103         
00104                 <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o4">_CurrentState</a> = stateName;
00105 
00106                 (*itStates).second.enterState();
00107 
00108                 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Switching to state \"%s\""</font>,<a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o4">_CurrentState</a>.c_str());
00109         }
00110         <font class="keywordflow">else</font>
00111         {
00112                 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LOGIC)&lt;CLogicStateMachine::setCurrentState&gt; The state \"%s\" is not in the state machine \"%s\""</font>,stateName.c_str(),<a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o5">_Name</a>.c_str());
00113         }
00114 
00115 } <font class="comment">// setCurrentState //</font>
00116 
00117 
00118 
00119 <font class="comment">//---------------------------------------------------</font>
00120 <font class="comment">// addCondition :</font>
00121 <font class="comment">// </font>
00122 <font class="comment">//---------------------------------------------------</font>
<a name="l00123"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a14">00123</a> <font class="keywordtype">void</font> CLogicStateMachine::addCondition( CLogicCondition <a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a> ) 
00124 { 
00125         <a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a>.setLogicStateMachine(<font class="keyword">this</font>);
00126         <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o2">_Conditions</a>.insert(make_pair(<a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a>.getName(),<a class="code" href="driver__opengl__extension__def_8h.html#a254">condition</a>)); 
00127 
00128 } <font class="comment">// addCondition //</font>
00129 
00130 
00131 
00132 <font class="comment">//---------------------------------------------------</font>
00133 <font class="comment">// addState :</font>
00134 <font class="comment">// </font>
00135 <font class="comment">//---------------------------------------------------</font>
<a name="l00136"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a17">00136</a> <font class="keywordtype">void</font> CLogicStateMachine::addState( CLogicState logicState ) 
00137 {
00138         logicState.setLogicStateMachine( <font class="keyword">this</font> );
00139         <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.insert( std::make_pair(logicState.getName(),logicState) );
00140         
00141 } <font class="comment">// addState //</font>
00142 
00143 
00144 
00145 
00146 <font class="comment">//---------------------------------------------------</font>
00147 <font class="comment">// addSIdMap :</font>
00148 <font class="comment">// </font>
00149 <font class="comment">//---------------------------------------------------</font>
<a name="l00150"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a8">00150</a> <font class="keywordtype">void</font> CLogicStateMachine::addSIdMap( <font class="keyword">const</font> <a class="code" href="namespaceNLLOGIC.html#a0">TSIdMap</a>&amp; sIdMap )
00151 {
00152         <font class="comment">// call addSIdMap for each state</font>
00153         map&lt;string,CLogicState&gt;::iterator itStates;
00154         <font class="keywordflow">for</font>( itStates = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.begin(); itStates != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.end(); ++itStates )
00155         {
00156                 (*itStates).second.addSIdMap( sIdMap );
00157         }
00158 
00159 } <font class="comment">// addSIdMap //</font>
00160 
00161 
00162 
00163 <font class="comment">//---------------------------------------------------</font>
00164 <font class="comment">// processLogic :</font>
00165 <font class="comment">// </font>
00166 <font class="comment">//---------------------------------------------------</font>
<a name="l00167"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a9">00167</a> <font class="keywordtype">void</font> CLogicStateMachine::processLogic()
00168 {       
00169         <font class="comment">// call processLogic for the current state</font>
00170         map&lt;string,CLogicState&gt;::iterator itStates = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.find( <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o4">_CurrentState</a> );
00171         <a class="code" href="debug_8h.html#a6">nlassert</a>( itStates != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.end() )
00172         (*itStates).second.processLogic();
00173 
00174         <font class="comment">// update the counters</font>
00175         map&lt;string,CLogicCounter&gt;::iterator itCount;
00176         <font class="keywordflow">for</font>( itCount = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.begin(); itCount != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.end(); ++itCount )
00177         {
00178                 (*itCount).second.update();
00179         }
00180         
00181 } <font class="comment">// processLogic //</font>
00182 
00183 
00184 
00185 <font class="comment">//---------------------------------------------------</font>
00186 <font class="comment">// getMessagesToSend :</font>
00187 <font class="comment">// </font>
00188 <font class="comment">//---------------------------------------------------</font>
00189 <font class="keywordtype">void</font> CLogicStateMachine::getMessagesToSend( multimap&lt;CEntityId,CMessage&gt;&amp; msgs )
00190 {
00191         map&lt;std::string, CLogicState&gt;::iterator itState;
00192         <font class="keywordflow">for</font>( itState = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.begin(); itState != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.end(); ++itState )
00193         {
00194                 (*itState).second.getMessagesToSend( msgs );
00195         }       
00196         
00197 } <font class="comment">// getMessagesToSend //</font>
00198 
00199 
00200 
00201 
00202 <font class="comment">//---------------------------------------------------</font>
00203 <font class="comment">// getVariable :</font>
00204 <font class="comment">// </font>
00205 <font class="comment">//---------------------------------------------------</font>
<a name="l00206"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a12">00206</a> <font class="keywordtype">bool</font> CLogicStateMachine::getVariable( std::string&amp; varName, CLogicVariable&amp; var )
00207 {
00208         map&lt;string,CLogicVariable&gt;::iterator itVar = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.find( varName );
00209         <font class="keywordflow">if</font>( itVar != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.end() )
00210         {
00211                 var = (*itVar).second;
00212                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00213         }
00214 
00215         map&lt;string,CLogicCounter&gt;::iterator itCount = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.find( varName );
00216         <font class="keywordflow">if</font>( itCount != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.end() )
00217         {
00218                 var = (*itCount).second;
00219                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00220         }
00221         
00222         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00223 
00224 } <font class="comment">// getVariable //</font>
00225 
00226 
00227 
00228 <font class="comment">//---------------------------------------------------</font>
00229 <font class="comment">// getCondition :</font>
00230 <font class="comment">// </font>
00231 <font class="comment">//---------------------------------------------------</font>
<a name="l00232"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a15">00232</a> <font class="keywordtype">bool</font> CLogicStateMachine::getCondition( <font class="keyword">const</font> std::string&amp; condName, CLogicCondition&amp; cond )
00233 {
00234         map&lt;string,CLogicCondition&gt;::iterator itCond = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o2">_Conditions</a>.find( condName );
00235         <font class="keywordflow">if</font>( itCond != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o2">_Conditions</a>.end() )
00236         {
00237                 cond = (*itCond).second;
00238                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00239         }
00240         <font class="keywordflow">else</font>
00241         { 
00242                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00243         }
00244 
00245 } <font class="comment">// getCondition //</font>
00246 
00247 
00248 <font class="comment">//---------------------------------------------------</font>
00249 <font class="comment">// modifyVariable :</font>
00250 <font class="comment">// </font>
00251 <font class="comment">//---------------------------------------------------</font>
<a name="l00252"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a18">00252</a> <font class="keywordtype">void</font> CLogicStateMachine::modifyVariable( string varName, string modifOperator, <a class="code" href="types__nl_8h.html#a11">sint64</a> value )
00253 {
00254         map&lt;string,CLogicVariable&gt;::iterator itVar = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.find( varName );
00255         <font class="keywordflow">if</font>( itVar != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.end() )
00256         {
00257                 (*itVar).second.applyModification( modifOperator, value );
00258                 <font class="keywordflow">return</font>;
00259         }
00260         map&lt;string,CLogicCounter&gt;::iterator itCount = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.find( varName );
00261         <font class="keywordflow">if</font>( itCount != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.end() )
00262         {
00263                 (*itCount).second.applyModification( modifOperator, value );
00264                 <font class="keywordflow">return</font>;
00265         }
00266 
00267         <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"(LOGIC)&lt;CLogicStateMachine::modifyVariable&gt; The variable \"%s\" is not in the state machine \"%s\""</font>,varName.c_str(),<a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o5">_Name</a>.c_str());
00268 
00269 } <font class="comment">// modifyVariable //</font>
00270 
00271 
00272 
00273 <font class="comment">//---------------------------------------------------</font>
00274 <font class="comment">// serial :</font>
00275 <font class="comment">// </font>
00276 <font class="comment">//---------------------------------------------------</font>
00277 <font class="comment">/*void CLogicStateMachine::serial( IStream &amp;f )</font>
00278 <font class="comment">{</font>
00279 <font class="comment">        f.xmlPush("STATE_MACHINE");</font>
00280 <font class="comment"></font>
00281 <font class="comment">        </font>
00282 <font class="comment">        f.serialCont( _Variables );</font>
00283 <font class="comment">        f.serialCont( _Counters );</font>
00284 <font class="comment">        f.serialCont( _Conditions );</font>
00285 <font class="comment">        f.serialCont( _States );</font>
00286 <font class="comment">        f.serial( _CurrentState );</font>
00287 <font class="comment">        f.serial( _Name );</font>
00288 <font class="comment">        </font>
00289 <font class="comment">        if( f.isReading() )</font>
00290 <font class="comment">        {</font>
00291 <font class="comment">                // set the the logic state machine addr in each state</font>
00292 <font class="comment">                map&lt;string,CLogicState&gt;::iterator itStates;</font>
00293 <font class="comment">                for( itStates = _States.begin(); itStates != _States.end(); ++itStates )</font>
00294 <font class="comment">                {</font>
00295 <font class="comment">                        (*itStates).second.setLogicStateMachine( this );</font>
00296 <font class="comment">                }</font>
00297 <font class="comment"></font>
00298 <font class="comment">                // set the the logic state machine addr in each conditions</font>
00299 <font class="comment">                map&lt;string,CLogicCondition&gt;::iterator itCond;</font>
00300 <font class="comment">                for( itCond = _Conditions.begin(); itCond != _Conditions.end(); ++itCond )</font>
00301 <font class="comment">                {</font>
00302 <font class="comment">                        (*itCond).second.setLogicStateMachine( this );</font>
00303 <font class="comment">                }</font>
00304 <font class="comment">        }</font>
00305 <font class="comment">        </font>
00306 <font class="comment">        f.xmlPop();</font>
00307 <font class="comment"></font>
00308 <font class="comment">} // serial //*/</font>
00309 
00310 
00311 <font class="comment">//---------------------------------------------------</font>
00312 <font class="comment">//      Display the variables</font>
00313 <font class="comment">//</font>
00314 <font class="comment">//---------------------------------------------------</font>
<a name="l00315"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a19">00315</a> <font class="keywordtype">void</font> CLogicStateMachine::displayVariables()
00316 {
00317         multimap&lt;CEntityId,string&gt; allVariables;
00318         
00319         <font class="comment">// // get vars referenced in the states</font>
00320         map&lt;string, CLogicState&gt;::iterator itS;
00321         <font class="keywordflow">for</font>( itS = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.begin(); itS != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.end(); ++itS )
00322         {
00323                 (*itS).second.fillVarMap( allVariables );
00324         }
00325 
00326         <font class="comment">// extract the unclaimed variables from all the variables</font>
00327         vector&lt;string&gt; unclaimedVariables;
00328         CEntityId unknown;
00329         unknown.setType( 0xfe );
00330         unknown.setCreatorId( 0 );
00331         unknown.setDynamicId( 0 );
00332         pair&lt;multimap&lt;CEntityId,string&gt;::iterator,multimap&lt;CEntityId,string&gt;::iterator&gt; itVarsRng = allVariables.equal_range(unknown);
00333         multimap&lt;CEntityId,string&gt;::iterator itVars;
00334         
00335         <font class="keywordflow">for</font>( itVars = itVarsRng.first; itVars != itVarsRng.second; )
00336         {
00337                 multimap&lt;CEntityId,string&gt;::iterator itDel = itVars++;
00338                 unclaimedVariables.push_back( (*itDel).second );
00339                 allVariables.erase( itDel );
00340         }
00341         <font class="comment">/*</font>
00342 <font class="comment">        if( itVarsRng.first != allVariables.end() )</font>
00343 <font class="comment">        {</font>
00344 <font class="comment">                itVars = itVarsRng.first;</font>
00345 <font class="comment">                do</font>
00346 <font class="comment">                {</font>
00347 <font class="comment">                        multimap&lt;CEntityId,string&gt;::iterator itDel = itVars++;</font>
00348 <font class="comment">                        unclaimedVariables.push_back( (*itDel).second );</font>
00349 <font class="comment">                        allVariables.erase( itDel );</font>
00350 <font class="comment">                }</font>
00351 <font class="comment">                while( itVars != itVarsRng.second );</font>
00352 <font class="comment">        }</font>
00353 <font class="comment">        */</font>
00354 
00355 
00356         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"VARIABLES/COUNTERS in %s : %d/%d are registered : "</font>,<a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o5">_Name</a>.c_str(),allVariables.size(),allVariables.size()+unclaimedVariables.size());
00357         <font class="comment">// display the registered variables</font>
00358         <font class="keywordflow">for</font>( itVars = allVariables.begin(); itVars != allVariables.end(); ++itVars )
00359         {
00360                 map&lt;string, CLogicVariable&gt;::const_iterator itV = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.find( (*itVars).second );
00361                 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"[%d] %s = %f"</font>,(<a class="code" href="types__nl_8h.html#a6">uint8</a>)(*itVars).first.getDynamicId(),(*itV).first.c_str(),(double)(*itV).second.getValue());
00362         }
00363 
00364         <font class="comment">// display the unclaimed variables</font>
00365         sort( unclaimedVariables.begin(), unclaimedVariables.end() );
00366         vector&lt;string&gt;::iterator itUV;
00367         <font class="keywordflow">for</font>( itUV = unclaimedVariables.begin(); itUV != unclaimedVariables.end(); ++itUV )
00368         {
00369                 map&lt;string, CLogicVariable&gt;::const_iterator itV = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.find( *itUV );
00370                 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"(-)%s = %f"</font>,(*itV).first.c_str(),(double)(*itV).second.getValue());
00371         }
00372         
00373 } <font class="comment">// displayVariables //</font>
00374 
00375 
00376 <font class="comment">//---------------------------------------------------</font>
00377 <font class="comment">//      Display the states</font>
00378 <font class="comment">//</font>
00379 <font class="comment">//---------------------------------------------------</font>
<a name="l00380"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a20">00380</a> <font class="keywordtype">void</font> CLogicStateMachine::displayStates()
00381 {
00382         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"There are %d STATES in the state machine \"%s\": "</font>,<a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.size(),<a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o5">_Name</a>.c_str());
00383         map&lt;string, CLogicState&gt;::const_iterator itS;
00384         <font class="keywordflow">for</font>( itS = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.begin(); itS != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.end(); ++itS )
00385         {
00386                 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"%s"</font>,(*itS).first.c_str());
00387         }
00388         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"The current state is : \"%s\""</font>,<a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o4">_CurrentState</a>.c_str());
00389 
00390 } <font class="comment">// displayStates //</font>
00391 
00392 
00393 <font class="comment">//---------------------------------------------------</font>
00394 <font class="comment">//      Set the verbose mode for the variable</font>
00395 <font class="comment">//</font>
00396 <font class="comment">//---------------------------------------------------</font>
<a name="l00397"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a21">00397</a> <font class="keywordtype">void</font> CLogicStateMachine::setVerbose( string varName, <font class="keywordtype">bool</font> b )
00398 {
00399         <font class="keywordflow">if</font>( varName == <font class="stringliteral">"all"</font> )
00400         {
00401                 map&lt;string, CLogicVariable&gt;::iterator itV;
00402                 <font class="keywordflow">for</font>( itV = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.begin(); itV != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.end(); ++itV )
00403                 {
00404                         (*itV).second.setVerbose( b );
00405                 }
00406                 map&lt;string, CLogicCounter&gt;::iterator itC;
00407                 <font class="keywordflow">for</font>( itC = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.begin(); itC != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.end(); ++itC )
00408                 {
00409                         (*itC).second.setVerbose( b );
00410                 }
00411                 <font class="keywordflow">if</font>(b)
00412                 {
00413                         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"the verbose mode has been activated for all the variables"</font>,varName.c_str());
00414                 }
00415                 <font class="keywordflow">else</font>
00416                 {
00417                         <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"the verbose mode has been desactivated for all the variables"</font>,varName.c_str());
00418                 }
00419                 <font class="keywordflow">return</font>;
00420         }
00421         
00422         <a class="code" href="types__nl_8h.html#a5">sint8</a> filter = -1;
00423         string motif;
00424         <font class="comment">// *xxx* =&gt; we look for a string with xxx inside</font>
00425         <font class="keywordflow">if</font>( varName[0]==<font class="charliteral">'*'</font> &amp;&amp; varName[varName.size()-1]==<font class="charliteral">'*'</font>) 
00426         {
00427                 motif = varName.substr(1,varName.size()-2);
00428                 filter = 0;
00429         }
00430         <font class="keywordflow">else</font>
00431         <font class="comment">// *xxx =&gt; we look for a string with xxx at the end</font>
00432         <font class="keywordflow">if</font>( varName[0]==<font class="charliteral">'*'</font> ) 
00433         {
00434                 motif = varName.substr(1,varName.size()-1);
00435                 filter = 1;
00436         }
00437         <font class="keywordflow">else</font>
00438         <font class="comment">// xxx* =&gt; we look for a string with xxx at the begining</font>
00439         <font class="keywordflow">if</font>( varName[varName.size()-1]==<font class="charliteral">'*'</font> ) 
00440         {
00441                 motif = varName.substr(0,varName.size()-1);
00442                 filter = 2;
00443         }
00444 
00445         <font class="comment">// if no filter</font>
00446         <font class="keywordflow">if</font>( filter == -1 )
00447         {
00448                 map&lt;string, CLogicVariable&gt;::iterator itV = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.find( varName );
00449                 <font class="keywordflow">if</font>( itV != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.end() )
00450                 {
00451                         (*itV).second.setVerbose( b );
00452                 }
00453                 map&lt;string, CLogicCounter&gt;::iterator itC = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.find( varName );
00454                 <font class="keywordflow">if</font>( itC != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.end() || varName ==<font class="stringliteral">"all"</font> )
00455                 {
00456                         (*itC).second.setVerbose( b );
00457                 }
00458         }
00459         <font class="comment">// if filter</font>
00460         <font class="keywordflow">else</font>
00461         {
00462                 map&lt;string, CLogicVariable&gt;::iterator itV;
00463                 <font class="keywordflow">for</font>( itV = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.begin(); itV != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.end(); ++itV )
00464                 {
00465                         <font class="keywordflow">if</font>( <a class="code" href="namespaceNLLOGIC.html#a3">testNameWithFilter</a>( filter, motif,(*itV).second.getName()) )
00466                         {
00467                                 (*itV).second.setVerbose( b );
00468                         }
00469                 }
00470                 map&lt;string, CLogicCounter&gt;::iterator itC;
00471                 <font class="keywordflow">for</font>( itC = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.begin(); itC != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.end(); ++itC )
00472                 {
00473                         <font class="keywordflow">if</font>( <a class="code" href="namespaceNLLOGIC.html#a3">testNameWithFilter</a>( filter, motif,(*itC).second.getName()) )
00474                         {
00475                                 (*itC).second.setVerbose( b );
00476                         }
00477                 }
00478         }
00479         <font class="keywordflow">if</font>(b)
00480         {
00481                 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"the verbose mode for variable \"%s\" has been activated"</font>,varName.c_str());
00482         }
00483         <font class="keywordflow">else</font>
00484         {
00485                 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"the verbose mode for variable \"%s\" has been desactivated"</font>,varName.c_str());
00486         }
00487         
00488 } <font class="comment">// setVerbose //</font>
00489 
00490 
00491 
00492 <font class="comment">//---------------------------------------------------</font>
00493 <font class="comment">//      testNameWithFilter :</font>
00494 <font class="comment">//</font>
00495 <font class="comment">//---------------------------------------------------</font>
00496 <font class="keywordtype">bool</font> <a class="code" href="namespaceNLLOGIC.html#a3">testNameWithFilter</a>( <a class="code" href="types__nl_8h.html#a5">sint8</a> filter, string motif, string varName )
00497 {
00498         <font class="keywordflow">if</font>( varName.size() &gt; motif.size() )
00499         {
00500                 <font class="keywordflow">switch</font>( filter )
00501                 {
00502                         <font class="comment">// *xxx*</font>
00503                         <font class="keywordflow">case</font> 0 :
00504                         {
00505                                 <font class="keywordflow">if</font>(varName.find(motif) != -1)
00506                                 {
00507                                         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00508                                 }
00509                         }
00510                         <font class="keywordflow">break</font>;
00511 
00512                         <font class="comment">// *xxx</font>
00513                         <font class="keywordflow">case</font> 1 :
00514                         {
00515                                 <a class="code" href="types__nl_8h.html#a13">sint</a> beginIndex = varName.size() - motif.size() - 1;
00516                                 string endOfVarName = varName.substr(beginIndex,motif.size());
00517                                 <font class="keywordflow">if</font>( endOfVarName == motif )
00518                                 {
00519                                         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00520                                 }
00521                         }
00522                         <font class="keywordflow">break</font>;
00523         
00524                         <font class="comment">// xxx*</font>
00525                         <font class="keywordflow">case</font> 2 :
00526                         {
00527                                 string beginOfVarName = varName.substr(0,motif.size());
00528                                 <font class="keywordflow">if</font>( beginOfVarName == motif )
00529                                 {
00530                                         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00531                                 }
00532                         }
00533                         <font class="keywordflow">break</font>;
00534                 }
00535         }
00536 
00537         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00538 
00539 } <font class="comment">// testNameWithFilter //</font>
00540 
<a name="l00541"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a22">00541</a> <font class="keywordtype">void</font> CLogicStateMachine::write (xmlDocPtr doc)<font class="keyword"> const</font>
00542 <font class="keyword"></font>{
00543         <font class="comment">// Create the first node</font>
00544         xmlNodePtr node = xmlNewDocNode (doc, NULL, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"STATE_MACHINE"</font>, NULL);
00545         xmlDocSetRootElement (doc, node);
00546         xmlSetProp (node, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"Name"</font>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o5">_Name</a>.c_str());
00547         xmlSetProp (node, (<font class="keyword">const</font> xmlChar*)<font class="stringliteral">"CurrentState"</font>, (<font class="keyword">const</font> xmlChar*)<a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o4">_CurrentState</a>.c_str());
00548 
00549         <font class="keywordflow">for</font> (std::map&lt;std::string, CLogicVariable&gt;::const_iterator vit = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.begin(); vit != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.end(); vit++)
00550         {
00551                 (*vit).second.write(node);
00552         }
00553 
00554         <font class="keywordflow">for</font> (std::map&lt;std::string, CLogicCounter&gt;::const_iterator cit = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.begin(); cit != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.end(); cit++)
00555         {
00556                 (*cit).second.write(node);
00557         }
00558 
00559         <font class="keywordflow">for</font> (std::map&lt;std::string, CLogicCondition&gt;::const_iterator c2it = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o2">_Conditions</a>.begin(); c2it != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o2">_Conditions</a>.end(); c2it++)
00560         {
00561                 (*c2it).second.write(node);
00562         }
00563         
00564         <font class="keywordflow">for</font> (std::map&lt;std::string, CLogicState&gt;::const_iterator sit = <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.begin(); sit != <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.end(); sit++)
00565         {
00566                 (*sit).second.write(node);
00567         }
00568 }
00569 
<a name="l00570"></a><a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a23">00570</a> <font class="keywordtype">void</font> CLogicStateMachine::read (xmlNodePtr node)
00571 {
00572         <a class="code" href="namespaceNLLOGIC.html#a1">xmlCheckNodeName</a> (node, <font class="stringliteral">"STATE_MACHINE"</font>);
00573 
00574         <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a5">setName</a> (<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"Name"</font>));
00575 
00576         {
00577                 <font class="comment">// Count the parent</font>
00578                 <a class="code" href="types__nl_8h.html#a14">uint</a> nb = CIXml::countChildren (node, <font class="stringliteral">"VARIABLE"</font>);
00579                 <a class="code" href="types__nl_8h.html#a14">uint</a> i = 0;
00580                 xmlNodePtr parent = CIXml::getFirstChildNode (node, <font class="stringliteral">"VARIABLE"</font>);
00581                 <font class="keywordflow">while</font> (i&lt;nb)
00582                 {
00583                         CLogicVariable <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>;
00584                         <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>.read(parent);
00585                         <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o0">_Variables</a>.insert (make_pair(<a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>.getName(), <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>));
00586 
00587                         <font class="comment">// Next parent</font>
00588                         parent = CIXml::getNextChildNode (parent, <font class="stringliteral">"VARIABLE"</font>);
00589                         i++;
00590                 }
00591         }
00592 
00593         {
00594                 <font class="comment">// Count the parent</font>
00595                 <a class="code" href="types__nl_8h.html#a14">uint</a> nb = CIXml::countChildren (node, <font class="stringliteral">"COUNTER"</font>);
00596                 <a class="code" href="types__nl_8h.html#a14">uint</a> i = 0;
00597                 xmlNodePtr parent = CIXml::getFirstChildNode (node, <font class="stringliteral">"COUNTER"</font>);
00598                 <font class="keywordflow">while</font> (i&lt;nb)
00599                 {
00600                         CLogicCounter <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>;
00601                         <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>.read(parent);
00602                         <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o1">_Counters</a>.insert (make_pair(<a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>.getName(), <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>));
00603 
00604                         <font class="comment">// Next parent</font>
00605                         parent = CIXml::getNextChildNode (parent, <font class="stringliteral">"COUNTER"</font>);
00606                         i++;
00607                 }
00608         }
00609 
00610         {
00611                 <font class="comment">// Count the parent</font>
00612                 <a class="code" href="types__nl_8h.html#a14">uint</a> nb = CIXml::countChildren (node, <font class="stringliteral">"CONDITION"</font>);
00613                 <a class="code" href="types__nl_8h.html#a14">uint</a> i = 0;
00614                 xmlNodePtr parent = CIXml::getFirstChildNode (node, <font class="stringliteral">"CONDITION"</font>);
00615                 <font class="keywordflow">while</font> (i&lt;nb)
00616                 {
00617                         CLogicCondition <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>;
00618                         <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>.read(parent);
00619                         <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o2">_Conditions</a>.insert (make_pair(<a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>.getName(), <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>));
00620 
00621                         <font class="comment">// Next parent</font>
00622                         parent = CIXml::getNextChildNode (parent, <font class="stringliteral">"CONDITION"</font>);
00623                         i++;
00624                 }
00625         }
00626 
00627         {
00628                 <font class="comment">// Count the parent</font>
00629                 <a class="code" href="types__nl_8h.html#a14">uint</a> nb = CIXml::countChildren (node, <font class="stringliteral">"STATE"</font>);
00630                 <a class="code" href="types__nl_8h.html#a14">uint</a> i = 0;
00631                 xmlNodePtr parent = CIXml::getFirstChildNode (node, <font class="stringliteral">"STATE"</font>);
00632                 <font class="keywordflow">while</font> (i&lt;nb)
00633                 {
00634                         CLogicState <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>;
00635                         <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>.read(parent);
00636                         <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#o3">_States</a>.insert (make_pair(<a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>.getName(), <a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>));
00637 
00638                         <font class="comment">// Next parent</font>
00639                         parent = CIXml::getNextChildNode (parent, <font class="stringliteral">"STATE"</font>);
00640                         i++;
00641                 }
00642         }
00643 
00644         <a class="code" href="classNLLOGIC_1_1CLogicStateMachine.html#a7">setCurrentState</a> (<a class="code" href="namespaceNLLOGIC.html#a2">getXMLProp</a> (node, <font class="stringliteral">"CurrentState"</font>));
00645 }
00646 
00647 } <font class="comment">// NLLOGIC</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>