aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/ps__attrib_8h-source.html
blob: 8bf4c9bdaa51cfaa3c01f2e3a693db291e0ed1bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>ps_attrib.h</h1><a href="ps__attrib_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#ifndef NL_PS_ATTRIB_H</font>
00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_PS_ATTRIB_H</font>
00028 <font class="preprocessor"></font>
00029 
00030 
00031 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="stream_8h.html">nel/misc/stream.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="animation__time_8h.html">nel/3d/animation_time.h</a>"</font>
00034 <font class="preprocessor">#include "<a class="code" href="vector_8h.html">nel/misc/vector.h</a>"</font>
00035 <font class="preprocessor">#include "<a class="code" href="rgba_8h.html">nel/misc/rgba.h</a>"</font>
00036 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font>
00037 
00038 
00039 <font class="keyword">namespace </font>NL3D {
00040 
00043 <font class="keyword">template</font> &lt;<font class="keyword">class</font> T, const u<font class="keywordtype">int</font> snapPower = 5&gt;
<a name="l00044"></a><a class="code" href="classNL3D_1_1CSnappedVector.html">00044</a> <font class="keyword">class </font>CSnappedVector
00045 {
00046 <font class="keyword">public</font>:
<a name="l00047"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#s0">00047</a>         <font class="keyword">typedef</font> T *<a class="code" href="classNL3D_1_1CSnappedVector.html#s0">iterator</a>;    
<a name="l00048"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#s1">00048</a>         <font class="keyword">typedef</font> <font class="keyword">const</font> T *<a class="code" href="classNL3D_1_1CSnappedVector.html#s1">const_iterator</a>;
<a name="l00049"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#s2">00049</a>         <font class="keyword">typedef</font> T <a class="code" href="classNL3D_1_1CSnappedVector.html#s2">value_type</a>;
00050 
<a name="l00051"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a0">00051</a>         <a class="code" href="classNL3D_1_1CSnappedVector.html#a0">CSnappedVector</a>() : <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>(0), <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>(0), <a class="code" href="classNL3D_1_1CSnappedVector.html#n0">_Start</a>(NULL), <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>(NULL) {}
<a name="l00052"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a1">00052</a>         <a class="code" href="classNL3D_1_1CSnappedVector.html#a1">~CSnappedVector</a>() 
00053         { 
00054                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> &lt;= <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>);
00055                 <font class="keywordflow">for</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#s0">iterator</a> it = <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>, endIt = <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>; it != endIt; ++it)
00056                 {
00057                         it-&gt;~T();
00058                 }
00059                 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#n0">_Start</a>; 
00060         }
<a name="l00061"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a2">00061</a>         <a class="code" href="classNL3D_1_1CSnappedVector.html#s0">iterator</a> <a class="code" href="classNL3D_1_1CSnappedVector.html#a2">begin</a>(<font class="keywordtype">void</font>) { <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>; }
<a name="l00062"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a3">00062</a>         <a class="code" href="classNL3D_1_1CSnappedVector.html#s1">const_iterator</a> <a class="code" href="classNL3D_1_1CSnappedVector.html#a2">begin</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>; }
<a name="l00063"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a4">00063</a>         <a class="code" href="classNL3D_1_1CSnappedVector.html#s0">iterator</a> <a class="code" href="classNL3D_1_1CSnappedVector.html#a4">end</a>(<font class="keywordtype">void</font>) { <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>; }
<a name="l00064"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a5">00064</a>         <a class="code" href="classNL3D_1_1CSnappedVector.html#s1">const_iterator</a> <a class="code" href="classNL3D_1_1CSnappedVector.html#a4">end</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>; }
00065 
<a name="l00066"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a6">00066</a>         T &amp;<a class="code" href="classNL3D_1_1CSnappedVector.html#a6">operator[]</a>(uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) { <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> &amp;&amp; <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>); <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]; }
<a name="l00067"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a7">00067</a>         <font class="keyword">const</font> T &amp;<a class="code" href="classNL3D_1_1CSnappedVector.html#a6">operator[]</a>(uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const </font>{ <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> &amp;&amp; <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>); <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]; }
00068 
<a name="l00070"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a8">00070</a>         <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#a8">reserve</a>(uint <a class="code" href="classNL3D_1_1CSnappedVector.html#a12">capacity</a>)
00071         {       
00072                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#a12">capacity</a> &lt; <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>) <font class="keywordflow">return</font>;
00073                 uint8 *newStart = NULL;
00074                 <font class="keywordflow">try</font>
00075                 {                       
00076                         newStart = <font class="keyword">new</font> uint8[<font class="keyword">sizeof</font>(T) * <a class="code" href="classNL3D_1_1CSnappedVector.html#a12">capacity</a> + (1 &lt;&lt; snapPower)];
00077                         T *newTab = (T *) ( (uint) (newStart + (1 &lt;&lt; snapPower))  &amp; ~((1 &lt;&lt; snapPower) - 1)); <font class="comment">// snap to a page</font>
00078 
00079                         
00080                 
00081                         <font class="keywordflow">for</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#s0">iterator</a> <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a> = <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>, <a class="code" href="classNL3D_1_1CSnappedVector.html#a4">end</a> = <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + (<a class="code" href="classNL3D_1_1CSnappedVector.html#a12">capacity</a> &lt; <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> ? <a class="code" href="classNL3D_1_1CSnappedVector.html#a12">capacity</a> : <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>), dest = newTab 
00082                                 ; <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a> != <a class="code" href="classNL3D_1_1CSnappedVector.html#a4">end</a> 
00083                                 ; ++ <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>, ++dest)
00084                         {
00085                                 <font class="keyword">new</font> ((<font class="keywordtype">void</font> *) dest) T(*<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>); <font class="comment">// copy object</font>
00086                         }
00087 
00088                         <font class="comment">// swap datas</font>
00089                         std::swap(<a class="code" href="classNL3D_1_1CSnappedVector.html#n0">_Start</a>, newStart);
00090                         std::swap(<a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>, newTab);
00091 
00092                         <font class="comment">// destroy previous objects. We assume that we can't have exceptions raised from destructors</font>
00093                         <font class="keywordflow">for</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#s0">iterator</a> it = newTab <font class="comment">/* old tab */</font>, endIt = newTab + <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>; it != endIt; ++ it)
00094                         {
00095                                 it-&gt;~T();
00096                         }
00097 
00098                         <font class="comment">// set new size</font>
00099                         <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a> = <a class="code" href="classNL3D_1_1CSnappedVector.html#a12">capacity</a>;
00100                         <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>    = <a class="code" href="classNL3D_1_1CSnappedVector.html#a12">capacity</a> &lt; <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> ? <a class="code" href="classNL3D_1_1CSnappedVector.html#a12">capacity</a> : <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>;
00101 
00102 
00103                         <font class="comment">// delete old vect (that was swapped with the new one)</font>
00104                         <font class="keyword">delete</font> [] newStart;
00105                         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> &lt;= <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>);
00106                 }
00107                 <font class="keywordflow">catch</font> (...)
00108                 {
00109                         <font class="keyword">delete</font> [] newStart;
00110                         <font class="keywordflow">throw</font>;
00111                 }
00112         
00113         }
<a name="l00114"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a9">00114</a>         <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#a9">resize</a>(uint <a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a>)
00115         {
00116                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a> &lt; (1 &lt;&lt; 16));
00117                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a> &lt; <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>)
00118                 {
00119                         <font class="keywordflow">for</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#s0">iterator</a> it = <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + <a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a>, endIt = <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>; it != endIt; ++it)
00120                         {
00121                                 it-&gt;~T();
00122                         }                       
00123                 }
00124                 <font class="keywordflow">else</font>
00125                 {
00126                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a> &gt; <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>) 
00127                         {
00128                                 <a class="code" href="classNL3D_1_1CSnappedVector.html#a8">reserve</a>(<a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a>);
00129                         }
00130                         <font class="keywordflow">for</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#s0">iterator</a> it = <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>, endIt = <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + <a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a>; it != endIt; ++it)
00131                         {
00132                                 <font class="keyword">new</font> ((<font class="keywordtype">void</font> *) it) T();
00133                         }
00134                 }
00135 
00136                 <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> = <a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a>;
00137                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> &lt;= <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>);
00138         }
00139 
<a name="l00140"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a10">00140</a>         <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#a10">push_back</a>(<font class="keyword">const</font> T &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>)
00141         {
00142                 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>)
00143                 {
00144                         <a class="code" href="classNL3D_1_1CSnappedVector.html#a8">reserve</a>(2);
00145                         <font class="keyword">new</font> ((<font class="keywordtype">void</font> *) <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>) T(<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
00146                         <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> = 1;
00147                 }
00148                 <font class="keywordflow">else</font>
00149                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> &lt; <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>)
00150                 {
00151                         <font class="keyword">new</font> ((<font class="keywordtype">void</font> *) (<a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>)) T(<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
00152                         ++<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>;
00153                 }
00154                 <font class="keywordflow">else</font>                            
00155                 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> == <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>) 
00156                 { 
00157                         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a> == 1) 
00158                         {
00159                                 <a class="code" href="classNL3D_1_1CSnappedVector.html#a8">reserve</a>(2);
00160                         }
00161                         <font class="keywordflow">else</font>
00162                         {
00163                                 <a class="code" href="classNL3D_1_1CSnappedVector.html#a8">reserve</a>(<a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a> + (<a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>&gt;&gt;1));
00164                         }
00165                         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> &lt;= <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>);
00166                         <font class="keyword">new</font> ((<font class="keywordtype">void</font> *) (<a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a> + <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>)) T(<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
00167                         ++<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>;
00168                 }
00169         }
00170 
<a name="l00171"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a11">00171</a>         <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#a11">pop_back</a>()
00172         {
00173                 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>);
00174                 <a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>[<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a> - 1].~T();
00175                 --<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>;
00176         }
00177 
00178 
<a name="l00179"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a12">00179</a>         uint <a class="code" href="classNL3D_1_1CSnappedVector.html#a12">capacity</a>()<font class="keyword"> const  </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>; }
<a name="l00180"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a13">00180</a>         uint <a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a>()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>; }
00181 
<a name="l00183"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a14">00183</a>         <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#a14">serial</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
00184         {
00185                 <font class="keywordflow">if</font> (f.isReading())
00186                 {
00187                         <a class="code" href="classNL3D_1_1CSnappedVector.html#a15">clear</a>();
00188                         uint32 <a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a>, maxsize;
00189                         f.serial(<a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a>, maxsize);
00190                         <a class="code" href="classNL3D_1_1CSnappedVector.html#a8">reserve</a>(maxsize);
00191                         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CSnappedVector.html#a13">size</a>; ++k)
00192                         {
00193                                 T tmp;
00194                                 f.serial(tmp);
00195                                 <a class="code" href="classNL3D_1_1CSnappedVector.html#a10">push_back</a>(tmp);
00196                         }
00197                 }
00198                 <font class="keywordflow">else</font>
00199                 {
00200                         f.serial(<a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>, <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>);
00201                         <font class="keywordflow">for</font> (uint k = 0; k &lt; <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>; ++k)
00202                         {
00203                                 f.serial(<a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>[k]);
00204                         }
00205                 }               
00206         }
00207 
00208         <font class="comment">// clear</font>
<a name="l00209"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#a15">00209</a>         <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CSnappedVector.html#a15">clear</a>() { <a class="code" href="classNL3D_1_1CSnappedVector.html#a9">resize</a>(0); }
00210 
00211 <font class="keyword">protected</font>:
00212 
<a name="l00213"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#n0">00213</a>         uint8 *<a class="code" href="classNL3D_1_1CSnappedVector.html#n0">_Start</a>;   <font class="comment">// real allocation address</font>
<a name="l00214"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#n1">00214</a>         T *<a class="code" href="classNL3D_1_1CSnappedVector.html#n1">_Tab</a>;       <font class="comment">// first element</font>
<a name="l00215"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#n2">00215</a>         uint32 <a class="code" href="classNL3D_1_1CSnappedVector.html#n2">_Size</a>;    <font class="comment">// used elements</font>
<a name="l00216"></a><a class="code" href="classNL3D_1_1CSnappedVector.html#n3">00216</a>         uint32 <a class="code" href="classNL3D_1_1CSnappedVector.html#n3">_Capacity</a>; <font class="comment">// max size</font>
00217 };
00218 
00219 
00220 
00221 
00222 
00223 
<a name="l00233"></a><a class="code" href="classNL3D_1_1CPSAttrib.html">00233</a> <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; <font class="keyword">class </font>CPSAttrib
00234 {
00235 <font class="keyword">public</font>:
00236 
00238 
00239 
00240                         <a class="code" href="classNL3D_1_1CPSAttrib.html#z700_0">CPSAttrib</a>();
00241 
00243                         <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#z700_1">serial</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream);
00245 
00247 
00248 
00251                 <font class="comment">//typedef CSnappedVector&lt;T&gt; TContType;</font>
<a name="l00252"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z701_0">00252</a>                         <font class="keyword">typedef</font> std::vector&lt;T&gt; <a class="code" href="classNL3D_1_1CPSAttrib.html#z701_0">TContType</a>;
00253 
<a name="l00255"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z701_1">00255</a>                 <font class="keyword">typedef</font> T <a class="code" href="classNL3D_1_1CPSAttrib.html#z701_1">value_type</a>;
00256 
<a name="l00258"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z701_2">00258</a>                 <font class="keyword">typedef</font> <font class="keyword">typename</font> TContType::iterator <a class="code" href="classNL3D_1_1CPSAttrib.html#z701_2">iterator</a>;
<a name="l00260"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z701_3">00260</a>                 <font class="keyword">typedef</font> <font class="keyword">typename</font> TContType::const_iterator <a class="code" href="classNL3D_1_1CPSAttrib.html#z701_3">const_iterator</a>;
00262 
00263 
00265 
00266 
00269                 <font class="keywordtype">void</font>                                    <a class="code" href="classNL3D_1_1CPSAttrib.html#z702_0">resize</a>(uint32 nbInstances);
00270 
<a name="l00272"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z702_1">00272</a>                 uint32 <a class="code" href="classNL3D_1_1CPSAttrib.html#z702_1">getSize</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.size(); }
00273 
<a name="l00275"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z702_2">00275</a>                 uint32 <a class="code" href="classNL3D_1_1CPSAttrib.html#z702_2">getMaxSize</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#n1">_MaxSize</a>; }
00276 
00278 
00279 
00281 
00282 
<a name="l00283"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z703_0">00283</a>                 <font class="keyword">const</font> T &amp;                               <a class="code" href="classNL3D_1_1CPSAttrib.html#z703_0">operator[]</a>(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)<font class="keyword"> const </font>
00284 <font class="keyword">                </font>{ 
00285 <font class="preprocessor">                        #ifdef NL_DEBUG</font>
00286 <font class="preprocessor"></font>                                <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.size());
00287 <font class="preprocessor">                        #endif</font>
00288 <font class="preprocessor"></font>                        <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]; 
00289                 }
00290 
<a name="l00292"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z703_1">00292</a>                 T &amp;                                             <a class="code" href="classNL3D_1_1CPSAttrib.html#z703_0">operator[]</a>(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>) 
00293                 { 
00294 <font class="preprocessor">                        #ifdef NL_DEBUG</font>
00295 <font class="preprocessor"></font>                                <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.size());
00296 <font class="preprocessor">                        #endif</font>
00297 <font class="preprocessor"></font>                        <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]; 
00298                 }
00300 
00301 
00302 
00304 
00305 
00306 
<a name="l00308"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z704_0">00308</a>                 <a class="code" href="classNL3D_1_1CPSAttrib.html#z701_2">iterator</a>                                <a class="code" href="classNL3D_1_1CPSAttrib.html#z704_0">begin</a>(<font class="keywordtype">void</font>) { <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.begin(); }
00309 
<a name="l00311"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z704_1">00311</a>                 <a class="code" href="classNL3D_1_1CPSAttrib.html#z701_2">iterator</a>                                <a class="code" href="classNL3D_1_1CPSAttrib.html#z704_1">end</a>(<font class="keywordtype">void</font>) { <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.end(); }        
00312 
<a name="l00314"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z704_2">00314</a>                 <a class="code" href="classNL3D_1_1CPSAttrib.html#z701_3">const_iterator</a>                  <a class="code" href="classNL3D_1_1CPSAttrib.html#z704_0">begin</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.begin(); }
00315 
<a name="l00317"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z704_3">00317</a>                 <a class="code" href="classNL3D_1_1CPSAttrib.html#z701_3">const_iterator</a>                  <a class="code" href="classNL3D_1_1CPSAttrib.html#z704_1">end</a>(<font class="keywordtype">void</font>)<font class="keyword"> const </font>{ <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.end(); }  
00319         
00321 
00322 
00326                 sint32 <a class="code" href="classNL3D_1_1CPSAttrib.html#z705_0">insert</a>(<font class="keyword">const</font> T &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a> = T() );               
00327 
00329                 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#z705_1">remove</a>(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>); 
00330 
<a name="l00332"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z705_2">00332</a>                 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#z705_2">clear</a>(<font class="keywordtype">void</font>)
00333                 {
00334                         <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.clear();                   
00335                 }
00337 
00338 <font class="keyword">protected</font>:                      
<a name="l00339"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#n0">00339</a>         <a class="code" href="classNL3D_1_1CPSAttrib.html#z701_0">TContType</a> <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>; 
<a name="l00340"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#n1">00340</a>         uint32    <a class="code" href="classNL3D_1_1CPSAttrib.html#n1">_MaxSize</a>; <font class="comment">// the max number of elements that can be stored</font>
00341 };
00342 
00343 
00344 
00345 
00346 
00348 <font class="comment">//                                      IMPLEMENTATION                                                                     //</font>
00350 <font class="comment"></font>
00351 <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; 
<a name="l00352"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z700_0">00352</a> CPSAttrib&lt;T&gt;::CPSAttrib()
00353 {
00354         <a class="code" href="classNL3D_1_1CPSAttrib.html#n1">_MaxSize</a> = <a class="code" href="namespaceNL3D.html#a200">DefaultMaxLocatedInstance</a>;
00355 }
00356 
00357 
00358 <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; 
<a name="l00359"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z702_0">00359</a> <font class="keywordtype">void</font> CPSAttrib&lt;T&gt;::resize(uint32 nbInstances)
00360 {       
00361         <a class="code" href="debug_8h.html#a6">nlassert</a>(nbInstances &lt; (1 &lt;&lt; 16));
00362         <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.reserve(nbInstances);
00363         <a class="code" href="classNL3D_1_1CPSAttrib.html#n1">_MaxSize</a> = nbInstances;
00364 }
00365 
00366 
00367 <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; 
<a name="l00368"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z705_0">00368</a> sint32 CPSAttrib&lt;T&gt;::insert(<font class="keyword">const</font> T &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>)
00369 {       
00370         <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.size() == <a class="code" href="classNL3D_1_1CPSAttrib.html#n1">_MaxSize</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.size() &gt; <a class="code" href="namespaceNL3D.html#a200">DefaultMaxLocatedInstance</a>) 
00371         {
00372                 <font class="keywordflow">return</font> -1;
00373         }       
00374         <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.push_back(<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
00375         <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.size() - 1; 
00376 }
00377 
00378 
00379 <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; 
<a name="l00380"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z705_1">00380</a> <font class="keywordtype">void</font> CPSAttrib&lt;T&gt;::remove(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
00381 {       
00382         <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> &lt; <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.size());
00383         <font class="comment">// we copy the last element in place of this one</font>
00384         <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> != <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.size() - 1)
00385         {
00386                 <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>] = <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>[<a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.size() - 1];
00387         }
00388         <a class="code" href="classNL3D_1_1CPSAttrib.html#n0">_Tab</a>.pop_back();
00389         
00390 }
00391 
00392 <font class="keyword">template</font> &lt;<font class="keyword">typename</font> T&gt; 
<a name="l00393"></a><a class="code" href="classNL3D_1_1CPSAttrib.html#z700_1">00393</a> <font class="keywordtype">void</font> CPSAttrib&lt;T&gt;::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
00394 {       
00395         sint ver = f.serialVersion(3);
00396 
00397         <font class="comment">// in the first version, size was duplicated, we were using a std::vector ...</font>
00398         <font class="keywordflow">if</font> (ver == 1)
00399         {               
00400                 <font class="keywordflow">if</font>(f.isReading())
00401                 {       
00402                         uint32 size;
00403                         f.serial(size);
00404                         f.serial(_MaxSize);
00405                         _Tab.reserve(_MaxSize);
00406                         f.serial(size); <font class="comment">// useless but, we were previously doing a serialCont... compatibility purpose only</font>
00407                         T tmp;
00408                         <font class="comment">// Read the vector</font>
00409                         <font class="keywordflow">for</font>(uint i = 0; i &lt; size; i++)
00410                         {
00411                                 f.serial(tmp);
00412                                 _Tab.push_back(tmp);
00413                         }
00414                         <a class="code" href="debug_8h.html#a6">nlassert</a>(_Tab.size() == size);
00415                 }
00416                 <font class="keywordflow">else</font>
00417                 {
00418                         uint32 size = _Tab.size();
00419                         f.serial(size);
00420                         f.serial(_MaxSize);             
00421                         f.serial(size);
00422                         <font class="comment">// write the vector</font>
00423                         <font class="keywordflow">for</font>(uint i = 0; i &lt; size; i++)
00424                         {
00425                                 f.serial(_Tab[i]);                              
00426                         }
00427                 }
00428         }
00429 
00430         <font class="keywordflow">if</font> (ver == 2) <font class="comment">// this version didn't work well, it relied on the capacity of the container to store the max number of instances</font>
00431         {
00432                 <a class="code" href="debug_8h.html#a6">nlassert</a>(0);
00433         <font class="comment">/*      f.serial(_Tab);</font>
00434 <font class="comment">                if (f.isReading())</font>
00435 <font class="comment">                {</font>
00436 <font class="comment">                        _MaxSize = _Tab.capacity();</font>
00437 <font class="comment">                }*/</font>
00438         }       
00439 
00440         <font class="keywordflow">if</font> (ver == 3)
00441         {
00442                 f.serial(_MaxSize);
00443                 _Tab.reserve(_MaxSize);
00444                 <font class="comment">//f.serial(_Tab);</font>
00445 
00446 
00447                 <font class="keywordflow">if</font> (f.isReading())
00448                 {
00449                         _Tab.clear();
00450                         uint32 size, maxsize;
00451                         f.serial(size, maxsize);
00452                         _Tab.reserve(maxsize);
00453                         <font class="keywordflow">for</font> (uint k = 0; k &lt; size; ++k)
00454                         {
00455                                 T tmp;
00456                                 f.serial(tmp);
00457                                 _Tab.push_back(tmp);
00458                         }
00459                 }
00460                 <font class="keywordflow">else</font>
00461                 {
00462                         uint32 size = _Tab.size(), capacity = _Tab.capacity();
00463                         f.serial(size, capacity);
00464                         <font class="keywordflow">for</font> (uint k = 0; k &lt; size; ++k)
00465                         {
00466                                 f.serial(_Tab[k]);
00467                         }
00468                 }
00469         }
00470 }
00471 
00472 
00473 
00474 
00475 <font class="comment">// here we give some definition for common types</font>
00476 
00477 <font class="keyword">typedef</font> CPSAttrib&lt;NLMISC::CVector&gt; <a class="code" href="namespaceNL3D.html#a180">TPSAttribVector</a>;
00478 <font class="keyword">typedef</font> CPSAttrib&lt;NLMISC::CRGBA&gt;   <a class="code" href="namespaceNL3D.html#a181">TPSAttribRGBA</a>;
00479 <font class="keyword">typedef</font> CPSAttrib&lt;float&gt;                   <a class="code" href="namespaceNL3D.html#a182">TPSAttribFloat</a>;      
00480 <font class="keyword">typedef</font> CPSAttrib&lt;uint32&gt;                  <a class="code" href="namespaceNL3D.html#a183">TPSAttribUInt</a>;       
00481 <font class="keyword">typedef</font> CPSAttrib&lt;uint8&gt;                   <a class="code" href="namespaceNL3D.html#a184">TPSAttribUInt8</a>;      
00482 <font class="keyword">typedef</font> CPSAttrib&lt;TAnimationTime&gt;  <a class="code" href="namespaceNL3D.html#a185">TPSAttribTime</a>;
00483 
00484 
00485 
00486 
00487 
00488 } <font class="comment">// NL3D</font>
00489 
00490 
00491 <font class="preprocessor">#endif // NL_PS_ATTRIB_H</font>
00492 <font class="preprocessor"></font>
00493 <font class="comment">/* End of ps_attrib.h */</font>
</pre></div>

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