#include <ps_attrib.h>
Nevrax France
Definition at line 264 of file ps_attrib.h.
Public Types | |
Useful typedefs | |
| typedef TContType::const_iterator | const_iterator |
| a const iterator on the datas | |
| typedef TContType::iterator | iterator |
| an iterator on the datas | |
| typedef CPSVector< T >::V | TContType |
| typedef T | value_type |
| The type used by the container. Its is the type used to instanciate this template. | |
Public Member Functions | |
Element access. | |
| T & | back () |
| const T & | back () const |
| T & | operator[] (uint32 index) |
| get a reference on an attribute instance | |
| const T & | operator[] (uint32 index) const |
| get a const reference on an attribute instance | |
Iterator / enumeration | |
| const_iterator | begin (void) const |
| Get a const_iterator at the beginning of the container. | |
| iterator | begin (void) |
| Get an iterator at the beginning of the container. | |
| const_iterator | end (void) const |
| Get a const_iterator at the end of the container. | |
| iterator | end (void) |
| Get an iterator at the end of the container. | |
Add / remove methods | |
| void | clear (void) |
| clear the container | |
| sint32 | insert (const T &t=T()) |
| void | remove (uint32 index) |
| remove an object from the tab | |
Object | |
| CPSAttrib () | |
| ctor | |
| void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
| Serialization method. | |
Size of the container | |
| uint32 | getMaxSize (void) const |
| return the max number of instance in the container | |
| uint32 | getSize (void) const |
| return the number of instance in the container | |
| void | resize (uint32 nbInstances) |
Protected Attributes | |
| uint32 | _MaxSize |
| TContType | _Tab |
|
|||||
|
a const iterator on the datas
Definition at line 291 of file ps_attrib.h. |
|
|||||
|
an iterator on the datas
Definition at line 289 of file ps_attrib.h. |
|
|||||
|
Container used by this class to store its datas. The container type is likely to change depending on memory requirement. Definition at line 283 of file ps_attrib.h. |
|
|||||
|
The type used by the container. Its is the type used to instanciate this template.
Definition at line 286 of file ps_attrib.h. |
|
|||||||||
|
ctor
Definition at line 397 of file ps_attrib.h. References NL3D::CPSAttrib< T >::_MaxSize, and NL3D::DefaultMaxLocatedInstance.
00398 {
00399 _MaxSize = DefaultMaxLocatedInstance;
00400 }
|
|
|||||||||
|
Definition at line 338 of file ps_attrib.h.
00339 {
00340 return _Tab.back();
00341 }
|
|
|||||||||
|
Definition at line 332 of file ps_attrib.h.
00333 {
00334 return _Tab.back();
00335 }
|
|
||||||||||
|
Get a const_iterator at the beginning of the container.
Definition at line 359 of file ps_attrib.h.
00359 { return _Tab.begin(); }
|
|
||||||||||
|
||||||||||
|
clear the container
Definition at line 377 of file ps_attrib.h. Referenced by NL3D::CPSMesh::invalidate().
00378 {
00379 _Tab.clear();
00380 }
|
|
||||||||||
|
Get a const_iterator at the end of the container.
Definition at line 362 of file ps_attrib.h.
00362 { return _Tab.end(); }
|
|
||||||||||
|
Get an iterator at the end of the container.
Definition at line 356 of file ps_attrib.h. Referenced by NL3D::CPSLocated::allocateParametricInfos(), NL3D::GenEmitterPositions(), NL3D::GenEmitterPositionsWithLOD(), NL3D::CPSZoneRectangle::performMotion(), NL3D::CPSZoneCylinder::performMotion(), NL3D::CPSZoneDisc::performMotion(), NL3D::CPSZoneSphere::performMotion(), NL3D::CPSZonePlane::performMotion(), NL3D::CPSLocated::resetCollisionInfo(), NL3D::CPSRibbonBase::resetFromOwner(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZoneSphere::show(), NL3D::CPSZonePlane::show(), NL3D::CPSGravity::show(), NL3D::CPSSphericalEmitter::showTool(), NL3D::CPSLocated::updateLife(), and NL3D::CPSMesh::~CPSMesh().
00356 { return _Tab.end(); }
|
|
||||||||||
|
return the max number of instance in the container
Definition at line 306 of file ps_attrib.h. Referenced by NL3D::CPSLocated::checkIntegrity(), NL3D::CPSZoneDisc::newElement(), NL3D::CPSZoneSphere::newElement(), and NL3D::CPSZonePlane::newElement().
00306 { return _MaxSize; }
|
|
||||||||||
|
return the number of instance in the container
Definition at line 303 of file ps_attrib.h. Referenced by NL3D::CPSLocated::checkIntegrity(), NL3D::CPSZoneSphere::getMatrix(), NL3D::CPSZoneDisc::newElement(), NL3D::CPSZoneSphere::newElement(), NL3D::CPSZonePlane::newElement(), NL3D::CPSMesh::releaseAllRef(), NL3D::CPSZoneDisc::setMatrix(), NL3D::CPSZoneSphere::setMatrix(), NL3D::CPSZonePlane::setMatrix(), and NL3D::CPSEmitter::updateMaxCountVect().
00303 { return _Tab.size(); }
|
|
||||||||||
|
create a new object in the tab. It is append at the end of it
Definition at line 413 of file ps_attrib.h. References NL3D::CPSAttrib< T >::_MaxSize, NL3D::DefaultMaxLocatedInstance, sint32, and t. Referenced by NL3D::CPSZoneCylinder::newElement(), NL3D::CPSZoneDisc::newElement(), NL3D::CPSZoneSphere::newElement(), NL3D::CPSZonePlane::newElement(), NL3D::CPSMesh::newElement(), NL3D::CPSLocated::newElement(), NL3D::CPSEmitter::newElement(), NL3D::CPSLocated::queryCollisionInfo(), NL3D::CPSEmitter::updateMaxCountVect(), and NL3D::CPSMesh::updatePos().
|
|
||||||||||
|
get a reference on an attribute instance
Definition at line 323 of file ps_attrib.h.
|
|
||||||||||
|
get a const reference on an attribute instance
Definition at line 314 of file ps_attrib.h.
|
|
||||||||||
|
remove an object from the tab
Definition at line 425 of file ps_attrib.h. References index, nlassert, and uint32. Referenced by NL3D::CPSZoneCylinder::deleteElement(), NL3D::CPSZoneDisc::deleteElement(), NL3D::CPSZoneSphere::deleteElement(), NL3D::CPSZonePlane::deleteElement(), NL3D::CPSMesh::deleteElement(), NL3D::CPSLocated::deleteElement(), NL3D::CPSEmitter::deleteElement(), and NL3D::CPSEmitter::updateMaxCountVect().
|
|
||||||||||
|
Resize the attributes tab. This tells what is the max number of element in this tab, but don't add elements. The behaviour is much like std::vector::reserve Definition at line 404 of file ps_attrib.h. References NL3D::CPSAttrib< T >::_MaxSize, nlassert, and uint32. Referenced by NL3D::CPSLocated::queryCollisionInfo(), NL3D::CPSZoneCylinder::resize(), NL3D::CPSZoneDisc::resize(), NL3D::CPSZoneSphere::resize(), NL3D::CPSZonePlane::resize(), NL3D::CPSMesh::resize(), NL3D::CPSLocated::resize(), NL3D::CPSEmitter::resize(), and NL3D::CPSEmitter::updateMaxCountVect().
|
|
||||||||||
|
Serialization method.
Definition at line 438 of file ps_attrib.h. References NLMISC::IStream::isReading(), nlassert, NLMISC::IStream::serial(), NLMISC::IStream::serialVersion(), sint, size, uint, and uint32.
00439 {
00440 // version 4 to 5 => bug with size being > capacity
00441 sint ver = f.serialVersion(5);
00442
00443 // in the first version, size was duplicated, we were using a std::vector ...
00444 if (ver == 1)
00445 {
00446 if(f.isReading())
00447 {
00448 uint32 size;
00449 f.serial(size);
00450 f.serial(_MaxSize);
00451 _Tab.reserve(_MaxSize);
00452 f.serial(size); // useless but, we were previously doing a serialCont... compatibility purpose only
00453 T tmp;
00454 // Read the vector
00455 for(uint i = 0; i < size; i++)
00456 {
00457 f.serial(tmp);
00458 _Tab.push_back(tmp);
00459 }
00460 nlassert(_Tab.size() == size);
00461 }
00462 else
00463 {
00464 uint32 size = _Tab.size();
00465 f.serial(size);
00466 f.serial(_MaxSize);
00467 f.serial(size);
00468 // write the vector
00469 for(uint i = 0; i < size; i++)
00470 {
00471 f.serial(_Tab[i]);
00472 }
00473 }
00474 }
00475
00476 if (ver == 2) // this version didn't work well, it relied on the capacity of the container to store the max number of instances
00477 {
00478 nlassert(0);
00479 /* f.serial(_Tab);
00480 if (f.isReading())
00481 {
00482 _MaxSize = _Tab.capacity();
00483 }*/
00484 }
00485
00486 if (ver >= 3)
00487 {
00488 f.serial(_MaxSize);
00489 _Tab.reserve(_MaxSize);
00490 //f.serial(_Tab);
00491
00492
00493 if (f.isReading())
00494 {
00495 _Tab.clear();
00496 uint32 size, maxsize;
00497 if (ver == 3)
00498 {
00499 f.serial(size, maxsize);
00500 //_Tab.reserve(maxsize);
00501 }
00502 else
00503 {
00504 f.serial(size);
00505 maxsize = _MaxSize;
00506 }
00507 if (ver > 4)
00508 {
00509 _Tab.resize(size);
00510 for (uint k = 0; k < size; ++k)
00511 {
00512 f.serial(_Tab[k]);
00513 }
00514 }
00515 else
00516 {
00517 // bug for version 4: size may be > maxsize
00518 if (size <= maxsize)
00519 {
00520 // ok, no bug
00521 _Tab.resize(size);
00522 for (uint k = 0; k < size; ++k)
00523 {
00524 f.serial(_Tab[k]);
00525 }
00526 }
00527 else
00528 {
00529 // size > maxsize, not good ..!
00530 _Tab.resize(maxsize);
00531 uint k;
00532 for (k = 0; k < maxsize; ++k)
00533 {
00534 f.serial(_Tab[k]);
00535 }
00536 T dummy;
00537 for (; k < size; ++k)
00538 {
00539 f.serial(dummy);
00540 }
00541 }
00542 }
00543 }
00544 else
00545 {
00546 uint32 size = _Tab.size(), capacity = _Tab.capacity();
00547 if (ver == 3)
00548 {
00549 f.serial(size, capacity);
00550 }
00551 else
00552 {
00553 f.serial(size);
00554 }
00555 for (uint k = 0; k < size; ++k)
00556 {
00557 f.serial(_Tab[k]);
00558 }
00559 }
00560 }
00561 }
|
|
|||||
|
Definition at line 385 of file ps_attrib.h. Referenced by NL3D::CPSAttrib< T >::CPSAttrib(), NL3D::CPSAttrib< T >::insert(), and NL3D::CPSAttrib< T >::resize(). |
|
|||||
|
Definition at line 384 of file ps_attrib.h. |
1.3.6