V-Gears 0
Free Final Fantasy VII engine.
ParticlePoolMap< T > Class Template Reference

A particle pool map. More...

#include <ParticlePoolMap.h>

Public Types

typedef std::multimap< Ogre::String, T * > PoolMapMap
 
typedef PoolMapMap::iterator PoolMapIterator
 

Public Member Functions

 ParticlePoolMap ()
 Constructor. More...
 
virtual ~ParticlePoolMap ()
 Destructor. More...
 
bool IsEmpty ()
 Checks if the pool map is empty. More...
 
size_t GetSize ()
 Retrieves the pool map size. More...
 
void ResetIterator ()
 Resets the pool iterator. More...
 
T * GetFirst ()
 Retrieves the first particle. More...
 
T * GetNext ()
 Retrieves the next particle in the pool map. More...
 
bool End ()
 Checks if the iterator is at the end of the pool map. More...
 
void Clear ()
 Removes all particles. More...
 
void AddElement (const Ogre::String &key, T *element)
 Adds a particle to the pool map. More...
 
T * ReleaseElement (const Ogre::String &key)
 Releases a locked particle. More...
 
void ReleaseAllElements ()
 Releases all locked particles. More...
 
void LockLatestElement ()
 Locks the released particle pointed by the iterator. More...
 
void LockAllElements ()
 Locks all particles. More...
 

Protected Attributes

PoolMapMap released_
 List with released particles. More...
 
PoolMapMap locked_
 List with locked particles. More...
 
PoolMapIterator pool_map_iterator_
 The pool map iterator. More...
 

Detailed Description

template<typename T>
class ParticlePoolMap< T >

A particle pool map.

Template Parameters
TThe type of particle.

Member Typedef Documentation

◆ PoolMapIterator

template<typename T >
typedef PoolMapMap::iterator ParticlePoolMap< T >::PoolMapIterator

◆ PoolMapMap

template<typename T >
typedef std::multimap<Ogre::String, T*> ParticlePoolMap< T >::PoolMapMap

Constructor & Destructor Documentation

◆ ParticlePoolMap()

template<typename T >
ParticlePoolMap< T >::ParticlePoolMap ( )
inline

Constructor.

◆ ~ParticlePoolMap()

template<typename T >
virtual ParticlePoolMap< T >::~ParticlePoolMap ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ AddElement()

template<typename T >
void ParticlePoolMap< T >::AddElement ( const Ogre::String &  key,
T *  element 
)
inline

Adds a particle to the pool map.

A particle is added in locked state.

Parameters
[in]keyPArticle key in the map.
[in]elementParticle to add to the pool.

◆ Clear()

template<typename T >
void ParticlePoolMap< T >::Clear ( )
inline

Removes all particles.

Removes both locked and released particles.

◆ End()

template<typename T >
bool ParticlePoolMap< T >::End ( )
inline

Checks if the iterator is at the end of the pool map.

If it's at the end, {

See also
GetNext} will return null when called. It doesn't consider locked particles, only the released ones.
Returns
True if the iterator is at the end of the pool map.

◆ GetFirst()

template<typename T >
T * ParticlePoolMap< T >::GetFirst ( )
inline

Retrieves the first particle.

Before doing so, it resets the pool map iterator. It doesn't consider locked particles, only the released ones.

Returns
A reference to the first particle in the pool map. NULL if the pool map is empty.

◆ GetNext()

template<typename T >
T * ParticlePoolMap< T >::GetNext ( )
inline

Retrieves the next particle in the pool map.

Before doing so, it advances the pool map iterator. It doesn't consider locked particles, only the released ones.

Returns
A reference to the next particle in the pool map. NULL if the pool map is empty or the iterator is at the end of it.

◆ GetSize()

template<typename T >
size_t ParticlePoolMap< T >::GetSize ( )
inline

Retrieves the pool map size.

It doesn't consider locked particles, only the released ones.

Returns
The number of particles in the pool.

◆ IsEmpty()

template<typename T >
bool ParticlePoolMap< T >::IsEmpty ( )
inline

Checks if the pool map is empty.

It doesn't consider locked particles, only the released ones.

Returns
True if the pool is empty, false if there is at least one particle in the pool.

◆ LockAllElements()

template<typename T >
void ParticlePoolMap< T >::LockAllElements ( )
inline

Locks all particles.

The particles get added at the end of the locked list in the same order they were in the released list. The pool iterator is reseted.

◆ LockLatestElement()

template<typename T >
void ParticlePoolMap< T >::LockLatestElement ( )
inline

Locks the released particle pointed by the iterator.

The particle gets added to the end of the locked particle list.

◆ ReleaseAllElements()

template<typename T >
void ParticlePoolMap< T >::ReleaseAllElements ( )
inline

Releases all locked particles.

It also resets the pool map operator.

◆ ReleaseElement()

template<typename T >
T * ParticlePoolMap< T >::ReleaseElement ( const Ogre::String &  key)
inline

Releases a locked particle.

Parameters
[in]keyThe key of the particle to unlock.
Returns
A pointer to the previously locked and now released particle, or 0 if there were no more locked particles.

◆ ResetIterator()

template<typename T >
void ParticlePoolMap< T >::ResetIterator ( )
inline

Resets the pool iterator.

Member Data Documentation

◆ locked_

template<typename T >
PoolMapMap ParticlePoolMap< T >::locked_
protected

List with locked particles.

They can't be operated upon until released.

◆ pool_map_iterator_

template<typename T >
PoolMapIterator ParticlePoolMap< T >::pool_map_iterator_
protected

The pool map iterator.

Determines the current particle to be acted upon. Only works for released particles.

◆ released_

template<typename T >
PoolMapMap ParticlePoolMap< T >::released_
protected

List with released particles.

They can be operated upon.


The documentation for this class was generated from the following file: