tReferenceHolder< T > Class Template Reference

#include <tReferenceHolder.h>

Collaboration diagram for tReferenceHolder< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void ReleaseAll ()
void Add (T *obj)
void Remove (T *obj)

Private Attributes

tArray< tControlledPTR< T > > references_


Detailed Description

template<class T>
class tReferenceHolder< T >

Definition at line 34 of file tReferenceHolder.h.


Member Function Documentation

template<class T>
void tReferenceHolder< T >::ReleaseAll (  )  [inline]

Definition at line 39 of file tReferenceHolder.h.

References GrowingArrayBase::Len(), NULL, tReferenceHolder< T >::references_, and tArray< T, MALLOC >::SetLen().

Referenced by gAIPlayer::ClearAll().

00040     {
00041         for ( int i = references_.Len()-1; i >= 0; --i )
00042         {
00043             references_[i] = NULL;
00044         }
00045 
00046         references_.SetLen( 0 );
00047     }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
void tReferenceHolder< T >::Add ( T *  obj  )  [inline]

Definition at line 49 of file tReferenceHolder.h.

References GrowingArrayBase::Len(), and tReferenceHolder< T >::references_.

Referenced by gAITeam::BalanceWithAIs(), and gAIPlayer::SetNumberOfAIs().

00050     {
00051         for ( int i = references_.Len()-1; i >= 0; --i )
00052         {
00053             if ( references_[i] == obj )
00054             {
00055                 return;
00056             }
00057         }
00058 
00059         references_[ references_.Len() ] = obj;
00060     }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
void tReferenceHolder< T >::Remove ( T *  obj  )  [inline]

Definition at line 62 of file tReferenceHolder.h.

References GrowingArrayBase::Len(), NULL, tReferenceHolder< T >::references_, and tArray< T, MALLOC >::SetLen().

Referenced by gAITeam::BalanceWithAIs(), and gAIPlayer::SetNumberOfAIs().

00063     {
00064         int iLast = references_.Len()-1;
00065         for ( int i = iLast; i >= 0; --i )
00066         {
00067             if ( references_[ i ] == obj )
00068             {
00069                 references_[ i ] = references_[ iLast ];
00070                 references_[ iLast ] = NULL;
00071                 references_.SetLen( iLast );
00072             }
00073         }
00074     }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

template<class T>
tArray< tControlledPTR< T > > tReferenceHolder< T >::references_ [private]

Definition at line 36 of file tReferenceHolder.h.

Referenced by tReferenceHolder< T >::Add(), tReferenceHolder< T >::ReleaseAll(), and tReferenceHolder< T >::Remove().


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:58:58 2008 for Armagetron Advanced by  doxygen 1.5.4