From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03135.html | 1096 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1096 insertions(+) create mode 100644 docs/doxygen/nel/a03135.html (limited to 'docs/doxygen/nel/a03135.html') diff --git a/docs/doxygen/nel/a03135.html b/docs/doxygen/nel/a03135.html new file mode 100644 index 00000000..be77a6aa --- /dev/null +++ b/docs/doxygen/nel/a03135.html @@ -0,0 +1,1096 @@ + + +NeL: TemplateNL3D::CPSAttrib< T > class Reference + + + +
+

NL3D::CPSAttrib< T > Class Template Reference

#include <ps_attrib.h> +

+


Detailed Description

+

template<typename T>
+ class NL3D::CPSAttrib< T >

+ +This class is intended to store an attribute list in a located or in a located bindable such as speed, color and so on. It is important to remember that a located holds all instance of object of one type (force, emitter, particles or both...).
Author:
Nicolas Vizerie

+Nevrax France

+
Date:
2001
+ +

+ +

+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
+


Member Typedef Documentation

+

+ + + + +
+ + + + + +
+template<typename T>
typedef TContType::const_iterator NL3D::CPSAttrib< T >::const_iterator +
+
+ + + + + +
+   + + +

+a const iterator on the datas +

+ +

+Definition at line 291 of file ps_attrib.h.

+

+ + + + +
+ + + + + +
+template<typename T>
typedef TContType::iterator NL3D::CPSAttrib< T >::iterator +
+
+ + + + + +
+   + + +

+an iterator on the datas +

+ +

+Definition at line 289 of file ps_attrib.h.

+

+ + + + +
+ + + + + +
+template<typename T>
typedef CPSVector<T>::V NL3D::CPSAttrib< T >::TContType +
+
+ + + + + +
+   + + +

+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.

+

+ + + + +
+ + + + + +
+template<typename T>
typedef T NL3D::CPSAttrib< T >::value_type +
+
+ + + + + +
+   + + +

+The type used by the container. Its is the type used to instanciate this template. +

+ +

+Definition at line 286 of file ps_attrib.h.

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + + + +
+template<typename T>
NL3D::CPSAttrib< T >::CPSAttrib  ) 
+
+ + + + + +
+   + + +

+ctor +

+ +

+Definition at line 397 of file ps_attrib.h. +

+References NL3D::CPSAttrib< T >::_MaxSize, and NL3D::DefaultMaxLocatedInstance. +

+

00398 {
+00399         _MaxSize = DefaultMaxLocatedInstance;
+00400 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + +
+template<typename T>
T& NL3D::CPSAttrib< T >::back  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 338 of file ps_attrib.h. +

+

00339                 {
+00340                         return _Tab.back();
+00341                 }
+
+

+ + + + +
+ + + + + + + + + + + + +
+template<typename T>
const T& NL3D::CPSAttrib< T >::back  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 332 of file ps_attrib.h. +

+

00333                 {
+00334                         return _Tab.back();
+00335                 }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
const_iterator NL3D::CPSAttrib< T >::begin void   )  const [inline]
+
+ + + + + +
+   + + +

+Get a const_iterator at the beginning of the container. +

+ +

+Definition at line 359 of file ps_attrib.h. +

+

00359 { return _Tab.begin(); }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
iterator NL3D::CPSAttrib< T >::begin void   )  [inline]
+
+ + + + + +
+   + + +

+Get an iterator at the beginning of the container. +

+ +

+Definition at line 353 of file ps_attrib.h. +

+Referenced by NL3D::CPSLocated::allocateParametricInfos(), NL3D::CPSShockWave::draw(), NL3D::CPSConstraintMesh::draw(), NL3D::CPSFanLight::draw(), NL3D::CPSFaceLookAt::draw(), NL3D::CPSDot::draw(), NL3D::FillQuadCoordsLocalTime(), NL3D::CPSPlaneBasisFollowSpeed::make(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make(), NL3D::CPSPlaneBasisFollowSpeed::make4(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::make4(), NL3D::CPSPlaneBasisFollowSpeed::makeN(), NL3D::CPSAttribMakerT< uint32, CPSValueBlendFunc< uint32 > >::makeN(), NL3D::CPSZoneRectangle::performMotion(), NL3D::CPSZoneCylinder::performMotion(), NL3D::CPSZoneDisc::performMotion(), NL3D::CPSZoneSphere::performMotion(), NL3D::CPSZonePlane::performMotion(), NL3D::CPSLocated::performParametricMotion(), NL3D::CPSEmitter::processRegularEmission(), NL3D::CPSEmitter::processRegularEmissionConsistent(), NL3D::CPSEmitter::processRegularEmissionConsistentWithNoLOD(), NL3D::CPSEmitter::processRegularEmissionWithNoLOD(), 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::CPSSound::step(), NL3D::CPSLocated::step(), NL3D::CPSLight::step(), NL3D::CPSFace::step(), NL3D::CPSRibbonBase::updateGlobals(), NL3D::CPSLocated::updateLife(), NL3D::CPSMesh::updatePos(), and NL3D::CPSMesh::~CPSMesh(). +

+

00353 { return _Tab.begin(); }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
void NL3D::CPSAttrib< T >::clear void   )  [inline]
+
+ + + + + +
+   + + +

+clear the container +

+ +

+Definition at line 377 of file ps_attrib.h. +

+Referenced by NL3D::CPSMesh::invalidate(). +

+

00378                 {
+00379                         _Tab.clear();                   
+00380                 }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
const_iterator NL3D::CPSAttrib< T >::end void   )  const [inline]
+
+ + + + + +
+   + + +

