#include <tReferenceHolder.h>
Public Member Functions | |
void | ReleaseAll () |
void | Add (T *obj) |
void | Remove (T *obj) |
Private Attributes | |
tArray< tControlledPTR< T > > | references_ |
Definition at line 34 of file tReferenceHolder.h.
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 }
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 }
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 }
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().