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
|
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>nevrax.org : docs</TITLE>
<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=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="/inc/img/black_banner.jpg"><A HREF=""><IMG SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>
<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
<TR>
<TD WIDTH=16><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
<TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!------ Begin Box ------>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
<TABLE cellspacing=0 cellpadding=1 border=0>
<tr><td ALIGN=middle><a class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
<tr><td ALIGN=middle><a class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
</TABLE>
</TD></TR></TABLE></TD></TR></TABLE>
<!------ End Box ------>
</TD>
<TD WIDTH=15><IMG SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
<TD ALIGN=left valign=top><IMG SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
<!-- title -->
<TABLE background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
<!-- block -->
<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
<TD><B>Documentation</B></TD>
<TD ALIGN=RIGHT> </td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>mot.h</h1><a href="mot_8h.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 <font class="preprocessor">#ifndef NL_MOT_H</font>
00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_MOT_H</font>
00028 <font class="preprocessor"></font>
00029
00030 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="smart__ptr_8h.html">nel/misc/smart_ptr.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="bit__set_8h.html">nel/misc/bit_set.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="class__id_8h.html">nel/misc/class_id.h</a>"</font>
00034 <font class="preprocessor">#include <vector></font>
00035 <font class="preprocessor">#include <set></font>
00036 <font class="preprocessor">#include <map></font>
00037
00038
00039
00040 <font class="keyword">namespace </font>NLMISC
00041 {
00042 <font class="keyword">class </font>IStream;
00043 }
00044
00045
00046 <font class="keyword">namespace </font>NL3D
00047 {
00048
00049
00050 <font class="keyword">class </font>IModel;
00051 <font class="keyword">class </font>IObs;
00052 <font class="keyword">class </font>ITrav;
00053
00054
00055 <font class="comment">// ***************************************************************************</font>
<a name="l00070"></a><a class="code" href="classNL3D_1_1CMOT.html">00070</a> <font class="comment"></font><font class="keyword">class </font>CMOT
00071 {
00072 <font class="keyword">public</font>:
00073 <font class="comment">// Ctor.</font>
00074 <a class="code" href="classNL3D_1_1CMOT.html#a0">CMOT</a>();
00075 <font class="comment">// Dtor.</font>
00076 <font class="keyword">virtual</font> <a class="code" href="classNL3D_1_1CMOT.html#a1">~CMOT</a>();
00077
00079
00080
00087 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CMOT.html#z589_0">registerModel</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idModel, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idModelBase, <a class="code" href="classNL3D_1_1CMOT.html#l0">IModel</a>* (*creator)());
00095 <font class="keyword">static</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CMOT.html#z589_1">registerObs</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idTrav, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idModel, IObs* (*creator)());
00097
00098
00099 <font class="keyword">public</font>:
00101
00102
00109 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CMOT.html#z590_0">addTrav</a>(ITrav *<a class="code" href="driver__opengl__extension__def_8h.html#a246">v</a>);
<a name="l00111"></a><a class="code" href="classNL3D_1_1CMOT.html#z590_1">00111</a> <a class="code" href="types__nl_8h.html#a14">uint</a> <a class="code" href="classNL3D_1_1CMOT.html#z590_1">getNumTrav</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CMOT.html#o0">Traversals</a>.size(); }
<a name="l00113"></a><a class="code" href="classNL3D_1_1CMOT.html#z590_2">00113</a> ITrav *<a class="code" href="classNL3D_1_1CMOT.html#z590_2">getTrav</a>(<a class="code" href="types__nl_8h.html#a14">uint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a>)<font class="keyword"> const </font>
00114 <font class="keyword"> </font>{
00115 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a> < <a class="code" href="classNL3D_1_1CMOT.html#o0">Traversals</a>.size());
00116 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CMOT.html#o0">Traversals</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a236">index</a>].Trav;
00117 }
00123 ITrav *<a class="code" href="classNL3D_1_1CMOT.html#z590_2">getTrav</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idTrav) <font class="keyword">const</font>;
00125
00126
00127 <font class="keyword">public</font>:
00129
00130
00147 <a class="code" href="classNL3D_1_1CMOT.html#l0">IModel</a> *<a class="code" href="classNL3D_1_1CMOT.html#z591_0">createModel</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idModel);
00148
00155 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CMOT.html#z591_1">deleteModel</a>(<a class="code" href="classNL3D_1_1CMOT.html#l0">IModel</a> *model);
00156
00160 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CMOT.html#z591_2">validateModels</a>();
00161
00163
00164
00168 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CMOT.html#a2">release</a>();
00169
00170
00171 <font class="comment">// ******************</font>
00172 <font class="keyword">private</font>:
<a name="l00173"></a><a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html">00173</a> <font class="keyword">struct </font>CModelEntry
00174 {
<a name="l00175"></a><a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html#m0">00175</a> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> <a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html#m0">ModelId</a>, <a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html#m1">BaseModelId</a>;
00176 IModel* (*Creator)();
<a name="l00177"></a><a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html#a0">00177</a> <font class="keywordtype">bool</font> <a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html#a0">operator<</a>(<font class="keyword">const</font> CModelEntry& o)<font class="keyword"> const </font>{<font class="keywordflow">return</font> ModelId<o.ModelId;}
<a name="l00178"></a><a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html#a1">00178</a> <font class="keywordtype">bool</font> <a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html#a1">operator==</a>(<font class="keyword">const</font> CModelEntry& o)<font class="keyword"> const </font>{<font class="keywordflow">return</font> ModelId==o.ModelId;}
<a name="l00179"></a><a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html#a2">00179</a> <font class="keywordtype">bool</font> <a class="code" href="structNL3D_1_1CMOT_1_1CModelEntry.html#a2">operator!=</a>(<font class="keyword">const</font> CModelEntry& o)<font class="keyword"> const </font>{<font class="keywordflow">return</font> !(*<font class="keyword">this</font>==o);}
00180 };
00181
<a name="l00182"></a><a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html">00182</a> <font class="keyword">struct </font>CObsEntry
00183 {
<a name="l00184"></a><a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html#m0">00184</a> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> <a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html#m0">TravId</a>, <a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html#m1">ModelId</a>;
00185 IObs* (*Creator)();
<a name="l00186"></a><a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html#a0">00186</a> <font class="keywordtype">bool</font> <a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html#a0">operator<</a>(<font class="keyword">const</font> CObsEntry& o)<font class="keyword"> const </font>
00187 <font class="keyword"> </font>{
00188 <font class="keywordflow">if</font>(TravId!=o.TravId)
00189 <font class="keywordflow">return</font> TravId<o.TravId;
00190 <font class="keywordflow">else</font>
00191 <font class="keywordflow">return</font> ModelId<o.ModelId;
00192 }
<a name="l00193"></a><a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html#a1">00193</a> <font class="keywordtype">bool</font> <a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html#a1">operator==</a>(<font class="keyword">const</font> CObsEntry& o)<font class="keyword"> const </font>
00194 <font class="keyword"> </font>{
00195 <font class="keywordflow">return</font> ModelId==o.ModelId && TravId==o.TravId;
00196 }
<a name="l00197"></a><a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html#a2">00197</a> <font class="keywordtype">bool</font> <a class="code" href="structNL3D_1_1CMOT_1_1CObsEntry.html#a2">operator!=</a>(<font class="keyword">const</font> CObsEntry& o)<font class="keyword"> const </font>{<font class="keywordflow">return</font> !(*<font class="keyword">this</font>==o);}
00198 };
00199
<a name="l00200"></a><a class="code" href="structNL3D_1_1CMOT_1_1CTravEntry.html">00200</a> <font class="keyword">struct </font>CTravEntry
00201 {
<a name="l00202"></a><a class="code" href="structNL3D_1_1CMOT_1_1CTravEntry.html#m0">00202</a> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> <a class="code" href="structNL3D_1_1CMOT_1_1CTravEntry.html#m0">TravId</a>;
<a name="l00203"></a><a class="code" href="structNL3D_1_1CMOT_1_1CTravEntry.html#m1">00203</a> ITrav *<a class="code" href="structNL3D_1_1CMOT_1_1CTravEntry.html#m1">Trav</a>;
00204 };
00205
00206 <font class="keyword">private</font>:
00207 <font class="comment">// must do this for _ValidateModelList access.</font>
<a name="l00208"></a><a class="code" href="classNL3D_1_1CMOT.html#l0">00208</a> <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classNL3D_1_1CMOT.html#l0">IModel</a>;
00209
<a name="l00210"></a><a class="code" href="classNL3D_1_1CMOT.html#o0">00210</a> std::vector<CTravEntry> <a class="code" href="classNL3D_1_1CMOT.html#o0">Traversals</a>;
<a name="l00211"></a><a class="code" href="classNL3D_1_1CMOT.html#o1">00211</a> std::set<IModel*> <a class="code" href="classNL3D_1_1CMOT.html#o1">Models</a>;
<a name="l00212"></a><a class="code" href="classNL3D_1_1CMOT.html#o2">00212</a> <a class="code" href="classNL3D_1_1CMOT.html#l0">IModel</a> *<a class="code" href="classNL3D_1_1CMOT.html#o2">_ValidateModelList</a>;
00213
00214 <font class="keyword">static</font> std::set<CModelEntry> <a class="code" href="classNL3D_1_1CMOT.html#r0">RegModels</a>;
00215 <font class="keyword">static</font> std::set<CObsEntry> <a class="code" href="classNL3D_1_1CMOT.html#r1">RegObservers</a>;
00216
00217 <font class="keyword">private</font>:
00218 <font class="comment">// Create an observer, obeying the hierachy/observer system explained in createModel().</font>
00219 IObs *<a class="code" href="classNL3D_1_1CMOT.html#c0">createObs</a>(<font class="keyword">const</font> ITrav *trav, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idModel) <font class="keyword">const</font>;
00220
00221 <font class="keyword">protected</font>:
00222 <font class="comment">// For hertied class, to access observer result of a model.</font>
00223 IObs *<a class="code" href="classNL3D_1_1CMOT.html#b0">getModelObs</a>(<a class="code" href="classNL3D_1_1CMOT.html#l0">IModel</a> *m, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idTrav) <font class="keyword">const</font>;
00224
00225
00226 <font class="keyword">private</font>:
00227 <font class="comment">// a dummy method, usefull for dynamic_cast only.</font>
<a name="l00228"></a><a class="code" href="classNL3D_1_1CMOT.html#c1">00228</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CMOT.html#c1">dummyForDynamicCast</a>() {}
00229
00230 };
00231
00232
00233 <font class="comment">// ***************************************************************************</font>
<a name="l00258"></a><a class="code" href="classNL3D_1_1IModel.html">00258</a> <font class="comment"></font><font class="keyword">class </font>IModel : <font class="keyword">public</font> NLMISC::CRefCount
00259 {
00260 <font class="keyword">protected</font>:
00269 <a class="code" href="classNL3D_1_1IModel.html#b0">IModel</a>();
00270
<a name="l00281"></a><a class="code" href="classNL3D_1_1IModel.html#b1">00281</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IModel.html#b1">initModel</a>()
00282 {
00283 }
00284
00291 <font class="keyword">virtual</font> <a class="code" href="classNL3D_1_1IModel.html#b2">~IModel</a>();
00292
00293 <font class="keyword">public</font>:
00294
00296
00297
<a name="l00301"></a><a class="code" href="classNL3D_1_1IModel.html#z592_0">00301</a> <font class="keyword">enum</font> <a class="code" href="classNL3D_1_1IModel.html#z592_0">TDirty</a>
00302 {
00303 <a class="code" href="classNL3D_1_1IModel.html#z592_0s0">Dirty</a>=0, <font class="comment">// First bit, to say that the Model is dirty.</font>
00304 <a class="code" href="classNL3D_1_1IModel.html#z592_0s1">Last</a>
00305 };
<a name="l00307"></a><a class="code" href="classNL3D_1_1IModel.html#z592_3">00307</a> <a class="code" href="classNLMISC_1_1CBitSet.html">NLMISC::CBitSet</a> <a class="code" href="classNL3D_1_1IModel.html#z592_3">TouchObs</a>;
<a name="l00309"></a><a class="code" href="classNL3D_1_1IModel.html#z592_1">00309</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IModel.html#z592_1">foul</a>(<a class="code" href="types__nl_8h.html#a14">uint</a> flag) { TouchObs.<a class="code" href="classNLMISC_1_1CBitSet.html#z265_4">set</a>(<a class="code" href="classNL3D_1_1IModel.html#z592_0s0">Dirty</a>); TouchObs.<a class="code" href="classNLMISC_1_1CBitSet.html#z265_4">set</a>(flag); }
00310
00312 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IModel.html#z592_2">validate</a>();
00313
00315
00316
00317 <font class="keyword">protected</font>:
00318 <font class="comment">// Observers created and linked by CMOT::createModel()</font>
<a name="l00319"></a><a class="code" href="classNL3D_1_1IModel.html#l0">00319</a> <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classNL3D_1_1IModel.html#l0">CMOT</a>;
<a name="l00320"></a><a class="code" href="classNL3D_1_1IModel.html#l1">00320</a> <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classNL3D_1_1IModel.html#l1">IObs</a>;
<a name="l00321"></a><a class="code" href="classNL3D_1_1IModel.html#l2">00321</a> <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classNL3D_1_1IModel.html#l2">ITrav</a>;
<a name="l00322"></a><a class="code" href="classNL3D_1_1IModel.html#t0">00322</a> <font class="keyword">typedef</font> std::map<NLMISC::CClassId, IObs*> <a class="code" href="classNL3D_1_1IModel.html#t0">CObsMap</a>;
<a name="l00323"></a><a class="code" href="classNL3D_1_1IModel.html#n0">00323</a> <a class="code" href="classNL3D_1_1IModel.html#t0">CObsMap</a> <a class="code" href="classNL3D_1_1IModel.html#n0">Observers</a>;
00324
00325 <font class="comment">// Cache the last observer acceded through getObs().</font>
<a name="l00326"></a><a class="code" href="classNL3D_1_1IModel.html#n1">00326</a> <font class="keyword">mutable</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> <a class="code" href="classNL3D_1_1IModel.html#n1">LastClassId</a>;
<a name="l00327"></a><a class="code" href="classNL3D_1_1IModel.html#n2">00327</a> <font class="keyword">mutable</font> <a class="code" href="classNL3D_1_1IModel.html#l1">IObs</a> *<a class="code" href="classNL3D_1_1IModel.html#n2">LastObs</a>;
00329 <a class="code" href="classNL3D_1_1IModel.html#l1">IObs</a> *<a class="code" href="classNL3D_1_1IModel.html#b3">getObs</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idTrav) <font class="keyword">const</font>;
00330
00331
00332 <font class="comment">// A link to the CMOT which created us, filled in createModel().</font>
<a name="l00333"></a><a class="code" href="classNL3D_1_1IModel.html#n3">00333</a> <a class="code" href="classNL3D_1_1IModel.html#l0">CMOT</a> *<a class="code" href="classNL3D_1_1IModel.html#n3">_OwnerMot</a>;
00334
00335 <font class="comment">// linked list of models to validate.</font>
<a name="l00336"></a><a class="code" href="classNL3D_1_1IModel.html#n4">00336</a> <a class="code" href="classNL3D_1_1IModel.html#b0">IModel</a> *<a class="code" href="classNL3D_1_1IModel.html#n4">_PrecModelToValidate</a>;
<a name="l00337"></a><a class="code" href="classNL3D_1_1IModel.html#n5">00337</a> <a class="code" href="classNL3D_1_1IModel.html#b0">IModel</a> *<a class="code" href="classNL3D_1_1IModel.html#n5">_NextModelToValidate</a>;
00338
00339
00340 <font class="keyword">protected</font>:
00341
00342
00344
00345
<a name="l00357"></a><a class="code" href="classNL3D_1_1IModel.html#z593_0">00357</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IModel.html#z593_0">update</a>()
00358 {
00359 }
00360
<a name="l00373"></a><a class="code" href="classNL3D_1_1IModel.html#z593_1">00373</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IModel.html#z593_1">cleanTouch</a>()
00374 {
00375 TouchObs.<a class="code" href="classNLMISC_1_1CBitSet.html#z265_10">clearAll</a>();
00376 }
00377
00378 <font class="comment">// for CMOT::createModel() and for CTransform::freezeHRC() only.</font>
00379 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IModel.html#z593_2">linkToValidateList</a>();
00380 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IModel.html#z593_3">unlinkFromValidateList</a>();
00381
00383
00384
00385 };
00386
00387
00388 <font class="comment">// ***************************************************************************</font>
<a name="l00411"></a><a class="code" href="classNL3D_1_1IObs.html">00411</a> <font class="comment"></font><font class="keyword">class </font>IObs : <font class="keyword">public</font> NLMISC::CRefCount
00412 {
00413 <font class="keyword">public</font>:
<a name="l00414"></a><a class="code" href="classNL3D_1_1IObs.html#m0">00414</a> IModel *<a class="code" href="classNL3D_1_1IObs.html#m0">Model</a>; <font class="comment">// The model for this observer.</font>
<a name="l00415"></a><a class="code" href="classNL3D_1_1IObs.html#m1">00415</a> ITrav *<a class="code" href="classNL3D_1_1IObs.html#m1">Trav</a>; <font class="comment">// The traversal for this observer.</font>
00416
00417 <font class="keyword">public</font>:
00418 <a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a>();
00420 <font class="keyword">virtual</font> <a class="code" href="classNL3D_1_1IObs.html#a1">~IObs</a>();
<a name="l00424"></a><a class="code" href="classNL3D_1_1IObs.html#a2">00424</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IObs.html#a2">init</a>() {}
00425
00426
00448
<a name="l00449"></a><a class="code" href="classNL3D_1_1IObs.html#z594_0">00449</a> <font class="keyword">virtual</font> <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1IObs.html#z594_0">isTreeNode</a>() {<font class="keywordflow">return</font> <font class="keyword">true</font>;}
00451 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IObs.html#z594_1">addChild</a>(<a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *son);
00453 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IObs.html#z594_2">delChild</a>(<a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *son);
00458 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IObs.html#z594_3">addParent</a>(<a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *father);
00460 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IObs.html#z594_4">delParent</a>(<a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *father);
00461
<a name="l00463"></a><a class="code" href="classNL3D_1_1IObs.html#z594_5">00463</a> <a class="code" href="types__nl_8h.html#a13">sint</a> <a class="code" href="classNL3D_1_1IObs.html#z594_5">getNumChildren</a>()<font class="keyword"> const </font>{<font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IObs.html#n5">NumSons</a>;}
<a name="l00465"></a><a class="code" href="classNL3D_1_1IObs.html#z594_6">00465</a> <a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *<a class="code" href="classNL3D_1_1IObs.html#z594_6">getFirstChild</a>()<font class="keyword"> const</font>
00466 <font class="keyword"> </font>{
00467 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IObs.html#n5">NumSons</a>==0)
00468 <font class="keywordflow">return</font> 0;
00469 <a class="code" href="classNL3D_1_1IObs.html#n6">CurSonIt</a>= <a class="code" href="classNL3D_1_1IObs.html#n0">SonList</a>.begin();
00470 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1IObs.html#n6">CurSonIt</a>!=<a class="code" href="classNL3D_1_1IObs.html#n0">SonList</a>.end());
00471 <font class="keywordflow">return</font> (*CurSonIt);
00472 }
<a name="l00474"></a><a class="code" href="classNL3D_1_1IObs.html#z594_7">00474</a> <a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *<a class="code" href="classNL3D_1_1IObs.html#z594_7">getNextChild</a>()<font class="keyword"> const</font>
00475 <font class="keyword"> </font>{
00476 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1IObs.html#n6">CurSonIt</a>!=<a class="code" href="classNL3D_1_1IObs.html#n0">SonList</a>.end());
00477 <a class="code" href="classNL3D_1_1IObs.html#n6">CurSonIt</a>++;
00478 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IObs.html#n6">CurSonIt</a>==<a class="code" href="classNL3D_1_1IObs.html#n0">SonList</a>.end())
00479 <font class="keywordflow">return</font> NULL;
00480 <font class="keywordflow">else</font>
00481 <font class="keywordflow">return</font> (*CurSonIt);
00482 }
00483
<a name="l00485"></a><a class="code" href="classNL3D_1_1IObs.html#z594_8">00485</a> <a class="code" href="types__nl_8h.html#a13">sint</a> <a class="code" href="classNL3D_1_1IObs.html#z594_8">getNumParents</a>()<font class="keyword"> const </font>{<font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1IObs.html#n4">NumFathers</a>;}
<a name="l00487"></a><a class="code" href="classNL3D_1_1IObs.html#z594_9">00487</a> <a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *<a class="code" href="classNL3D_1_1IObs.html#z594_9">getFirstParent</a>()<font class="keyword"> const</font>
00488 <font class="keyword"> </font>{
00489 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IObs.html#n4">NumFathers</a>==0)
00490 <font class="keywordflow">return</font> 0;
00491 <a class="code" href="classNL3D_1_1IObs.html#n7">CurFatherIt</a>= <a class="code" href="classNL3D_1_1IObs.html#n1">FatherList</a>.begin();
00492 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1IObs.html#n7">CurFatherIt</a>!=<a class="code" href="classNL3D_1_1IObs.html#n1">FatherList</a>.end());
00493 <font class="keywordflow">return</font> (*CurFatherIt);
00494 }
<a name="l00496"></a><a class="code" href="classNL3D_1_1IObs.html#z594_10">00496</a> <a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *<a class="code" href="classNL3D_1_1IObs.html#z594_10">getNextParent</a>()<font class="keyword"> const</font>
00497 <font class="keyword"> </font>{
00498 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1IObs.html#n7">CurFatherIt</a>!=<a class="code" href="classNL3D_1_1IObs.html#n1">FatherList</a>.end());
00499 <a class="code" href="classNL3D_1_1IObs.html#n7">CurFatherIt</a>++;
00500 <font class="keywordflow">if</font>(<a class="code" href="classNL3D_1_1IObs.html#n7">CurFatherIt</a>==<a class="code" href="classNL3D_1_1IObs.html#n1">FatherList</a>.end())
00501 <font class="keywordflow">return</font> NULL;
00502 <font class="keywordflow">else</font>
00503 <font class="keywordflow">return</font> (*CurFatherIt);
00504 }
00505
00507
00508
00510
00511
00518 <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IObs.html#z595_0">traverse</a>(<a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *caller)=0;
00520
00521
00523
00524
<a name="l00531"></a><a class="code" href="classNL3D_1_1IObs.html#z596_0">00531</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IObs.html#z596_0">update</a>()
00532 {
00533 }
00535
00536
00538
00539
<a name="l00540"></a><a class="code" href="classNL3D_1_1IObs.html#z597_0">00540</a> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1IObs.html#z597_0">traverseSons</a>()
00541 {
00542 <font class="keywordflow">for</font>(<a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *c= <a class="code" href="classNL3D_1_1IObs.html#z594_6">getFirstChild</a>(); c!=NULL; c= <a class="code" href="classNL3D_1_1IObs.html#z594_7">getNextChild</a>())
00543 {
00544 c->traverse(<font class="keyword">this</font>);
00545 }
00546 }
00548 <a class="code" href="classNL3D_1_1IObs.html#a0">IObs</a> *<a class="code" href="classNL3D_1_1IObs.html#z597_1">getObs</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> &idTrav) <font class="keyword">const</font>;
00550
00551
00552 <font class="keyword">protected</font>:
<a name="l00553"></a><a class="code" href="classNL3D_1_1IObs.html#t0">00553</a> <font class="keyword">typedef</font> <a class="code" href="classstd_1_1list.html">std::list<IObs*></a> <a class="code" href="classstd_1_1list.html">TObsList</a>;
<a name="l00554"></a><a class="code" href="classNL3D_1_1IObs.html#t1">00554</a> <font class="keyword">typedef</font> TObsList::iterator <a class="code" href="classNL3D_1_1IObs.html#t1">ItObsList</a>;
<a name="l00555"></a><a class="code" href="classNL3D_1_1IObs.html#t2">00555</a> <font class="keyword">typedef</font> TObsList::const_iterator <a class="code" href="classNL3D_1_1IObs.html#t2">ConstItObsList</a>;
<a name="l00556"></a><a class="code" href="classNL3D_1_1IObs.html#t3">00556</a> <font class="keyword">typedef</font> std::map<IObs *, ItObsList> <a class="code" href="classNL3D_1_1IObs.html#t3">TObsMap</a>;
<a name="l00557"></a><a class="code" href="classNL3D_1_1IObs.html#t4">00557</a> <font class="keyword">typedef</font> TObsMap::iterator <a class="code" href="classNL3D_1_1IObs.html#t4">ItObsMap</a>;
00558
00559 <font class="comment">// separate in list/set, to have o(1) lookup, and o(logn) insertion/erase.</font>
<a name="l00560"></a><a class="code" href="classNL3D_1_1IObs.html#n0">00560</a> TObsList <a class="code" href="classNL3D_1_1IObs.html#n0">SonList</a>;
<a name="l00561"></a><a class="code" href="classNL3D_1_1IObs.html#n1">00561</a> TObsList <a class="code" href="classNL3D_1_1IObs.html#n1">FatherList</a>;
<a name="l00562"></a><a class="code" href="classNL3D_1_1IObs.html#n2">00562</a> <a class="code" href="classNL3D_1_1IObs.html#t3">TObsMap</a> <a class="code" href="classNL3D_1_1IObs.html#n2">SonMap</a>;
<a name="l00563"></a><a class="code" href="classNL3D_1_1IObs.html#n3">00563</a> <a class="code" href="classNL3D_1_1IObs.html#t3">TObsMap</a> <a class="code" href="classNL3D_1_1IObs.html#n3">FatherMap</a>;
<a name="l00564"></a><a class="code" href="classNL3D_1_1IObs.html#n4">00564</a> <a class="code" href="types__nl_8h.html#a13">sint</a> <a class="code" href="classNL3D_1_1IObs.html#n4">NumFathers</a>;
<a name="l00565"></a><a class="code" href="classNL3D_1_1IObs.html#n5">00565</a> <a class="code" href="types__nl_8h.html#a13">sint</a> <a class="code" href="classNL3D_1_1IObs.html#n5">NumSons</a>;
00566
<a name="l00567"></a><a class="code" href="classNL3D_1_1IObs.html#n6">00567</a> <font class="keyword">mutable</font> <a class="code" href="classNL3D_1_1IObs.html#t2">ConstItObsList</a> <a class="code" href="classNL3D_1_1IObs.html#n6">CurSonIt</a>;
<a name="l00568"></a><a class="code" href="classNL3D_1_1IObs.html#n7">00568</a> <font class="keyword">mutable</font> <a class="code" href="classNL3D_1_1IObs.html#t2">ConstItObsList</a> <a class="code" href="classNL3D_1_1IObs.html#n7">CurFatherIt</a>;
00569
00570 };
00571
00572
00573
00574 <font class="comment">// ***************************************************************************</font>
<a name="l00596"></a><a class="code" href="classNL3D_1_1ITrav.html">00596</a> <font class="comment"></font><font class="keyword">class </font>ITrav : <font class="keyword">public</font> NLMISC::CRefCount
00597 {
00598 <font class="keyword">public</font>:
00599
00601
00602
<a name="l00603"></a><a class="code" href="classNL3D_1_1ITrav.html#z598_0">00603</a> <a class="code" href="classNL3D_1_1ITrav.html#z598_0">ITrav</a>() {<a class="code" href="classNL3D_1_1ITrav.html#n0">Root</a>=NULL;}
<a name="l00605"></a><a class="code" href="classNL3D_1_1ITrav.html#z598_1">00605</a> <font class="keyword">virtual</font> <a class="code" href="classNL3D_1_1ITrav.html#z598_1">~ITrav</a>() {<a class="code" href="classNL3D_1_1ITrav.html#n0">Root</a>= NULL;}
00607
00609
00610
00614 <font class="keyword">virtual</font> IObs *<a class="code" href="classNL3D_1_1ITrav.html#z599_0">createDefaultObs</a>() <font class="keyword">const</font> =0;
00616 <font class="keyword">virtual</font> <a class="code" href="classNLMISC_1_1CClassId.html">NLMISC::CClassId</a> <a class="code" href="classNL3D_1_1ITrav.html#z599_1">getClassId</a>() <font class="keyword">const</font> =0;
<a name="l00618"></a><a class="code" href="classNL3D_1_1ITrav.html#z599_2">00618</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrav.html#z599_2">addedToMOT</a>(CMOT *mot) {}
00620
00621
00623
00624
00632 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrav.html#z600_0">setRoot</a>(IModel *root);
00634 IModel *<a class="code" href="classNL3D_1_1ITrav.html#z600_1">getRoot</a>() <font class="keyword">const</font>;
00641 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrav.html#z600_2">link</a>(IModel *m1, IModel *m2) <font class="keyword">const</font>;
00647 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrav.html#z600_3">unlink</a>(IModel *m1, IModel *m2) <font class="keyword">const</font>;
00649 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrav.html#z600_4">moveChildren</a>(IModel *parentFrom, IModel *parentTo) <font class="keyword">const</font>;
00651 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1ITrav.html#z600_5">copyChildren</a>(IModel *parentFrom, IModel *parentTo) <font class="keyword">const</font>;
00652
00653
00655 <a class="code" href="types__nl_8h.html#a13">sint</a> <a class="code" href="classNL3D_1_1ITrav.html#z600_6">getNumChildren</a>(IModel *m) <font class="keyword">const</font>;
00657 IModel *<a class="code" href="classNL3D_1_1ITrav.html#z600_7">getFirstChild</a>(IModel *m) <font class="keyword">const</font>;
00659 IModel *<a class="code" href="classNL3D_1_1ITrav.html#z600_8">getNextChild</a>(IModel *m) <font class="keyword">const</font>;
00660
00662 <a class="code" href="types__nl_8h.html#a13">sint</a> <a class="code" href="classNL3D_1_1ITrav.html#z600_9">getNumParents</a>(IModel *m) <font class="keyword">const</font>;
00664 IModel *<a class="code" href="classNL3D_1_1ITrav.html#z600_10">getFirstParent</a>(IModel *m) <font class="keyword">const</font>;
00666 IModel *<a class="code" href="classNL3D_1_1ITrav.html#z600_11">getNextParent</a>(IModel *m) <font class="keyword">const</font>;
00667
00669
00670
00671 <font class="keyword">protected</font>:
00672 <font class="comment">// The root observer.</font>
<a name="l00673"></a><a class="code" href="classNL3D_1_1ITrav.html#n0">00673</a> <a class="code" href="classNLMISC_1_1CRefPtr.html">NLMISC::CRefPtr<IObs></a> <a class="code" href="classNL3D_1_1ITrav.html#n0">Root</a>;
00674
00675 };
00676
00677
00678
00679
00680 }
00681
00682
00683 <font class="preprocessor">#endif // NL_MOT_H</font>
00684 <font class="preprocessor"></font>
00685 <font class="comment">/* End of mot.h */</font>
00686
</pre></div>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|