+Get a const_iterator at the end of the container. +

+ +

+Definition at line 362 of file ps_attrib.h. +

+

00362 { return _Tab.end(); }  
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
iterator NL3D::CPSAttrib< T >::end void   )  [inline]
+
+ + + + + +
+   + + +

+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(); }  
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
uint32 NL3D::CPSAttrib< T >::getMaxSize void   )  const [inline]
+
+ + + + + +
+   + + +

+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; }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
uint32 NL3D::CPSAttrib< T >::getSize void   )  const [inline]
+
+ + + + + +
+   + + +

+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(); }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
sint32 NL3D::CPSAttrib< T >::insert const T &  t = T()  ) 
+
+ + + + + +
+   + + +

+create a new object in the tab. It is append at the end of it

Returns:
the index if there were enough room for it or -1 else
+ +

+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(). +

+

00414 {       
+00415         if (_Tab.size() == _MaxSize && _Tab.size() > DefaultMaxLocatedInstance) 
+00416         {
+00417                 return -1;
+00418         }       
+00419         _Tab.push_back(t);
+00420         return _Tab.size() - 1; 
+00421 }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
T& NL3D::CPSAttrib< T >::operator[] uint32  index  )  [inline]
+
+ + + + + +
+   + + +

+get a reference on an attribute instance +

+ +

+Definition at line 323 of file ps_attrib.h. +

+

00324                 { 
+00325                         #ifdef NL_DEBUG
+00326                                 nlassert(index < _Tab.size());
+00327                         #endif
+00328                         return _Tab[index]; 
+00329                 }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
const T& NL3D::CPSAttrib< T >::operator[] uint32  index  )  const [inline]
+
+ + + + + +
+   + + +

+get a const reference on an attribute instance +

+ +

+Definition at line 314 of file ps_attrib.h. +

+

00315                 { 
+00316                         #ifdef NL_DEBUG
+00317                                 nlassert(index < _Tab.size());
+00318                         #endif
+00319                         return _Tab[index]; 
+00320                 }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
void NL3D::CPSAttrib< T >::remove uint32  index  ) 
+
+ + + + + +
+   + + +

+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(). +

+

00426 {       
+00427         nlassert(index < _Tab.size());
+00428         // we copy the last element in place of this one
+00429         if (index != _Tab.size() - 1)
+00430         {
+00431                 _Tab[index] = _Tab[_Tab.size() - 1];
+00432         }
+00433         _Tab.pop_back();
+00434         
+00435 }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
void NL3D::CPSAttrib< T >::resize uint32  nbInstances  ) 
+
+ + + + + +
+   + + +

+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(). +

+

00405 {       
+00406         nlassert(nbInstances < (1 << 16));
+00407         _Tab.reserve(nbInstances);
+00408         _MaxSize = nbInstances;
+00409 }
+
+

+ + + + +
+ + + + + + + + + + + + + +
+template<typename T>
void NL3D::CPSAttrib< T >::serial NLMISC::IStream f  )  throw (NLMISC::EStream)
+
+ + + + + +
+   + + +

+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 }
+
+


Field Documentation

+

+ + + + +
+ + + + + +
+template<typename T>
uint32 NL3D::CPSAttrib< T >::_MaxSize [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 385 of file ps_attrib.h. +

+Referenced by NL3D::CPSAttrib< T >::CPSAttrib(), NL3D::CPSAttrib< T >::insert(), and NL3D::CPSAttrib< T >::resize().

+

+ + + + +
+ + + + + +
+template<typename T>
TContType NL3D::CPSAttrib< T >::_Tab [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 384 of file ps_attrib.h.

+


The documentation for this class was generated from the following file: +
Generated on Tue Mar 16 07:03:13 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1