tList< T, MALLOC, REFERENCE > Class Template Reference

#include <tList.h>

Inheritance diagram for tList< T, MALLOC, REFERENCE >:

Inheritance graph
[legend]
Collaboration diagram for tList< T, MALLOC, REFERENCE >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~tList ()
 tList (int size=0)
void Add (T *t, int &idnum)
void Add (T *t)
void Remove (T *t, int &idref)
void Remove (T *t)

Private Attributes

int offset


Detailed Description

template<class T, bool MALLOC = false, bool REFERENCE = false>
class tList< T, MALLOC, REFERENCE >

Definition at line 92 of file tList.h.


Constructor & Destructor Documentation

template<class T, bool MALLOC = false, bool REFERENCE = false>
tList< T, MALLOC, REFERENCE >::~tList (  )  [inline]

Definition at line 99 of file tList.h.

00099             {
00100         for(int i=this->Len()-1;i>=0;i--)
00101             (reinterpret_cast<int *>((*this)(i)))[offset]=-1;
00102     }

template<class T, bool MALLOC = false, bool REFERENCE = false>
tList< T, MALLOC, REFERENCE >::tList ( int  size = 0  )  [inline]

Definition at line 104 of file tList.h.


Member Function Documentation

template<class T, bool MALLOC = false, bool REFERENCE = false>
void tList< T, MALLOC, REFERENCE >::Add ( T *  t,
int &  idnum 
) [inline]

Definition at line 106 of file tList.h.

Referenced by tList< uSelectItem< Vote > >::Add(), nBandwidthSceduler::AddArbitrator(), eGrid::AddEdge(), eGrid::AddFace(), eGrid::AddGameObjectInactive(), eGrid::AddGameObjectInteresting(), uMenu::AddItem(), eTeam::AddPlayer(), eTeam::AddPlayerDirty(), eGrid::AddPoint(), tMemManager::Alloc(), eTeam::Enforce(), ePlayerNetID::ePlayerNetID(), eWallRim::eWallRim(), gStatList::getPlaceInList(), eVoter::GetVoter(), gExplosion::gExplosion(), tMemManager::Insert(), eSoundPlayer::MakeGlobal(), memblock::memblock(), gNetPlayerWall::MyInitAfterCreation(), uMenuItemSelection< bool >::NewChoice(), gArena::NewSpawnPoint(), nWaitForAck::nWaitForAck(), rITexture::OnSelect(), nServerInfo::QueryServer(), tStatFile::read(), gNetPlayerWall::real_CopyIntoGrid(), eTeam::RemovePlayerDirty(), eGameObject::RenderAll(), nNetObject::RequestSync(), uMenu::ReverseItems(), tCheckedPTRBase::tCheckedPTRBase(), and uMenuItem::uMenuItem().

00106                              {
00107         offset=&idnum-(reinterpret_cast<int *>(t));
00108 
00109         if (idnum<0){    // tEventQueue relies on the fact that we put t in
00110             idnum=this->Len();   // the last place.
00111             (*this)[idnum]=t;
00112             if ( REFERENCE )
00113             {
00114                 tReferencer< T >::AddReference( t );
00115             }
00116         }
00117     }

Here is the caller graph for this function:

template<class T, bool MALLOC = false, bool REFERENCE = false>
void tList< T, MALLOC, REFERENCE >::Add ( T *  t  )  [inline]

Definition at line 119 of file tList.h.

00120     {
00121         Add( t, t->ListIDRef() );
00122     }

template<class T, bool MALLOC = false, bool REFERENCE = false>
void tList< T, MALLOC, REFERENCE >::Remove ( T *  t,
int &  idref 
) [inline]

Definition at line 124 of file tList.h.

Referenced by uMenuItemSelection< bool >::Clear(), gNetPlayerWall::Clear(), nNetObject::ClearAll(), tMemManager::complete_Dispose(), nServerInfo::DoQueryAll(), nServerInfo::NetReadThis(), gExplosion::OnRemoveFromGame(), gNetPlayerWall::real_CopyIntoGrid(), gNetPlayerWall::ReleaseData(), tMemManager::Remove(), tList< uSelectItem< Vote > >::Remove(), tHeapBase::Remove(), gArena::RemoveAllSpawn(), nBandwidthSceduler::RemoveArbitrator(), eGrid::RemoveEdge(), eGrid::RemoveFace(), eVoter::RemoveFromGame(), eGrid::RemoveGameObjectInactive(), eGrid::RemoveGameObjectInteresting(), uMenu::RemoveItem(), eTeam::RemovePlayerDirty(), eGrid::RemovePoint(), eGameObject::RenderAll(), uMenu::ReverseItems(), nServerInfo::StartQueryAll(), nNetObject::SyncAll(), eTeam::~eTeam(), eVoteItem::~eVoteItem(), eVoter::~eVoter(), eWallRim::~eWallRim(), gArena::~gArena(), gExplosion::~gExplosion(), gStatList::~gStatList(), memblock::~memblock(), nNetObject::~nNetObject(), nServerInfo::~nServerInfo(), rITexture::~rITexture(), tCheckedPTRBase::~tCheckedPTRBase(), and uMenuItem::~uMenuItem().

00125     {
00126         int idnum = idref;
00127         idref = -1;
00128 
00129         // con << "offset=" << offset << '\n';
00130         if ( idnum>=0 ){
00131 #ifdef DEBUG
00132             if (idnum>=this->Len())
00133                 tERR_ERROR_INT("Corrupted list structure!");
00134 
00135             T *test=(*this)(idnum);
00136             if (test!=t)
00137                 tERR_ERROR_INT("Corrupted list structure!");
00138 #endif
00139             // the check for Len() is done, since this may be
00140             // called on an allready descructed list.
00141             if ( this->Len() > idnum+1 )
00142             {
00143                 T *other=(*this)(this->Len()-1);
00144                 tASSERT( other );
00145                 (*this)(idnum)=other;
00146                 int &other_id=(reinterpret_cast<int *>(other))[offset];
00147                 tASSERT( other_id == this->Len()-1 );
00148                 other_id=idnum;
00149             }
00150             (*this)[this->Len()-1] = NULL;
00151 
00152             SetLen(this->Len()-1);
00153 
00154             if ( REFERENCE )
00155             {
00156                 tReferencer< T >::ReleaseReference( t );
00157             }
00158         }
00159 
00160         //              tASSERT( idref == -1 );
00161     }

Here is the caller graph for this function:

template<class T, bool MALLOC = false, bool REFERENCE = false>
void tList< T, MALLOC, REFERENCE >::Remove ( T *  t  )  [inline]

Reimplemented in tHeapBase.

Definition at line 163 of file tList.h.

00164     {
00165         Remove( t, t->ListIDRef() );
00166     }


Member Data Documentation

template<class T, bool MALLOC = false, bool REFERENCE = false>
int tList< T, MALLOC, REFERENCE >::offset [private]

Definition at line 94 of file tList.h.

Referenced by tList< uSelectItem< Vote > >::Add(), tList< uSelectItem< Vote > >::Remove(), and tList< uSelectItem< Vote > >::~tList().


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