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
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
|
<!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.2 on Mon Mar 5 22:00:39 2001 -->
<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>agent_script.cpp</h1><a href="agent_script_cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
00006 <font class="comment">/* Copyright, 2000 Nevrax Ltd.
</font>00007 <font class="comment"> *
</font>00008 <font class="comment"> * This file is part of NEVRAX NEL.
</font>00009 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify
</font>00010 <font class="comment"> * it under the terms of the GNU General Public License as published by
</font>00011 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)
</font>00012 <font class="comment"> * any later version.
</font>00013 <font class="comment">
</font>00014 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but
</font>00015 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of
</font>00016 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
</font>00017 <font class="comment"> * General Public License for more details.
</font>00018 <font class="comment">
</font>00019 <font class="comment"> * You should have received a copy of the GNU General Public License
</font>00020 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the
</font>00021 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
</font>00022 <font class="comment"> * MA 02111-1307, USA.
</font>00023 <font class="comment"> */</font>
00024 <font class="preprocessor">#include "<a class="code" href="agent_script_h.html">nel/ai/agent/agent_script.h</a>"</font>
00025 <font class="preprocessor">#include "<a class="code" href="agent_manager_h.html">nel/ai/agent/agent_manager.h</a>"</font>
00026 <font class="preprocessor">#include "<a class="code" href="agent_local_mailer_h.html">nel/ai/agent/agent_local_mailer.h</a>"</font>
00027 <font class="preprocessor">#include "<a class="code" href="interpret_object_agent_h.html">nel/ai/script/interpret_object_agent.h</a>"</font>
00028 <font class="preprocessor">#include "<a class="code" href="codage_h.html">nel/ai/script/codage.h</a>"</font>
00029 <font class="preprocessor">#include "<a class="code" href="type_def_h.html">nel/ai/script/type_def.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="object_unknown_h.html">nel/ai/script/object_unknown.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="agent_method_def_h.html">nel/ai/agent/agent_method_def.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="message_script_h.html">nel/ai/agent/message_script.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="interpret_object_message_h.html">nel/ai/script/interpret_object_message.h</a>"</font>
00034 <font class="preprocessor">#include "<a class="code" href="interpret_object_agent_h.html">nel/ai/script/interpret_object_agent.h</a>"</font>
00035 <font class="preprocessor">#include "<a class="code" href="agent_nombre_h.html">nel/ai/agent/agent_nombre.h</a>"</font>
00036 <font class="preprocessor">#include "<a class="code" href="performative_h.html">nel/ai/agent/performative.h</a>"</font>
00037 <font class="preprocessor">#include "<a class="code" href="msg_notify_h.html">nel/ai/agent/msg_notify.h</a>"</font>
00038 <font class="preprocessor">#include "<a class="code" href="msg_goal_h.html">nel/ai/agent/msg_goal.h</a>"</font>
00039 <font class="preprocessor">#include "<a class="code" href="factbase_h.html">nel/ai/logic/factbase.h</a>"</font>
00040 <font class="preprocessor">#include "<a class="code" href="goal_h.html">nel/ai/logic/goal.h</a>"</font>
00041 <font class="preprocessor">#include "<a class="code" href="key_agent_h.html">nel/ai/agent/key_agent.h</a>"</font>
00042 <font class="preprocessor">#include "<a class="code" href="list_manager_h.html">nel/ai/agent/list_manager.h</a>"</font>
00043
00044
00045
00046 <font class="keyword">namespace</font> NLAIAGENT
00047 {
00048 <font class="keyword">static</font> CGroupType listBidon;
00049
<a name="l00050"></a><a class="code" href="namespace_NLAIAGENT.html#a11">00050</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__COperandSimpleListOr.html">NLAISCRIPT::COperandSimpleListOr</a> *msgType;
<a name="l00051"></a><a class="code" href="namespace_NLAIAGENT.html#a12">00051</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__COperandSimpleListOr.html">NLAISCRIPT::COperandSimpleListOr</a> *msgPerf;
<a name="l00052"></a><a class="code" href="namespace_NLAIAGENT.html#a13">00052</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__CParam.html">NLAISCRIPT::CParam</a> *SendParamMessageScript;
<a name="l00053"></a><a class="code" href="namespace_NLAIAGENT.html#a14">00053</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__CParam.html">NLAISCRIPT::CParam</a> *SendCompParamMessageScript;
<a name="l00054"></a><a class="code" href="namespace_NLAIAGENT.html#a15">00054</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a> *IdMsgNotifyParentClass;
<a name="l00055"></a><a class="code" href="namespace_NLAIAGENT.html#a16">00055</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__COperandSimpleListOr.html">NLAISCRIPT::COperandSimpleListOr</a> *IdMsgNotifyParent;
<a name="l00056"></a><a class="code" href="namespace_NLAIAGENT.html#a17">00056</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__CParam.html">NLAISCRIPT::CParam</a> *ParamRunParentNotify;
<a name="l00057"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#p0">00057</a> CAgentScript::CMethodCall **CAgentScript::StaticMethod = NULL;
00058
<a name="l00061"></a><a class="code" href="namespace_NLAIAGENT.html#a18">00061</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a> *IdGoalMsgClass;
<a name="l00062"></a><a class="code" href="namespace_NLAIAGENT.html#a19">00062</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__COperandSimpleListOr.html">NLAISCRIPT::COperandSimpleListOr</a> *IdGoalMsg;
<a name="l00063"></a><a class="code" href="namespace_NLAIAGENT.html#a20">00063</a> <font class="keyword">static</font> <a class="code" href="class_NLAISCRIPT__CParam.html">NLAISCRIPT::CParam</a> *ParamGoalMsg;
00065
<a name="l00066"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#d0">00066</a> <font class="keywordtype">void</font> CAgentScript::initAgentScript()<font class="keyword">
</font>00067 <font class="keyword"> </font>{
00068
00069 msgType = <font class="keyword">new</font> NLAISCRIPT::COperandSimpleListOr(3,
00070 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(CMessageList::IdMessage),
00071 <font class="keyword">new</font> NLAIC::CIdentType(CMessageVector::IdMessageVector),
00072 <font class="keyword">new</font> NLAIC::CIdentType(NLAISCRIPT::CMessageClass::IdMessageClass));
00073
00074 msgPerf = <font class="keyword">new</font> NLAISCRIPT::COperandSimpleListOr(7,
00075 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(CPExec::IdPExec),
00076 <font class="keyword">new</font> NLAIC::CIdentType(CPAchieve::IdPAchieve),
00077 <font class="keyword">new</font> NLAIC::CIdentType(CPAsk::IdPAsk),
00078 <font class="keyword">new</font> NLAIC::CIdentType(CPBreak::IdPBreak),
00079 <font class="keyword">new</font> NLAIC::CIdentType(CPTell::IdPTell),
00080 <font class="keyword">new</font> NLAIC::CIdentType(CPKill::IdPKill),
00081 <font class="keyword">new</font> NLAIC::CIdentType(CPError::IdPError));
00082
00083
00084 SendParamMessageScript = <font class="keyword">new</font> NLAISCRIPT::CParam(2,msgPerf, msgType);
00085
00086 msgPerf-><a class="code" href="class_NLAIC__IPointerGestion.html#a2">incRef</a>();
00087 msgType-><a class="code" href="class_NLAIC__IPointerGestion.html#a2">incRef</a>();
00088
00089 SendCompParamMessageScript = <font class="keyword">new</font> NLAISCRIPT::CParam(3,<font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a>(<font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(CStringType::IdStringType)),
00090 msgPerf, msgType);
00091
00092 IdMsgNotifyParentClass = <font class="keyword">new</font> NLAISCRIPT::COperandSimple(<font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(NLAISCRIPT::CMsgNotifyParentClass::IdMsgNotifyParentClass));
00093
00094 IdMsgNotifyParent = <font class="keyword">new</font> NLAISCRIPT::COperandSimpleListOr(2,
00095 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(NLAISCRIPT::CMsgNotifyParentClass::IdMsgNotifyParentClass),
00096 <font class="keyword">new</font> NLAIC::CIdentType(CNotifyParentScript::IdNotifyParentScript));
00097
00098 ParamRunParentNotify = <font class="keyword">new</font> NLAISCRIPT::CParam(1,IdMsgNotifyParent);
00099
00101 <font class="comment">// Temp, to be transfered in CGDAgentScript (Goal Driven Agent)</font>
00102
00103 IdGoalMsgClass = <font class="keyword">new</font> NLAISCRIPT::COperandSimple(<font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(NLAISCRIPT::CGoalMsgClass::IdGoalMsgClass));
00104
00105 IdGoalMsg = <font class="keyword">new</font> NLAISCRIPT::COperandSimpleListOr(2,
00106 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(NLAISCRIPT::CGoalMsgClass::IdGoalMsgClass),
00107 <font class="keyword">new</font> NLAIC::CIdentType(CGoalMsg::IdGoalMsg));
00108
00109 ParamGoalMsg = <font class="keyword">new</font> NLAISCRIPT::CParam(1,IdGoalMsg);
00111
00112
00113
00114 StaticMethod = <font class="keyword">new</font> CAgentScript::CMethodCall *[CAgentScript::TLastM];
00115
00116 StaticMethod[CAgentScript::TRunAskParentNotify] = <font class="keyword">new</font> CAgentScript::CMethodCall( _RUNASK_,
00117 CAgentScript::TRunAskParentNotify, ParamRunParentNotify,
00118 CAgentScript::CheckAll,
00119 1,
00120 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(IdMsgNotifyParentClass));
00121
00122 IdMsgNotifyParentClass-><a class="code" href="class_NLAIC__IPointerGestion.html#a2">incRef</a>();
00123 StaticMethod[CAgentScript::TRunTellParentNotify] = <font class="keyword">new</font> CAgentScript::CMethodCall( _RUNTEL_,
00124 CAgentScript::TRunTellParentNotify, ParamRunParentNotify,
00125 CAgentScript::CheckAll,
00126 1,
00127 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(IdMsgNotifyParentClass));
00128
00129 StaticMethod[CAgentScript::TSend] = <font class="keyword">new</font> CAgentScript::CMethodCall( _SEND_,
00130 CAgentScript::TSend, SendParamMessageScript,
00131 CAgentScript::CheckAll,
00132 2,
00133 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(<font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__COperandVoid.html">NLAISCRIPT::COperandVoid</a>));
00134
00135 StaticMethod[CAgentScript::TSendComponent] = <font class="keyword">new</font> CAgentScript::CMethodCall( _SEND_,
00136 CAgentScript::TSendComponent,
00137 SendCompParamMessageScript,CAgentScript::CheckAll,
00138 3,
00139 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(<font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__COperandVoid.html">NLAISCRIPT::COperandVoid</a>));
00140
00141 StaticMethod[CAgentScript::TGetChildTag] = <font class="keyword">new</font> CAgentScript::CMethodCall( _GETCHILD_,
00142 CAgentScript::TGetChildTag,
00143 NULL,
00144 CAgentScript::CheckCount,
00145 1,
00146 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(<font class="keyword">new</font>
00147 <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a>(
00148 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(CVectorGroupManager::IdVectorGroupManager))));
00149 StaticMethod[CAgentScript::TAddChildTag] = <font class="keyword">new</font> CAgentScript::CMethodCall( _ADDCHILD_,
00150 CAgentScript::TAddChildTag,
00151 NULL,CAgentScript::CheckCount,
00152 2,
00153 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(
00154 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a>(
00155 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(DigitalType::IdDigitalType))));
00156
00157 StaticMethod[CAgentScript::TFather] = <font class="keyword">new</font> CAgentScript::CMethodCall( _FATHER_,
00158 CAgentScript::TFather,
00159 NULL,CAgentScript::CheckCount,
00160 0,
00161 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(
00162 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a>(
00163 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(CAgentScript::IdAgentScript))));
00164
00166 <font class="comment">// Temp, to be transfered in CGDAgentScript (Goal Driven Agent)</font>
00167
00168 StaticMethod[CAgentScript::TGoal] = <font class="keyword">new</font> CAgentScript::CMethodCall( _RUNACHIEVE_,
00169 CAgentScript::TGoal, ParamGoalMsg,
00170 CAgentScript::CheckAll,
00171 1,
00172 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(IdGoalMsgClass) );
00174
00175
00176
00177 StaticMethod[CAgentScript::TSelf] = <font class="keyword">new</font> CAgentScript::CMethodCall( _SELF_,
00178 CAgentScript::TSelf,
00179 NULL,CAgentScript::CheckCount,
00180 0,
00181 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>( <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a>(
00182 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(CAgentScript::IdAgentScript))));
00183
00184 StaticMethod[CAgentScript::TGetName] = <font class="keyword">new</font> CAgentScript::CMethodCall( _GETNAME_,
00185 CAgentScript::TGetName,
00186 NULL,CAgentScript::CheckCount,
00187 1,
00188 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(
00189 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a>(
00190 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(CStringType::IdStringType))));
00191
00192 StaticMethod[CAgentScript::TRemoveChild] = <font class="keyword">new</font> CAgentScript::CMethodCall( _REMOVECHILD_,
00193 CAgentScript::TRemoveChild,
00194 NULL,CAgentScript::CheckCount,
00195 0,
00196 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__CObjectUnknown.html">NLAISCRIPT::CObjectUnknown</a>(
00197 <font class="keyword">new</font> <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a>(
00198 <font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(DigitalType::IdDigitalType))));
00199
00200
00201 }
00202
<a name="l00203"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#d1">00203</a> <font class="keywordtype">void</font> CAgentScript::releaseAgentScript()<font class="keyword">
</font>00204 <font class="keyword"> </font>{
00205 SendParamMessageScript-><a class="code" href="class_NLAIC__IPointerGestion.html#a3">release</a>();
00206 <font class="comment">//IdMsgNotifyParentClass->release();
</font>00208 <font class="comment"> // Temp, to be transfered in CGDAgentScript (Goal Driven Agent)</font>
00209 <font class="comment">// IdGoalMsgClass->release();</font>
00210 <font class="comment">// IdGoalMsg->release();</font>
00211 ParamGoalMsg-><a class="code" href="class_NLAIC__IPointerGestion.html#a3">release</a>();
00213
00214 ParamRunParentNotify-><a class="code" href="class_NLAIC__IPointerGestion.html#a3">release</a>();
00215 SendCompParamMessageScript-><a class="code" href="class_NLAIC__IPointerGestion.html#a3">release</a>();
00216 sint i;
00217 <font class="keywordflow">for</font>(i = 0; i < CAgentScript::TLastM; i++)
00218 <font class="keyword">delete</font> StaticMethod[i];
00219 <font class="keyword">delete</font> StaticMethod;
00220 }
00221
00222 <font class="comment">/*CAgentScript::CMethodCall CAgentScript::StaticMethod[] =
</font>00223 <font class="comment"> {
</font>00224 <font class="comment">
</font>00225 <font class="comment">
</font>00226 <font class="comment"> CAgentScript::CMethodCall( _ADDCHILD_,
</font>00227 <font class="comment"> CAgentScript::TAddChildTag,
</font>00228 <font class="comment"> NULL,CAgentScript::CheckCount,
</font>00229 <font class="comment"> 2,
</font>00230 <font class="comment"> new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(DigitalType::IdDigitalType)))),
</font>00231 <font class="comment">
</font>00232 <font class="comment"> CAgentScript::CMethodCall( _FATHER_,
</font>00233 <font class="comment"> CAgentScript::TFather,
</font>00234 <font class="comment"> NULL,CAgentScript::CheckCount,
</font>00235 <font class="comment"> 0,
</font>00236 <font class="comment"> new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(CAgentScript::IdAgentScript)))),
</font>00237 <font class="comment">
</font>00238 <font class="comment"> CAgentScript::CMethodCall( _SELF_,
</font>00239 <font class="comment"> CAgentScript::TSelf,
</font>00240 <font class="comment"> NULL,CAgentScript::CheckCount,
</font>00241 <font class="comment"> 0,
</font>00242 <font class="comment"> new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(CAgentScript::IdAgentScript)))),
</font>00243 <font class="comment">
</font>00244 <font class="comment"> CAgentScript::CMethodCall( _GETNAME_,
</font>00245 <font class="comment"> CAgentScript::TGetName,
</font>00246 <font class="comment"> NULL,CAgentScript::CheckCount,
</font>00247 <font class="comment"> 1,
</font>00248 <font class="comment"> new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(CAgentScript::IdAgentScript)))),
</font>00249 <font class="comment">
</font>00250 <font class="comment"> CAgentScript::CMethodCall( _REMOVECHILD_,
</font>00251 <font class="comment"> CAgentScript::TRemoveChild,
</font>00252 <font class="comment"> NULL,CAgentScript::CheckCount,
</font>00253 <font class="comment"> 0,
</font>00254 <font class="comment"> new NLAISCRIPT::CObjectUnknown(new NLAISCRIPT::COperandSimple(new NLAIC::CIdentType(DigitalType::IdDigitalType))))
</font>00255 <font class="comment">
</font>00256 <font class="comment"> };*/</font>
00257
<a name="l00258"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a0">00258</a> CAgentScript::CAgentScript(<font class="keyword">const</font> CAgentScript &a): IAgentManager(a)
00259 {
00260 <font class="keywordflow">if</font> ( a._AgentClass )
00261 {
00262 _AgentClass = a._AgentClass;
00263 a._AgentClass->incRef();
00264 }
00265
00266 _NbComponents = a._NbComponents;
00267 _Components = <font class="keyword">new</font> IObjectIA *[ _NbComponents ];
00268 <font class="comment">//sint32 nb_scripted = 0;</font>
00269 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < _NbComponents; i++ )
00270 {
00271 _Components[i] = (IObjectIA *)a._Components[i]->clone();
00272
00273 <font class="keywordflow">if</font>(((<font class="keyword">const</font> <a class="code" href="class_NLAIC__CTypeOfObject.html">NLAIC::CTypeOfObject</a> &)_Components[i]->getType()) & NLAIC::CTypeOfObject::tAgentInterpret)
00274 {
00276 ((CAgentScript *)_Components[i])->setParent( (<font class="keyword">const</font> IWordNumRef *) *<font class="keyword">this</font>);
00277 <font class="comment">//( (CScriptMailBox *) ((CAgentScript *)_Components[i])->getLocalMailBox() )->setIndex(nb_scripted);</font>
00278 <font class="comment">//nb_scripted++;</font>
00279 }
00280 }
00281
00282 <font class="comment">/*if( a._ScriptMail)
</font>00283 <font class="comment"> {
</font>00284 <font class="comment"> _ScriptMail = (IMailBox *)a._ScriptMail->clone();
</font>00285 <font class="comment"> _ScriptMail->setParent( (const IWordNumRef *) *this );
</font>00286 <font class="comment"> }
</font>00287 <font class="comment"> else
</font>00288 <font class="comment"> {
</font>00289 <font class="comment"> _ScriptMail = new CScriptMailBox((const IWordNumRef *) *this);
</font>00290 <font class="comment"> }*/</font>
00291
00292 _AgentManager = a._AgentManager;
00293 <font class="comment">//if(_AgentManager) _AgentManager->incRef();</font>
00294
00295 std::vector<NLAILOGIC::IBaseOperator *>::const_iterator it_o = a._Operators.begin();
00296 <font class="keywordflow">while</font> ( it_o != a._Operators.end() )
00297 {
00298 addOperator( *it_o );
00299 it_o++;
00300 }
00301 }
00302
<a name="l00303"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a1">00303</a> CAgentScript::CAgentScript(IAgentManager *manager) : IAgentManager( NULL ), _AgentClass( NULL )
00304 {
00305 _Components = NULL;
00306 _NbComponents = 0;
00307 _AgentManager = manager;
00308 <font class="comment">//MangerIsReferenced = false;</font>
00309 <font class="comment">//_ScriptMail = new CScriptMailBox((const IWordNumRef *) *this);</font>
00310 }
00311
<a name="l00312"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a2">00312</a> CAgentScript::CAgentScript(IAgentManager *manager, IBasicAgent *father,<font class="comment">//The agent's father </font>
00313 std::list<IObjectIA *> &components, <font class="comment">//Static components </font>
00314 <a class="code" href="class_NLAISCRIPT__CAgentClass.html">NLAISCRIPT::CAgentClass</a> *agent_class ) <font class="comment">//Class</font>
00315
00316 : IAgentManager(father), _AgentClass( agent_class )<font class="keyword">
</font>00317 <font class="keyword"> </font>{
00318 <font class="keywordflow">if</font> ( _AgentClass )
00319 _AgentClass->incRef();
00320
00321 <font class="comment">// Creates the static components array</font>
00322 _NbComponents = components.size();
00323 _Components = <font class="keyword">new</font> IObjectIA *[ _NbComponents ];
00324 std::list<IObjectIA *>::iterator it_c = components.begin();
00325 <font class="keywordtype">int</font> id_c = 0;
00326 <font class="comment">//sint32 nb_scripted = 0;</font>
00327 _AgentManager = manager;
00328 <font class="keywordflow">while</font> ( it_c != components.end() )
00329 {
00330 IObjectIA *o = (IObjectIA *)*it_c;
00331 _Components[id_c] = o;
00332
00333 <font class="keywordflow">if</font>(((<font class="keyword">const</font> <a class="code" href="class_NLAIC__CTypeOfObject.html">NLAIC::CTypeOfObject</a> &)o->getType()) & NLAIC::CTypeOfObject::tAgentInterpret)
00334 {
00335 ((CAgentScript *)o)->setParent( (<font class="keyword">const</font> IWordNumRef *) *<font class="keyword">this</font>);
00336 <font class="comment">//( (CScriptMailBox *) ((CAgentScript *)_Components[id_c])->getLocalMailBox() )->setIndex( nb_scripted );</font>
00337 <font class="comment">//nb_scripted++;</font>
00338 }
00339
00340 it_c++;
00341 id_c++;
00342 }
00343 <font class="comment">//_ScriptMail = new CScriptMailBox( (const IWordNumRef *) *this);</font>
00344
00345 }
00346
<a name="l00347"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a3">00347</a> CAgentScript::~CAgentScript()<font class="keyword">
</font>00348 <font class="keyword"> </font>{
00349 <font class="keywordflow">if</font> ( _AgentClass )
00350 _AgentClass->release();
00351
00352 <font class="comment">// destruction of static components</font>
00353 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < _NbComponents; i++ )
00354 _Components[i]->release();
00355 <font class="keyword">delete</font>[] _Components;
00356
00357 <font class="comment">//if(_AgentManager != NULL) _AgentManager->release();</font>
00358
00359 <font class="comment">//if ( _ScriptMail != NULL ) _ScriptMail->release();</font>
00360 }
00361
<a name="l00362"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a17">00362</a> <font class="keywordtype">void</font> CAgentScript::setAgentManager(IAgentManager *manager)<font class="keyword">
</font>00363 <font class="keyword"> </font>{
00364 <font class="comment">//if(_AgentManager != NULL) _AgentManager->release();</font>
00365 _AgentManager = manager;
00366 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < _NbComponents; i++ )
00367 {
00368 <font class="keywordflow">if</font>(((<font class="keyword">const</font> <a class="code" href="class_NLAIC__CTypeOfObject.html">NLAIC::CTypeOfObject</a> &)_Components[i]->getType()) & NLAIC::CTypeOfObject::tAgentInterpret)
00369 {
00370 <font class="comment">//_AgentManager->incRef();</font>
00371 ((CAgentScript *)_Components[i])->setAgentManager(_AgentManager);
00372 }
00373 }
00374
00375 }
00376
<a name="l00377"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a16">00377</a> sint32 CAgentScript::getChildMessageIndex(<font class="keyword">const</font> IMessageBase *msg, sint32 child_index )<font class="keyword">
</font>00378 <font class="keyword"> </font>{
00379 <font class="keywordflow">return</font> _AgentClass->getChildMessageIndex( msg, child_index );
00380 }
00381
<a name="l00382"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a34">00382</a> <font class="keywordtype">void</font> CAgentScript::setStaticMember(sint32 index,IObjectIA *op)<font class="keyword">
</font>00383 <font class="keyword"> </font>{
00384 <font class="preprocessor">#ifdef NL_DEBUG
</font>00385 <font class="preprocessor"></font> <font class="keywordflow">if</font> ( index >= _NbComponents )
00386 {
00387 <font class="keywordflow">throw</font> NLAIE::CExceptionIndexError();
00388 }
00389 <font class="preprocessor">#endif
</font>00390 <font class="preprocessor"></font> _Components[ index ]->release();
00391 _Components[ index ] = op;
00392
00393
00394 <font class="keywordflow">if</font>(((<font class="keyword">const</font> <a class="code" href="class_NLAIC__CTypeOfObject.html">NLAIC::CTypeOfObject</a> &) op->getType()) & NLAIC::CTypeOfObject::tAgentInterpret)
00395 {
00396 ((CAgentScript *)op)->setParent( (<font class="keyword">const</font> IWordNumRef *) *<font class="keyword">this</font>);
00397 <font class="comment">//( (CScriptMailBox *) ((CAgentScript *)op)->getLocalMailBox() )->setIndex( index );</font>
00398 }
00399 }
00400
<a name="l00401"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a31">00401</a> sint32 CAgentScript::getStaticMemberSize()<font class="keyword"> const
</font>00402 <font class="keyword"> </font>{
00403 <font class="keywordflow">return</font> _AgentClass->getStaticMemberSize();
00404 }
00405
00406
<a name="l00407"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a33">00407</a> <font class="keyword">const</font> IObjectIA *CAgentScript::getStaticMember(sint32 index)<font class="keyword"> const
</font>00408 <font class="keyword"> </font>{
00409 <font class="preprocessor">#ifdef NL_DEBUG
</font>00410 <font class="preprocessor"></font> <font class="keywordflow">if</font> ( index >= _NbComponents )
00411 {
00412 <font class="keywordflow">throw</font> NLAIE::CExceptionIndexError();
00413 }
00414 <font class="preprocessor">#endif
</font>00415 <font class="preprocessor"></font> <font class="keywordflow">return</font> _Components[ index ];
00416 }
00417
<a name="l00418"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a12">00418</a> <a class="code" href="class_NLAISCRIPT__IOpCode.html">NLAISCRIPT::IOpCode</a> *CAgentScript::getMethode(sint32 inheritance,sint32 index)<font class="keyword">
</font>00419 <font class="keyword"> </font>{
00420 <font class="preprocessor">#ifdef NL_DEBUG
</font>00421 <font class="preprocessor"></font> <font class="keywordflow">if</font> ( index >= _AgentClass->getMethodIndexSize())
00422 {
00423 <font class="keywordflow">throw</font> NLAIE::CExceptionIndexError();
00424 }
00425
00426 <font class="keywordflow">if</font> ( inheritance >= _AgentClass->sizeVTable())
00427 {
00428 <font class="keywordflow">throw</font> NLAIE::CExceptionIndexError();
00429 }
00430 <font class="preprocessor">#endif
</font>00431 <font class="preprocessor"></font> <font class="keywordflow">return</font> (<a class="code" href="class_NLAISCRIPT__IOpCode.html">NLAISCRIPT::IOpCode</a> *)_AgentClass->getBrancheCode(inheritance,index).getCode();
00432 }
00433
<a name="l00434"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a13">00434</a> <a class="code" href="class_NLAISCRIPT__IOpCode.html">NLAISCRIPT::IOpCode</a> *CAgentScript::getMethode(sint32 index)<font class="keyword">
</font>00435 <font class="keyword"> </font>{
00436 <font class="preprocessor">#ifdef NL_DEBUG
</font>00437 <font class="preprocessor"></font> <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_class_name = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) getType();
00438 <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_base_class_name = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) _AgentClass->getType();
00439
00440 <font class="keywordflow">if</font> ( index >= _AgentClass->getMethodIndexSize())
00441 {
00442 <font class="keywordflow">throw</font> NLAIE::CExceptionIndexError();
00443 }
00444 <font class="preprocessor">#endif
</font>00445 <font class="preprocessor"></font> <font class="keywordflow">return</font> (<a class="code" href="class_NLAISCRIPT__IOpCode.html">NLAISCRIPT::IOpCode</a> *)_AgentClass->getBrancheCode(index).getCode();
00446 }
00447
<a name="l00448"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a45">00448</a> <font class="keywordtype">void</font> CAgentScript::save(<a class="code" href="class_NLMISC__IStream.html">NLMISC::IStream</a> &os)<font class="keyword">
</font>00449 <font class="keyword"> </font>{
00450 IBasicAgent::save(os);
00451 sint32 size = _NbComponents;
00452 os.<a class="code" href="class_NLMISC__IStream.html#a3">serial</a>( size );
00453 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < _NbComponents; i++ )
00454 {
00455 os.<a class="code" href="class_NLMISC__IStream.html#a3">serial</a>( (<a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a> &) _Components[i]->getType() );
00456 _Components[i]->save(os);
00457 }
00458 }
00459
<a name="l00460"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a44">00460</a> <font class="keywordtype">void</font> CAgentScript::load(<a class="code" href="class_NLMISC__IStream.html">NLMISC::IStream</a> &is)<font class="keyword">
</font>00461 <font class="keyword"> </font>{
00462 IBasicAgent::load(is);
00463
00464 <font class="comment">// Loads static components</font>
00465 sint32 size;
00466 is.<a class="code" href="class_NLMISC__IStream.html#a3">serial</a>( size );
00467 _NbComponents = size;
00468
00469 <font class="keywordflow">if</font>(_Components)
00470 {
00471 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < _NbComponents; i++ )
00472 _Components[i]->release();
00473 <font class="keyword">delete</font>[] _Components;
00474 }
00475 _Components = <font class="keyword">new</font> IObjectIA *[ _NbComponents ];
00476
00477 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < _NbComponents; i++ )
00478 {
00479 <a class="code" href="class_NLAIC__CIdentTypeAlloc.html">NLAIC::CIdentTypeAlloc</a> id;
00480 is.<a class="code" href="class_NLMISC__IStream.html#a3">serial</a>( id );
00481 IObjectIA *tmp_c = (IObjectIA *)id.<a class="code" href="class_NLAIC__CIdentTypeAlloc.html#a3">allocClass</a>();
00482 tmp_c->load(is);
00483 _Components[i] = tmp_c;
00484 }
00485 }
00486
<a name="l00487"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a38">00487</a> sint32 CAgentScript::getMethodIndexSize()<font class="keyword"> const
</font>00488 <font class="keyword"> </font>{
00489 <font class="keywordflow">return</font> _AgentClass->getMethodIndexSize();
00490 }
00491
<a name="l00492"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a46">00492</a> <font class="keyword">const</font> <a class="code" href="class_NLAIC__IBasicType.html">NLAIC::IBasicType</a> *CAgentScript::clone()<font class="keyword"> const
</font>00493 <font class="keyword"> </font>{
00494 CAgentScript *result = <font class="keyword">new</font> CAgentScript(*<font class="keyword">this</font>);
00495 <font class="keywordflow">return</font> result;
00496 }
00497
<a name="l00498"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a47">00498</a> <font class="keyword">const</font> <a class="code" href="class_NLAIC__IBasicType.html">NLAIC::IBasicType</a> *CAgentScript::newInstance()<font class="keyword"> const
</font>00499 <font class="keyword"> </font>{
00500 CAgentScript *instance;
00501 <font class="keywordflow">if</font> ( _AgentClass )
00502 {
00503 instance = (CAgentScript *) _AgentClass->buildNewInstance();
00504 }
00505 <font class="keywordflow">else</font>
00506 {
00507 instance = <font class="keyword">new</font> CAgentScript(NULL);
00508 }
00509 <font class="keywordflow">return</font> instance;
00510 }
00511
<a name="l00512"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a48">00512</a> <font class="keywordtype">void</font> CAgentScript::getDebugString(<font class="keywordtype">char</font> *t)<font class="keyword"> const
</font>00513 <font class="keyword"> </font>{
00514 sprintf(t,<font class="stringliteral">"class type <%s> "</font>,(<font class="keyword">const</font> <font class="keywordtype">char</font> *)getType());
00515 <font class="keywordflow">if</font> ( _AgentClass )
00516 sprintf(&t[strlen(t)],<font class="stringliteral">"<%s> (scripted) -StaticComponents:\n"</font>,(<font class="keyword">const</font> <font class="keywordtype">char</font> *)_AgentClass->getType());
00517 <font class="keywordflow">else</font>
00518 sprintf(&t[strlen(t)],<font class="stringliteral">"<undefined_class> (scripted) -StaticComponents:\n"</font>);
00519
00520 <font class="keywordtype">char</font> buf[1024*8];
00521 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0; i < _NbComponents; i++ )
00522 {
00523 strcat(t, <font class="stringliteral">"\t\t"</font>);
00524 <font class="keywordflow">if</font> ( _AgentClass->getComponentName(i) )
00525 {
00526 strcat(t, _AgentClass->getComponentName(i) );
00527 }
00528 <font class="keywordflow">else</font>
00529 strcat(t, <font class="stringliteral">"<unnamed>"</font>);
00530
00531 strcat(t, <font class="stringliteral">"\t\t"</font>);
00532 _Components[i]->getDebugString(buf);
00533 strcat(t, <font class="stringliteral">"[ "</font>);
00534 strcat(t, buf);
00535 strcat(t, <font class="stringliteral">" ]"</font>);
00536 <font class="keywordflow">if</font>(i != (_NbComponents-1)) strcat(t, <font class="stringliteral">"\n"</font>);
00537 }
00538 }
00539
<a name="l00540"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a25">00540</a> <font class="keywordtype">bool</font> CAgentScript::isEqual(<font class="keyword">const</font> IBasicObjectIA &a)<font class="keyword"> const
</font>00541 <font class="keyword"> </font>{
00542 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00543 }
00544
<a name="l00545"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a21">00545</a> <font class="keywordtype">void</font> CAgentScript::onKill(IConnectIA *a)<font class="keyword">
</font>00546 <font class="keyword"> </font>{
00547 <font class="comment">//eraseFromList<IBasicAgent *>(&_AgentList,(IBasicAgent *)a); </font>
00548 IAgent::onKill(a);
00549 }
00550
<a name="l00551"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a7">00551</a> IObjectIA::CProcessResult CAgentScript::getDynamicAgent(IBaseGroupType *g)<font class="keyword">
</font>00552 <font class="keyword"> </font>{
00553 CStringType *s = (CStringType *)g->get();
00554 <font class="comment">//tsetDefNameAgent::iterator i = _DynamicAgentName.find(*s);</font>
00555 IObjectIA::CProcessResult r;
00556 r.ResultState = IObjectIA::ProcessIdle;
00557
00558 std::pair<tsetDefNameAgent::iterator,tsetDefNameAgent::iterator> p = _DynamicAgentName.equal_range(CKeyAgent(*s));
00559 <font class="keywordflow">if</font>(p.first != p.second)
00560 {
00561 sint size = _DynamicAgentName.count(CKeyAgent(*s));
00562 sint n = 0;
00563 CVectorGroupManager *x;
00564 <font class="keywordflow">while</font>(p.first != p.second)
00565 {
00566 x = <font class="keyword">new</font> CVectorGroupManager(size);
00567 x->set(n++, *p.first->Itr);
00568 p.first++;
00569 }
00570
00571 r.Result = x;
00572 r.Result->incRef();
00573 <font class="keywordflow">return</font> r;
00574
00575 }
00576 r.Result = &DigitalType::NullOperator;
00577 r.Result->incRef();
00578 <font class="keywordflow">return</font> r;
00579 }
00580
<a name="l00581"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a10">00581</a> IObjectIA::CProcessResult CAgentScript::runAskParentNotify(IBaseGroupType *g)<font class="keyword">
</font>00582 <font class="keyword"> </font>{
00583 CNotifyParentScript *m = <font class="keyword">new</font> CNotifyParentScript((IBasicAgent *)getParent());
00584 m->setPerformatif(IMessageBase::PTell);
00585 this->incRef();
00586 m->setSender(<font class="keyword">this</font>);
00587 IObjectIA::CProcessResult r;
00588 r.Result = m;
00589 <font class="keywordflow">return</font> r;
00590 }
00591
<a name="l00592"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a11">00592</a> IObjectIA::CProcessResult CAgentScript::runTellParentNotify(IBaseGroupType *g)<font class="keyword">
</font>00593 <font class="keyword"> </font>{
00594 sint i;
00595
00596 CNotifyParentScript *m = <font class="keyword">new</font> CNotifyParentScript(<font class="keyword">this</font>);
00597 m->setPerformatif(IMessageBase::PTell);
00598 this->incRef();
00599 m->setSender(<font class="keyword">this</font>);
00600
00601 <font class="keywordflow">for</font>(i = 0; i < _NbComponents; i++)
00602 {
00603 <font class="keywordflow">if</font>(_Components[i] != NULL)
00604 {
00605 CNotifyParentScript *msg = (CNotifyParentScript *)m->clone();
00606 <font class="keywordflow">try</font>
00607 {
00608 _Components[i]->sendMessage(msg);
00609 }
00610 <font class="keywordflow">catch</font>(<a class="code" href="class_NLAIE__IException.html">NLAIE::IException</a> &)
00611 {
00612 msg->release();
00613 }
00614 }
00615 }
00616 IObjectIA::CProcessResult r;
00617 r.Result = m;
00618 <font class="keywordflow">return</font> r;
00619 }
00620
<a name="l00621"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a6">00621</a> IObjectIA::CProcessResult CAgentScript::addDynamicAgent(IBaseGroupType *g)<font class="keyword">
</font>00622 <font class="keyword"> </font>{
00623 CIteratorContener i = g->getIterator();
00624 CStringType &s = (CStringType &)*i++;
00625 IBasicAgent *o = (IBasicAgent *)i++;
00626
00627 IObjectIA::CProcessResult r;
00628 r.ResultState = IObjectIA::ProcessIdle;
00629
00630 o->setParent( (<font class="keyword">const</font> IWordNumRef *) *<font class="keyword">this</font> );
00631 CNotifyParentScript *m = <font class="keyword">new</font> CNotifyParentScript(<font class="keyword">this</font>);
00632 this->incRef();
00633 m->setSender(<font class="keyword">this</font>);
00634 m->setPerformatif(IMessageBase::PTell);
00635 ((IObjectIA *)o)->sendMessage(m);
00636
00637 _DynamicAgentName.insert(CKeyAgent(s,addChild(o)));
00638
00639 r.Result = NULL;
00640
00641 <font class="keywordflow">return</font> r;
00642 }
00643
<a name="l00644"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a8">00644</a> IObjectIA::CProcessResult CAgentScript::getDynamicName(<a class="code" href="class_NLAIAGENT__IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *g)<font class="keyword">
</font>00645 <font class="keyword"> </font>{
00646 <font class="preprocessor">#ifdef NL_DEBUG
</font>00647 <font class="preprocessor"></font> <font class="keywordtype">char</font> txt[1024*8];
00648 g-><a class="code" href="class_NLAIC__IBasicType.html#a5">getDebugString</a>(txt);
00649 <font class="preprocessor">#endif
</font>00650 <font class="preprocessor"></font>
00651 IObjectIA::CProcessResult r;
00652 <font class="keyword">const</font> IObjectIA *o = ((CLocalAgentMail *)g-><a class="code" href="class_NLAIAGENT__IBaseGroupType.html#a23">get</a>())->getHost();
00653 tsetDefNameAgent::iterator i = _DynamicAgentName.begin();
00654
00655 <font class="keywordflow">while</font>(i != _DynamicAgentName.end())
00656 {
00657 CKeyAgent key = *i;
00658 <font class="keywordflow">if</font>( o == *key.Itr )
00659 {
00660 CStringType *s = <font class="keyword">new</font> CStringType(key.Name);
00661 r.Result = s;
00662 <font class="keywordflow">return</font> r;
00663 }
00664 i ++;
00665 }
00666 r.Result = <font class="keyword">new</font> CStringType(CStringVarName(<font class="stringliteral">"Unknown"</font>));
00667 <font class="keywordflow">return</font> r;
00668 }
<a name="l00669"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a9">00669</a> IObjectIA::CProcessResult CAgentScript::removeDynamic(<a class="code" href="class_NLAIAGENT__IBaseGroupType.html">NLAIAGENT::IBaseGroupType</a> *g)<font class="keyword">
</font>00670 <font class="keyword"> </font>{
00671 CStringType *s = (CStringType *)g-><a class="code" href="class_NLAIAGENT__IBaseGroupType.html#a23">get</a>();
00672 tsetDefNameAgent::iterator i = _DynamicAgentName.find(CKeyAgent(*s));
00673 IObjectIA::CProcessResult r;
00674 r.ResultState = IObjectIA::ProcessIdle;
00675
00676 <font class="keywordflow">if</font>(i != _DynamicAgentName.end())
00677 {
00678 <font class="comment">//removeChild((*i).second);</font>
00679 <font class="comment">//r.Result = new DigitalType(1.0);</font>
00680 <font class="comment">//return r;</font>
00681 <font class="keywordflow">throw</font>;
00682 }
00683 r.Result = &DigitalType::NullOperator;
00684 r.Result->incRef();
00685 <font class="keywordflow">return</font> r;
00686 }
00687
<a name="l00688"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a27">00688</a> IObjectIA::CProcessResult CAgentScript::sendMethod(IObjectIA *param)<font class="keyword">
</font>00689 <font class="keyword"> </font>{
00690 INombreDefine *p = (INombreDefine *)((IBaseGroupType *)param)->popFront();
00691 IMessageBase *msg = (IMessageBase *)((IBaseGroupType *)param)->popFront();
00692 msg->setPerformatif((IMessageBase::TPerformatif)(sint)p->getNumber());
00693 p->release();
00694 <font class="keywordflow">return</font> sendMessage(msg);
00695 }
00696
<a name="l00697"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a28">00697</a> IObjectIA::CProcessResult CAgentScript::sendMethodCompoment(IObjectIA *param)<font class="keyword">
</font>00698 <font class="keyword"> </font>{
00699 IMessageBase *msg = (IMessageBase *)((IBaseGroupType *)param)->pop();
00700 <font class="keywordflow">return</font> sendMessage(msg);
00701 }
00702
<a name="l00703"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a42">00703</a> IObjectIA::CProcessResult CAgentScript::sendMessage(<font class="keyword">const</font> IVarName &compName,IObjectIA *msg)<font class="keyword">
</font>00704 <font class="keyword"> </font>{
00705 IObjectIA *comp = (IObjectIA *)getStaticMember(getStaticMemberIndex(compName));
00706 <font class="keywordflow">if</font>(comp != NULL)
00707 {
00708 comp->sendMessage(msg);
00709 }
00710 <font class="keywordflow">return</font> IObjectIA::CProcessResult();
00711 }
00712
<a name="l00713"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a41">00713</a> IObjectIA::CProcessResult CAgentScript::sendMessage(IObjectIA *m)<font class="keyword">
</font>00714 <font class="keyword"> </font>{
00715 <font class="preprocessor">#ifdef NL_DEBUG
</font>00716 <font class="preprocessor"></font> <font class="keyword">const</font> <font class="keywordtype">char</font> *txt = (<font class="keyword">const</font> <font class="keywordtype">char</font> *)m->getType();
00717 <font class="preprocessor">#endif
</font>00718 <font class="preprocessor"></font> IMessageBase *msg = (IMessageBase *)m;
00719 this->incRef();
00720 msg->setReceiver(<font class="keyword">this</font>);
00721 <font class="comment">//if(msg->getMethodIndex() < 0)</font>
00722 {
00723 <font class="comment">/* _ScriptMail->addMessage(msg);
</font>00724 <font class="comment"> }
</font>00725 <font class="comment"> else
</font>00726 <font class="comment"> {*/</font>
00727 <font class="keywordflow">if</font>( ((<font class="keyword">const</font> <a class="code" href="class_NLAIC__CTypeOfObject.html">NLAIC::CTypeOfObject</a> &)m->getType()) & NLAIC::CTypeOfObject::tAgentInterpret)
00728 {
00729 <font class="keywordtype">char</font> runMsg[1024];
00730 strcpy(runMsg,_RUN_);
00731 <font class="keywordflow">switch</font>(msg->getPerformatif())
00732 {
00733 <font class="keywordflow">case</font> IMessageBase::PExec:
00734 strcat(runMsg,<font class="stringliteral">"Exec"</font>);
00735 <font class="keywordflow">break</font>;
00736 <font class="keywordflow">case</font> IMessageBase::PAchieve:
00737 strcat(runMsg,<font class="stringliteral">"Achieve"</font>);
00738 <font class="keywordflow">break</font>;
00739 <font class="keywordflow">case</font> IMessageBase::PAsk:
00740 strcat(runMsg,<font class="stringliteral">"Ask"</font>);
00741 <font class="keywordflow">break</font>;
00742 <font class="keywordflow">case</font> IMessageBase::PTell:
00743 strcat(runMsg,<font class="stringliteral">"Tell"</font>);
00744 <font class="keywordflow">break</font>;
00745 <font class="keywordflow">case</font> IMessageBase::PBreak:
00746 strcat(runMsg,<font class="stringliteral">"Break"</font>);
00747 <font class="keywordflow">break</font>;
00748 <font class="keywordflow">case</font> IMessageBase::PKill:
00749 strcat(runMsg,<font class="stringliteral">"Kill"</font>);
00750 <font class="keywordflow">break</font>;
00751 <font class="keywordflow">case</font> IMessageBase::PError:
00752 strcat(runMsg,<font class="stringliteral">"Error"</font>);
00753 <font class="keywordflow">break</font>;
00754 }
00755
00756 <a class="code" href="class_NLAISCRIPT__COperandSimple.html">NLAISCRIPT::COperandSimple</a> *t = <font class="keyword">new</font> NLAISCRIPT::COperandSimple(<font class="keyword">new</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a>(m->getType()));
00757 <a class="code" href="class_NLAISCRIPT__CParam.html">NLAISCRIPT::CParam</a> p(1,t);
00758
00759 CStringVarName tmp_name = CStringVarName(runMsg);
00760 tQueue r = isMember(NULL,&tmp_name,p);
00761 <font class="keywordflow">if</font>(r.size())
00762 {
00763 <a class="code" href="class_NLAIAGENT__CIdMethod.html">NLAIAGENT::CIdMethod</a> m = r.top();
00764 msg->setMethodIndex(0,m.Index);
00765 <font class="comment">//_ScriptMail->addMessage(msg);</font>
00766 }
00767 <font class="comment">//else return IAgent::sendMessage(msg);</font>
00768 }
00769 <font class="comment">//else return IAgent::sendMessage(msg); </font>
00770 }
00771 <font class="keywordflow">return</font> IAgent::sendMessage(msg);
00772 <font class="comment">//return IObjectIA::CProcessResult();</font>
00773 }
00774
<a name="l00775"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a20">00775</a> <font class="keywordtype">void</font> CAgentScript::runChildren()<font class="keyword">
</font>00776 <font class="keyword"> </font>{
00777 <font class="preprocessor">#ifdef NL_DEBUG
</font>00778 <font class="preprocessor"></font> <font class="keyword">const</font> <font class="keywordtype">char</font> *classBase = (<font class="keyword">const</font> <font class="keywordtype">char</font> *)getType();
00779 <font class="preprocessor">#endif
</font>00780 <font class="preprocessor"></font> <font class="comment">// Activation des agents de la partie statique</font>
00781 <font class="keywordflow">for</font> ( <font class="keywordtype">int</font> i = 0; i < _NbComponents; i++ )
00782 {
00783 IObjectIA *o = _Components[i];
00784 o->run();
00785 }
00786
00787 <font class="comment">// Activation des fils</font>
00788 IAgent::runChildren();
00789 }
00790
<a name="l00791"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a23">00791</a> <font class="keywordtype">void</font> CAgentScript::processMessages(IMessageBase *msg,IObjectIA *c)<font class="keyword">
</font>00792 <font class="keyword"> </font>{
00793 <font class="preprocessor">#ifdef NL_DEBUG
</font>00794 <font class="preprocessor"></font> <font class="keyword">const</font> <font class="keywordtype">char</font> *txt = (<font class="keyword">const</font> <font class="keywordtype">char</font> *)msg->getType();
00795 <font class="preprocessor">#endif
</font>00796 <font class="preprocessor"></font> <a class="code" href="class_NLAISCRIPT__CCodeContext.html">NLAISCRIPT::CCodeContext</a> &context = (<a class="code" href="class_NLAISCRIPT__CCodeContext.html">NLAISCRIPT::CCodeContext</a> &)*c;
00797 IBaseGroupType *param = <font class="keyword">new</font> CGroupType();
00798 msg->incRef();
00799 param->push(msg);
00800 context.Stack ++;
00801 context.Stack[(<font class="keywordtype">int</font>)context.Stack] = param;
00802
00803 <font class="keywordtype">int</font> indexM = msg->getMethodIndex() - getBaseMethodCount();
00804 <font class="keywordflow">if</font>(indexM >= 0)
00805 {
00806 IObjectIA *code = getMethode(indexM);
00807 <font class="keywordflow">if</font>(code == NULL)
00808 {
00809 getMail()->popMessage();
00810 <font class="keywordflow">return</font>;
00811 }
00812 }
00813
00814 <a class="code" href="class_NLAISCRIPT__IMethodContext.html">NLAISCRIPT::IMethodContext</a> *methodContex;
00815
00816 <font class="keywordflow">if</font> (context.ContextDebug.Active)
00817 {
00818 context.ContextDebug.Param.push_back(&listBidon);
00819 listBidon.incRef();
00820 methodContex = <font class="keyword">new</font> NLAISCRIPT::CMethodContextDebug();
00821 }
00822 <font class="keywordflow">else</font>
00823 {
00824 methodContex = <font class="keyword">new</font> NLAISCRIPT::CMethodContext();
00825 }
00826 <font class="keyword">const</font> IObjectIA *self = context.Self;
00827 context.Self = <font class="keyword">this</font>;
00828 <a class="code" href="class_NLAISCRIPT__CCallMethod.html">NLAISCRIPT::CCallMethod</a> opCall(methodContex,msg->getHeritanceIndex(),msg->getMethodIndex());
00829 opCall.<a class="code" href="class_NLAISCRIPT__CCallMethod.html#a2">runOpCode</a>(context);
00830 context.Self = self;
00831 IMessageBase *returnMsg = (IMessageBase *)context.Stack[(<font class="keywordtype">int</font>)context.Stack];
00832 returnMsg->incRef();
00833 context.Stack--;
00834 <font class="keywordflow">switch</font>(msg->getPerformatif())
00835 {
00836 <font class="keywordflow">case</font> IMessageBase::PExec:
00837 <font class="keywordflow">if</font>(msg->getContinuation() != NULL)
00838 {
00839 IMessageBase *o = (IMessageBase *)returnMsg->clone();
00840 o->setMethodIndex(-1,-1);
00841 this->incRef();
00842 o->setSender(<font class="keyword">this</font>);
00843 ((IObjectIA *)msg->getContinuation())->incRef();
00844 o->setReceiver((IObjectIA *)msg->getContinuation());
00845 ((IObjectIA *)msg->getContinuation())->sendMessage(o);
00846 }
00847 <font class="keywordflow">break</font>;
00848 <font class="keywordflow">case</font> IMessageBase::PAchieve:
00849 <font class="keywordflow">if</font>(msg->getContinuation() != NULL)
00850 {
00851 IMessageBase *o = (IMessageBase *)returnMsg->clone();
00852 o->setMethodIndex(-1,-1);
00853 this->incRef();
00854 o->setSender(<font class="keyword">this</font>);
00855 ((IObjectIA *)msg->getContinuation())->incRef();
00856 o->setReceiver((IObjectIA *)msg->getContinuation());
00857 ((IObjectIA *)msg->getContinuation())->sendMessage(o);
00858 }
00859 <font class="keywordflow">break</font>;
00860 <font class="keywordflow">case</font> IMessageBase::PAsk:
00861 {
00862 IMessageBase *o = (IMessageBase *)returnMsg->clone();
00863 o->setMethodIndex(-1,-1);
00864 this->incRef();
00865 o->setSender(<font class="keyword">this</font>);
00866 o->setPerformatif(IMessageBase::PTell);
00867 <font class="keywordflow">if</font>(returnMsg->getSender() != NULL) ((IObjectIA *)returnMsg->getSender())->incRef();
00868 o->setReceiver((IObjectIA *)returnMsg->getSender());
00869 ((IObjectIA *)msg->getSender())->sendMessage(o);
00870
00871
00872 <font class="keywordflow">if</font>(msg->getContinuation() != NULL)
00873 {
00874 IMessageBase *o = (IMessageBase *)returnMsg->clone();
00875 o->setMethodIndex(-1,-1);
00876 this->incRef();
00877 o->setSender(<font class="keyword">this</font>);
00878 <font class="keywordflow">if</font>(msg->getContinuation() != NULL) ((IObjectIA *)msg->getContinuation())->incRef();
00879 o->setReceiver((IObjectIA *)msg->getContinuation());
00880 o->setPerformatif(IMessageBase::PTell);
00881 ((IObjectIA *)msg->getContinuation())->sendMessage(o);
00882 }
00883 }
00884 <font class="keywordflow">break</font>;
00885 <font class="keywordflow">case</font> IMessageBase::PTell:
00886 <font class="keywordflow">if</font>(msg->getContinuation() != NULL)
00887 {
00888 IMessageBase *o = (IMessageBase *)returnMsg->clone();
00889 o->setMethodIndex(-1,-1);
00890 this->incRef();
00891 o->setSender(<font class="keyword">this</font>);
00892 <font class="keywordflow">if</font>(msg->getContinuation() != NULL) ((IObjectIA *)msg->getContinuation())->incRef();
00893 o->setReceiver((IObjectIA *)msg->getContinuation());
00894 ((IObjectIA *)msg->getContinuation())->sendMessage(o);
00895 }
00896 <font class="keywordflow">break</font>;
00897 <font class="keywordflow">case</font> IMessageBase::PBreak:
00898 <font class="keywordflow">if</font>(msg->getContinuation() != NULL)
00899 {
00900 IMessageBase *o = (IMessageBase *)returnMsg->clone();
00901 o->setMethodIndex(-1,-1);
00902 this->incRef();
00903 o->setSender(<font class="keyword">this</font>);
00904 <font class="keywordflow">if</font>(msg->getContinuation() != NULL) ((IObjectIA *)msg->getContinuation())->incRef();
00905 o->setReceiver((IObjectIA *)msg->getContinuation());
00906 ((IObjectIA *)msg->getContinuation())->sendMessage(o);
00907 }
00908 <font class="keywordflow">break</font>;
00909 <font class="keywordflow">case</font> IMessageBase::PKill:
00910 <font class="keywordflow">if</font>(msg->getContinuation() != NULL)
00911 {
00912 IMessageBase *o = (IMessageBase *)returnMsg->clone();
00913 o->setMethodIndex(-1,-1);
00914 this->incRef();
00915 o->setSender(<font class="keyword">this</font>);
00916 <font class="keywordflow">if</font>(msg->getContinuation() != NULL) ((IObjectIA *)msg->getContinuation())->incRef();
00917 o->setReceiver((IObjectIA *)msg->getContinuation());
00918 ((IObjectIA *)msg->getContinuation())->sendMessage(o);
00919 }
00920 <font class="keywordflow">break</font>;
00921
00922 }
00923 returnMsg->release();
00924 }
00925
<a name="l00926"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a22">00926</a> <font class="keywordtype">void</font> CAgentScript::processMessages()<font class="keyword">
</font>00927 <font class="keyword"> </font>{
00928 IObjectIA *c;
00929 <font class="keywordflow">if</font>( _AgentManager != NULL) c = (IObjectIA *)_AgentManager->getAgentContext();
00930 <font class="keywordflow">else</font> c = NULL;
00931 <font class="keywordflow">while</font>(getMail()->getMessageCount())
00932 {
00933 IMessageBase &msg = (IMessageBase &)getMail()->getMessage();
00934 <font class="keywordflow">if</font>(msg.getMethodIndex() >= 0)
00935 {
00936 processMessages(&msg,c);
00937 getMail()->popMessage();
00938 }
00939 <font class="keywordflow">else</font>
00940 {
00941 IAgent::processMessages();
00942 }
00943 }
00944 }
00945
<a name="l00946"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a24">00946</a> IObjectIA::CProcessResult CAgentScript::runActivity()<font class="keyword">
</font>00947 <font class="keyword"> </font>{
00948
00949 <a class="code" href="class_NLAISCRIPT__CCodeContext.html">NLAISCRIPT::CCodeContext</a> *context = (<a class="code" href="class_NLAISCRIPT__CCodeContext.html">NLAISCRIPT::CCodeContext</a> *)_AgentManager->getAgentContext();
00950 context->Self = <font class="keyword">this</font>;
00951 runMethodeMember(_AgentClass->getRunMethod(), context);
00952
00953 <font class="keywordflow">return</font> ProcessRun;
00954 }
00955
<a name="l00956"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a26">00956</a> <font class="keywordtype">bool</font> CAgentScript::haveActivity()<font class="keyword"> const
</font>00957 <font class="keyword"> </font>{
00958 <font class="keywordflow">return</font> (_AgentClass->getRunMethod() >= 0);
00959 }
00960
<a name="l00961"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a43">00961</a> <font class="keyword">const</font> IObjectIA::CProcessResult &CAgentScript::run()<font class="keyword">
</font>00962 <font class="keyword"> </font>{
00963 setState(processBuzzy,NULL);
00964
00965 <font class="preprocessor">#ifdef NL_DEBUG
</font>00966 <font class="preprocessor"></font> <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_class_name = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) getType();
00967 <font class="comment">//const NLAIAGENT::IRefrence *dbg_mail_parent = _ScriptMail->getParent();</font>
00968 <font class="preprocessor">#endif
</font>00969 <font class="preprocessor"></font>
00970 <font class="comment">//_ScriptMail->run();</font>
00971 getMail()->run();
00972 runChildren();
00973
00974 processMessages();
00975
00976 <font class="keywordflow">if</font>(haveActivity()) runActivity();
00977
00978 setState(processIdle,NULL);
00979 <font class="keywordflow">return</font> getState();
00980 }
00981
<a name="l00982"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a4">00982</a> <font class="keywordtype">void</font> CAgentScript::addOperator(<a class="code" href="class_NLAILOGIC__IBaseOperator.html">NLAILOGIC::IBaseOperator</a> *op)<font class="keyword">
</font>00983 <font class="keyword"> </font>{
00984 _Operators.push_back(op);
00985 }
00986
<a name="l00987"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a5">00987</a> <font class="keywordtype">void</font> CAgentScript::remOperator(<a class="code" href="class_NLAILOGIC__IBaseOperator.html">NLAILOGIC::IBaseOperator</a> *op)<font class="keyword">
</font>00988 <font class="keyword"> </font>{
00989 std::vector<NLAILOGIC::IBaseOperator *>::iterator it_o = _Operators.begin();
00990 <font class="keywordflow">while</font> ( it_o != _Operators.end() )
00991 {
00992 <font class="keywordflow">if</font> ( op == *it_o )
00993 {
00994 _Operators.erase( it_o );
00995 <font class="keywordflow">return</font>;
00996 }
00997 it_o++;
00998 }
00999 <font class="keywordtype">char</font> buf[2048];
01000 op-><a class="code" href="class_NLAIC__IBasicType.html#a5">getDebugString</a>(buf);
01001 <font class="keywordflow">throw</font> NLAIE::CExceptionObjectNotFoundError(buf);
01002 }
01003
<a name="l01004"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a49">01004</a> <font class="keyword">const</font> <a class="code" href="class_NLAIC__CIdentType.html">NLAIC::CIdentType</a> &CAgentScript::getType()<font class="keyword"> const
</font>01005 <font class="keyword"> </font>{
01006 <font class="keywordflow">if</font> ( _AgentClass )
01007 <font class="keywordflow">return</font> _AgentClass->getType();
01008 <font class="keywordflow">else</font>
01009 <font class="keywordflow">return</font> IdAgentScript;
01010 }
01011
<a name="l01012"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a29">01012</a> IObjectIA::CProcessResult CAgentScript::runMethodBase(<font class="keywordtype">int</font> heritance, <font class="keywordtype">int</font> index,IObjectIA *o)<font class="keyword">
</font>01013 <font class="keyword"> </font>{
01014 <font class="keywordflow">switch</font>(index - IAgent::getMethodIndexSize())
01015 {
01016 <font class="keywordflow">case</font> TSend:
01017 {
01018 <font class="keywordflow">return</font> sendMethod(o);
01019 }
01020
01021 <font class="keywordflow">case</font> TSendComponent:
01022 {
01023 <font class="keywordflow">return</font> sendMethodCompoment(o);
01024 }
01025
01026 <font class="keywordflow">case</font> TGetChildTag:
01027 {
01028 <font class="keywordflow">return</font> getDynamicAgent((IBaseGroupType *)o);
01029 }
01030
01031 <font class="keywordflow">case</font> TAddChildTag:
01032 {
01033 <font class="keywordflow">return</font> addDynamicAgent((IBaseGroupType *)o);
01034 }
01035 <font class="keywordflow">case</font> TFather:
01036 {
01037 IObjectIA::CProcessResult a;
01038 a.Result = (IObjectIA *)getParent();
01039 a.Result->incRef();
01040 <font class="keywordflow">return</font> a;
01041 }
01042
01043 <font class="keywordflow">case</font> TSelf:
01044 {
01045 IObjectIA::CProcessResult a;
01046 a.Result = <font class="keyword">new</font> CLocalAgentMail(<font class="keyword">this</font>);
01047 <font class="keywordflow">return</font> a;
01048 }
01049 <font class="keywordflow">case</font> TGetName:
01050 {
01051 <font class="keywordflow">return</font> getDynamicName((IBaseGroupType *)o);
01052 }
01053
01054 <font class="keywordflow">case</font> TRemoveChild:
01055 {
01056 <font class="keywordflow">return</font> removeDynamic((IBaseGroupType *)o);
01057 }
01058
01059 <font class="keywordflow">case</font> TRunAskParentNotify:
01060 {
01061 <font class="keywordflow">return</font> runAskParentNotify((IBaseGroupType *)o);
01062 }
01063
01064 <font class="keywordflow">case</font> TRunTellParentNotify:
01065 {
01066 <font class="keywordflow">return</font> runTellParentNotify((IBaseGroupType *)o);
01067 }
01069 <font class="comment">// Temp, to be transfered in CGDAgentScript (Goal Driven Agent)</font>
01070
01071 <font class="keywordflow">case</font> TGoal:
01072 {
01073 <font class="keywordflow">return</font> runGoalMsg((IBaseGroupType *)o);
01074 }
01076
01077
01078 <font class="keywordflow">default</font>:
01079 <font class="keywordflow">return</font> IAgent::runMethodeMember(index,o);
01080
01081 }
01082
01083 }
01084
<a name="l01085"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a30">01085</a> IObjectIA::CProcessResult CAgentScript::runMethodBase(<font class="keywordtype">int</font> index,IObjectIA *o)<font class="keyword">
</font>01086 <font class="keyword"> </font>{
01087 <font class="keywordflow">switch</font>(index - IAgent::getMethodIndexSize())
01088 {
01089 <font class="keywordflow">case</font> TSend:
01090 {
01091 <font class="keywordflow">return</font> sendMethod(o);
01092 }
01093
01094 <font class="keywordflow">case</font> TSendComponent:
01095 {
01096 <font class="keywordflow">return</font> sendMethodCompoment(o);
01097 }
01098
01099 <font class="keywordflow">case</font> TGetChildTag:
01100 {
01101 <font class="keywordflow">return</font> getDynamicAgent((IBaseGroupType *)o);
01102 }
01103
01104 <font class="keywordflow">case</font> TAddChildTag:
01105 {
01106 <font class="keywordflow">return</font> addDynamicAgent((IBaseGroupType *)o);
01107 }
01108 <font class="keywordflow">case</font> TFather:
01109 {
01110 IObjectIA::CProcessResult a;
01111 a.Result = (IObjectIA *)getParent();
01112 a.Result->incRef();
01113 <font class="keywordflow">return</font> a;
01114 }
01115
01116 <font class="keywordflow">case</font> TSelf:
01117 {
01118 IObjectIA::CProcessResult a;
01119 a.Result = <font class="keyword">new</font> CLocalAgentMail(<font class="keyword">this</font>);
01120 <font class="keywordflow">return</font> a;
01121 }
01122 <font class="keywordflow">case</font> TGetName:
01123 {
01124 <font class="keywordflow">return</font> getDynamicName((IBaseGroupType *)o);
01125 }
01126
01127 <font class="keywordflow">case</font> TRunAskParentNotify:
01128 {
01129 <font class="keywordflow">return</font> runAskParentNotify((IBaseGroupType *)o);
01130 }
01131
01132 <font class="keywordflow">case</font> TRunTellParentNotify:
01133 {
01134 <font class="keywordflow">return</font> runTellParentNotify((IBaseGroupType *)o);
01135 }
01136
01138 <font class="comment">// Temp, to be transfered in CGDAgentScript (Goal Driven Agent)</font>
01139
01140 <font class="keywordflow">case</font> TGoal:
01141 {
01142 <font class="keywordflow">return</font> runGoalMsg((IBaseGroupType *)o);
01143 }
01145
01146 <font class="keywordflow">default</font>:
01147 <font class="keywordflow">return</font> IAgent::runMethodeMember(index,o);
01148 }
01149 }
01150
<a name="l01151"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a18">01151</a> <font class="keywordtype">int</font> CAgentScript::getBaseMethodCount()<font class="keyword"> const
</font>01152 <font class="keyword"> </font>{
01153 <font class="keywordflow">return</font> IAgentManager::getBaseMethodCount() + CAgentScript::TLastM;
01154 }
01155
<a name="l01156"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a39">01156</a> IObjectIA::CProcessResult CAgentScript::runMethodeMember(sint32 inheritance, sint32 index, IObjectIA *c)<font class="keyword">
</font>01157 <font class="keyword"> </font>{
01158
01159 <font class="keywordflow">if</font>(c->getType() != NLAISCRIPT::CCodeContext::IdCodeContext)
01160 {
01161 <font class="keywordflow">return</font> IAgent::runMethodeMember(inheritance,index, c);
01162 }
01163
01164 <a class="code" href="class_NLAISCRIPT__IOpCode.html">NLAISCRIPT::IOpCode</a> *opPtr = NULL;
01165 <a class="code" href="class_NLAISCRIPT__CCodeContext.html">NLAISCRIPT::CCodeContext</a> &context = (<a class="code" href="class_NLAISCRIPT__CCodeContext.html">NLAISCRIPT::CCodeContext</a> &)*c;
01166
01167 <font class="keywordtype">int</font> i = index - getBaseMethodCount();
01168 <font class="keywordflow">if</font>(i < 0)
01169 {
01170 <font class="keywordflow">if</font> (context.ContextDebug.Active)
01171 {
01172 context.ContextDebug.Param.push_back(&listBidon);
01173 listBidon.incRef();
01174 }
01175
01176 IObjectIA::CProcessResult r = runMethodBase(index,(IObjectIA *)context.Param.back());
01177 <font class="keywordflow">if</font>(r.Result != NULL)
01178 {
01179 context.Stack++;
01180 context.Stack[(<font class="keywordtype">int</font>)context.Stack] = r.Result;
01181 }
01182 r.Result = NULL;
01183 <font class="keywordflow">return</font> r;
01184 }
01185 <font class="keywordflow">else</font>
01186 {
01187 opPtr = getMethode(inheritance,i);
01188 }
01189
01190 IObjectIA::CProcessResult r;
01191 <font class="keywordflow">if</font>(opPtr != NULL)
01192 {
01193 <a class="code" href="class_NLAISCRIPT__IOpCode.html">NLAISCRIPT::IOpCode</a> &op = *opPtr;
01194 <a class="code" href="class_NLAISCRIPT__CCodeBrancheRun.html">NLAISCRIPT::CCodeBrancheRun</a> *opTmp = context.Code;
01195 <font class="keywordtype">int</font> ip = (uint32)*context.Code;
01196 context.Code = (<a class="code" href="class_NLAISCRIPT__CCodeBrancheRun.html">NLAISCRIPT::CCodeBrancheRun</a> *)&op;
01197 *context.Code = 0;
01198
01199 <font class="comment">/*TProcessStatement k = IObjectIA::ProcessIdle;
</font>01200 <font class="comment">
</font>01201 <font class="comment"> while(k != IObjectIA::ProcessEnd)
</font>01202 <font class="comment"> {
</font>01203 <font class="comment"> k = op.run(context);
</font>01204 <font class="comment"> }*/</font>
01205
01206 r = ((<a class="code" href="class_NLAISCRIPT__ICodeBranche.html">NLAISCRIPT::ICodeBranche</a> *)opPtr)->run(context);
01207 <font class="comment">// If we are in Debug Mode</font>
01208 <font class="keywordflow">if</font> (context.ContextDebug.Active)
01209 {
01210 context.ContextDebug.callStackPop();
01211 }
01212 *context.Code = ip;
01213 context.Code = opTmp;
01214 }
01215 <font class="keywordflow">return</font> r;
01216 }
01217
<a name="l01218"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a40">01218</a> IObjectIA::CProcessResult CAgentScript::runMethodeMember(sint32 index, IObjectIA *c)<font class="keyword">
</font>01219 <font class="keyword"> </font>{
01220 <font class="keywordflow">if</font>(c->getType() != NLAISCRIPT::CCodeContext::IdCodeContext)
01221 {
01222 <font class="keywordflow">return</font> IAgent::runMethodeMember(index, c);
01223 }
01224
01225 <a class="code" href="class_NLAISCRIPT__IOpCode.html">NLAISCRIPT::IOpCode</a> *opPtr = NULL;
01226 <a class="code" href="class_NLAISCRIPT__CCodeContext.html">NLAISCRIPT::CCodeContext</a> &context = (<a class="code" href="class_NLAISCRIPT__CCodeContext.html">NLAISCRIPT::CCodeContext</a> &)*c;
01227
01228 <font class="keywordtype">int</font> i = index - getBaseMethodCount();
01229 <font class="keywordflow">if</font>(i < 0)
01230 {
01231 <font class="keywordflow">if</font> (context.ContextDebug.Active)
01232 {
01233 context.ContextDebug.Param.push_back(&listBidon);
01234 listBidon.incRef();
01235 }
01236
01237 IObjectIA::CProcessResult r = runMethodBase(index,(IObjectIA *)context.Param.back());
01238 <font class="keywordflow">if</font>(r.Result != NULL)
01239 {
01240 context.Stack++;
01241 context.Stack[(<font class="keywordtype">int</font>)context.Stack] = r.Result;
01242 }
01243 r.Result = NULL;
01244 <font class="keywordflow">return</font> r;
01245 }
01246 <font class="keywordflow">else</font>
01247 {
01248 opPtr = getMethode(i);
01249 }
01250 IObjectIA::CProcessResult r;
01251 <font class="keywordflow">if</font>(opPtr != NULL)
01252 {
01253 <a class="code" href="class_NLAISCRIPT__IOpCode.html">NLAISCRIPT::IOpCode</a> &op = *opPtr;<font class="comment">//getMethode(inheritance,i);</font>
01254 <a class="code" href="class_NLAISCRIPT__CCodeBrancheRun.html">NLAISCRIPT::CCodeBrancheRun</a> *opTmp = context.Code;
01255 <font class="keywordtype">int</font> ip = (uint32)*context.Code;
01256 context.Code = (<a class="code" href="class_NLAISCRIPT__CCodeBrancheRun.html">NLAISCRIPT::CCodeBrancheRun</a> *)opPtr;
01257 *context.Code = 0;
01258
01259 <font class="comment">/*TProcessStatement k = IObjectIA::ProcessIdle;
</font>01260 <font class="comment">
</font>01261 <font class="comment"> while(k != IObjectIA::ProcessEnd)
</font>01262 <font class="comment"> {
</font>01263 <font class="comment"> k = op.run(context);
</font>01264 <font class="comment"> }*/</font>
01265 r = ((<a class="code" href="class_NLAISCRIPT__ICodeBranche.html">NLAISCRIPT::ICodeBranche</a> *)opPtr)->run(context);
01266
01267 <font class="comment">// If we are in Debug Mode</font>
01268 <font class="keywordflow">if</font> (context.ContextDebug.Active)
01269 {
01270 context.ContextDebug.callStackPop();
01271 }
01272
01273 *context.Code = ip;
01274 context.Code = opTmp;
01275 }
01276 <font class="keywordflow">return</font> r;
01277 }
01278
<a name="l01279"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a35">01279</a> tQueue CAgentScript::getPrivateMember(<font class="keyword">const</font> IVarName *className,<font class="keyword">const</font> IVarName *methodName,<font class="keyword">const</font> IObjectIA &param)<font class="keyword"> const
</font>01280 <font class="keyword"> </font>{
01281 sint i;
01282 CAgentScript::TMethodNumDef index = CAgentScript::TLastM;
01283 <font class="keywordflow">for</font>(i = 0; i < CAgentScript::TLastM; i ++)
01284 {
01285 <font class="keywordflow">if</font>(CAgentScript::StaticMethod[i]->MethodName == *methodName)
01286 {
01287 index = (CAgentScript::TMethodNumDef)CAgentScript::StaticMethod[i]->Index;
01288 <font class="keywordflow">switch</font>(CAgentScript::StaticMethod[i]->CheckArgType)
01289 {
01290 <font class="keywordflow">case</font> CAgentScript::CheckAll:
01291 {
01292 <font class="keywordtype">double</font> d = ((<a class="code" href="class_NLAISCRIPT__CParam.html">NLAISCRIPT::CParam</a> &)*CAgentScript::StaticMethod[i]->ArgType).eval((<a class="code" href="class_NLAISCRIPT__CParam.html">NLAISCRIPT::CParam</a> &)param);
01293 <font class="keywordflow">if</font>(d >= 0.0)
01294 {
01295 tQueue r;
01296 CAgentScript::StaticMethod[i]->ReturnValue->incRef();
01297 r.push(CIdMethod( (IAgent::getMethodIndexSize() + CAgentScript::StaticMethod[i]->Index),
01298 0.0,
01299 NULL,
01300 CAgentScript::StaticMethod[i]->ReturnValue));
01301 <font class="keywordflow">return</font> r;
01302 }
01303 }
01304 index = CAgentScript::TLastM;
01305 <font class="keywordflow">break</font>;
01306
01307
01308 <font class="keywordflow">case</font> CAgentScript::CheckCount:
01309 {
01310 <font class="keywordflow">if</font>(((<a class="code" href="class_NLAISCRIPT__CParam.html">NLAISCRIPT::CParam</a> &)param).size() == CAgentScript::StaticMethod[i]->ArgCount)
01311 {
01312 tQueue r;
01313 CAgentScript::StaticMethod[i]->ReturnValue->incRef();
01314 r.push(CIdMethod( (IAgent::getMethodIndexSize() + CAgentScript::StaticMethod[i]->Index),
01315 0.0,
01316 NULL,
01317 CAgentScript::StaticMethod[i]->ReturnValue ));
01318 <font class="keywordflow">return</font> r;
01319 }
01320 }
01321 index = CAgentScript::TLastM;
01322 <font class="keywordflow">break</font>;
01323
01324 <font class="keywordflow">case</font> CAgentScript::DoNotCheck:
01325 {
01326 tQueue r;
01327 CAgentScript::StaticMethod[i]->ReturnValue->incRef();
01328 r.push(CIdMethod( (IAgent::getMethodIndexSize() + CAgentScript::StaticMethod[i]->Index),
01329 0.0,
01330 NULL,
01331 CAgentScript::StaticMethod[i]->ReturnValue));
01332 <font class="keywordflow">return</font> r;
01333 }
01334 index = CAgentScript::TLastM;
01335 <font class="keywordflow">break</font>;
01336 }
01337 }
01338 }
01339 <font class="keywordflow">return</font> tQueue();
01340 }
01341
<a name="l01342"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a36">01342</a> tQueue CAgentScript::isMember(<font class="keyword">const</font> IVarName *className,<font class="keyword">const</font> IVarName *methodName,<font class="keyword">const</font> IObjectIA &param)<font class="keyword"> const
</font>01343 <font class="keyword"> </font>{
01344 <font class="preprocessor">#ifdef NL_DEBUG
</font>01345 <font class="preprocessor"></font> <font class="keywordtype">char</font> nameM[1024*4];
01346 <font class="keywordtype">char</font> nameP[1024*4];
01347 <font class="keywordtype">char</font> name[1024*8];
01348 methodName->getDebugString(nameM);
01349 param.getDebugString(nameP);
01350 sprintf(name,<font class="stringliteral">"%s%s"</font>,nameM,nameP);
01351
01352 <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_class_name = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) getType();
01353 <font class="keyword">const</font> <font class="keywordtype">char</font> *dbg_base_class_name = NULL;
01354 <font class="keywordflow">if</font>(_AgentClass) dbg_base_class_name = (<font class="keyword">const</font> <font class="keywordtype">char</font> *) _AgentClass->getType();
01355 <font class="preprocessor">#endif
</font>01356 <font class="preprocessor"></font>
01357
01358 <font class="keywordflow">if</font>(className == NULL)
01359 {
01360
01361 tQueue r;
01362 <font class="keywordflow">if</font>(_AgentClass != NULL) r = _AgentClass->getPrivateMember(className,methodName,param);
01363
01364 <font class="keywordflow">if</font>(r.size()) <font class="keywordflow">return</font> r;
01365 <font class="keywordflow">else</font>
01366 {
01367 r = getPrivateMember(className,methodName,param);
01368 <font class="keywordflow">if</font>(r.size()) <font class="keywordflow">return</font> r;
01369 <font class="keywordflow">else</font>
01370 {
01371 <font class="keywordflow">return</font> IAgent::isMember(className,methodName,param);
01372 }
01373 }
01374
01375 }
01376 <font class="keywordflow">else</font>
01377 <font class="keywordflow">if</font>(*className == CStringVarName(<font class="stringliteral">"Agent"</font>))
01378 {
01379 tQueue r;
01380 r = getPrivateMember(className,methodName,param);
01381 <font class="keywordflow">if</font>(r.size()) <font class="keywordflow">return</font> r;
01382 <font class="keywordflow">else</font>
01383 {
01384 r = _AgentClass->getPrivateMember(className,methodName,param);
01385
01386 <font class="keywordflow">if</font>(r.size()) <font class="keywordflow">return</font> r;
01387 <font class="keywordflow">else</font>
01388 {
01389 <font class="keywordflow">return</font> IAgent::isMember(className,methodName,param);
01390 }
01391
01392 }
01393
01394 }
01395 <font class="keywordflow">return</font> tQueue();
01396 }
01397
<a name="l01398"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a37">01398</a> sint32 CAgentScript::isClassInheritedFrom(<font class="keyword">const</font> IVarName &name)<font class="keyword"> const
</font>01399 <font class="keyword"> </font>{
01400 <font class="keywordflow">return</font> _AgentClass->isClassInheritedFrom( name );
01401 }
01402
<a name="l01403"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a32">01403</a> sint32 CAgentScript::getStaticMemberIndex(<font class="keyword">const</font> IVarName &name)<font class="keyword"> const
</font>01404 <font class="keyword"> </font>{
01405 <font class="keywordflow">return</font> _AgentClass->getInheritedStaticMemberIndex(name);
01406 }
01407
01409 <font class="comment">// Temp, to be transfered in CGDAgentScript (Goal Driven Agent)</font>
01410
<a name="l01411"></a><a class="code" href="class_NLAIAGENT__CAgentScript.html#a51">01411</a> IObjectIA::CProcessResult CAgentScript::runGoalMsg(IBaseGroupType *g)<font class="keyword">
</font>01412 <font class="keyword"> </font>{
01413 <a class="code" href="class_NLAILOGIC__CGoal.html">NLAILOGIC::CGoal</a> *goal = (<a class="code" href="class_NLAILOGIC__CGoal.html">NLAILOGIC::CGoal</a> *) g-><a class="code" href="class_NLAIAGENT__IBaseGroupType.html#a23">get</a>();
01414 <font class="preprocessor">#ifdef NL_DEBUG
</font>01415 <font class="preprocessor"></font> <font class="keywordtype">char</font> buffer[1024 * 2];
01416 goal-><a class="code" href="class_NLAILOGIC__CGoal.html#a15">getDebugString</a>( buffer );
01417 <font class="preprocessor">#endif
</font>01418 <font class="preprocessor"></font> _GoalStack.push_back( goal );
01419
01420 IObjectIA::CProcessResult r;
01421 r.Result = NULL;
01422 <font class="keywordflow">return</font> r;
01423 }
01425 }
</div></pre>
<!-- 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>
|