TArrayPtrs< T, size, step > Class Template Reference

This template defines advanced array with variable length. More...

#include <ArrayPtrs.h>

List of all members.

Public Types

typedef const void *typedef
T * 
TPtr
 Pointer to array type.

Public Member Functions

typedef int (__cdecl *cmp_fce)(const void *
 Sorting function sort two items func(a,b): Be carefull - items must be pointers to pointers!!!
 TArrayPtrs (void)
 Constructor.
 ~TArrayPtrs (void)
 Destructor.
 TArrayPtrs (const TArrayPtrs< T, size, step > &orig)
 fake copy constructor
void operator= (const TArrayPtrs< T, size, step > &orig)
 fake assignment operator
DWORD GetItemSize (void) const
 Return size of one item in this array.
void Clear (void)
 Releases this list.
void ClearDeallocOff (void)
 Releases this list.
void ClearWithoutDelete (void)
 Releases this list without calling DELETE on items.
void ReserveSize (const DWORD &newSize)
 Resize array.
DWORD GetSize (void) const
 Returns number of items in list.
DWORD Size (void) const
 Returns number of items in list.
DWORD Count (void) const
 Returns number of items in list.
DWORD GetAllocatedSpace (void) const
 Returns number of allocated items.
void AddItem (T *item)
 Add item at end of list.
void RemoveItem (const DWORD &index)
 Remove item with given index from array.
void RemoveItem (const TPtr item)
 Remove specified item from array.
TPtr RemoveItemWithoutDelete (const TPtr item)
 Remove specified item from array without calling operator delete on it.
void RemoveItemFast (const DWORD &index)
 Remove item with given index from array.
void RemoveItemFast (const TPtr item)
 Remove specified item from array.
TPtr RemoveItemFastWithoutDelete (const TPtr item)
 Remove specified item from array without calling operator delete on it.
void RemoveLastItem (void)
 Remove last item in array.
T * GetItem (const DWORD &index) const
 Gets item on desired index.
T *& GetItemRef (const DWORD &index)
 Gets reference to item on desired index.
const T * GetItemRef (const DWORD &index) const
 Gets reference to item on desired index.
T *& operator[] (const DWORD &index)
 Gets reference to item on desired index.
const T * operator[] (const DWORD &index) const
 Gets reference to item on desired index.
T ** GetArray (void)
 Return pointer to array of items stored in this list!!!
const T ** GetArray (void) const
 Return pointer to array of items stored in this list!!!
BOOL IsItemInside (const TPtr item) const
 Determine whether specified item is inside array.
void Sort (cmp_fce func)
 Sort this list by given sorting function.
void Reverse (void)
 Reverse order of items in array.


Detailed Description

template<class T, unsigned int size = 5, unsigned int step = 5>
class TArrayPtrs< T, size, step >

This template defines advanced array with variable length.

This template must be used ONLY for POINTER types. Destructor automatically calls operator DELETE to any pointers.

If you want not to call DELETE operator please set given item to NULL.

Pointers inside are stored in array which is allocated to sizeof(int).

Definition at line 31 of file ArrayPtrs.h.


Member Typedef Documentation

template<class T, unsigned int size = 5, unsigned int step = 5>
typedef const void* typedef T* TArrayPtrs< T, size, step >::TPtr
 

Pointer to array type.

Definition at line 45 of file ArrayPtrs.h.


Constructor & Destructor Documentation

template<class T, unsigned int size, unsigned int step>
TArrayPtrs< T, size, step >::TArrayPtrs void   ) 
 

Constructor.

Definition at line 118 of file ArrayPtrs.h.

References TMemManager::new_align().

Here is the call graph for this function:

template<class T, unsigned int size, unsigned int step>
TArrayPtrs< T, size, step >::~TArrayPtrs void   ) 
 

Destructor.

Release list. Automatically call DELETE operator on items.

Definition at line 135 of file ArrayPtrs.h.

References TMemManager::free_align().

Here is the call graph for this function:

template<class T, unsigned int size = 5, unsigned int step = 5>
TArrayPtrs< T, size, step >::TArrayPtrs const TArrayPtrs< T, size, step > &  orig  ) 
 

fake copy constructor


Member Function Documentation

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::AddItem T *  item  ) 
 

Add item at end of list.

New item is created via operator=.

Parameters:
item [in] new item to add

Definition at line 265 of file ArrayPtrs.h.

References TArrayPtrs< T, size, step >::ReserveSize().

Referenced by NSConfigFile::TConfigFileSection::Add(), TGraphicTexture::Create(), NSShaders::TPixelShaderManager::DestroyUnreferencedShaders(), NSShaders::TVertexShaderManager::DestroyUnreferencedShaders(), NSMeshes::TDeclarationManager::Initialize(), NSFileSystem::TFSFileSystem::RegisterCabinet(), NSFileSystem::TFSFileSystem::RegisterPath(), and NSFileSystem::TFSFileSystem::TFSFileSystem().

Here is the call graph for this function:

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::Clear void   )  [inline]
 

Releases this list.

Only sets number of items to 0 - memory is still allocated for one pointer!

For all pointers is call operator DELETE.

Definition at line 158 of file ArrayPtrs.h.

References TMemManager::free_align().

Referenced by NSMeshes::TDeclarationManager::Initialize(), and NSXLoader::TXLoader::LoadFile().

Here is the call graph for this function:

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::ClearDeallocOff void   )  [inline]
 

Releases this list.

Only sets number of items to 0! Array of pointers is still allocated.

For all pointers is call operator DELETE.

Definition at line 186 of file ArrayPtrs.h.

Referenced by NSConfigFile::TConfigFile::LoadConfigFile(), and NSConfigFile::TConfigFile::LoadConfigFileFromVFS().

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::ClearWithoutDelete void   )  [inline]
 

Releases this list without calling DELETE on items.

Only sets number of items to 0! Array of pointers is still allocated.

Definition at line 206 of file ArrayPtrs.h.

template<class T, unsigned int size, unsigned int step>
DWORD TArrayPtrs< T, size, step >::Count void   )  const [inline]
 

Returns number of items in list.

Returns:
number of items in list

Definition at line 244 of file ArrayPtrs.h.

Referenced by NSFileSystem::TFSFileSystem::GetRegisteredCabinetCount(), NSFileSystem::TFSFileSystem::GetRegisteredPathCount(), NSFileSystem::TFSCabinetTable::IsFileInCabinet(), and NSConfigFile::TConfigFileSection::WriteToFile().

template<class T, unsigned int size, unsigned int step>
DWORD TArrayPtrs< T, size, step >::GetAllocatedSpace void   )  const [inline]
 

Returns number of allocated items.

Returns:
number of allocated items

Definition at line 254 of file ArrayPtrs.h.

template<class T, unsigned int size, unsigned int step>
const T ** TArrayPtrs< T, size, step >::GetArray void   )  const [inline]
 

Return pointer to array of items stored in this list!!!

Returns:
pointer to array stored in this list.

Definition at line 570 of file ArrayPtrs.h.

template<class T, unsigned int size, unsigned int step>
T ** TArrayPtrs< T, size, step >::GetArray void   )  [inline]
 

Return pointer to array of items stored in this list!!!

Returns:
pointer to array stored in this list.

Definition at line 560 of file ArrayPtrs.h.

template<class T, unsigned int size, unsigned int step>
T * TArrayPtrs< T, size, step >::GetItem const DWORD index  )  const [inline]
 

Gets item on desired index.

Creates new item with copy constructor!!! Please use GetItemRef() or operator=() for reference getting. Index must be in range <0,count-1>!!!!

Parameters:
index [in] index to list
Returns:
item on desired index

Definition at line 488 of file ArrayPtrs.h.

References DBGASSERT.

Referenced by NSXLoader::TXLoader::GetFrame(), NSXLoader::TXLoader::GetFrameByName(), and TGraphicTexture::GetMipMap().

template<class T, unsigned int size, unsigned int step>
const T * TArrayPtrs< T, size, step >::GetItemRef const DWORD index  )  const [inline]
 

Gets reference to item on desired index.

Index must be in range <0,count-1>

Parameters:
index [in] index to list
Returns:
reference to item on desired index

Definition at line 518 of file ArrayPtrs.h.

References DBGASSERT.

template<class T, unsigned int size, unsigned int step>
T *& TArrayPtrs< T, size, step >::GetItemRef const DWORD index  )  [inline]
 

Gets reference to item on desired index.

Index must be in range <0,count-1>

Parameters:
index [in] index to list
Returns:
reference to item on desired index

Definition at line 503 of file ArrayPtrs.h.

References DBGASSERT.

template<class T, unsigned int size, unsigned int step>
DWORD TArrayPtrs< T, size, step >::GetItemSize void   )  const [inline]
 

Return size of one item in this array.

Definition at line 109 of file ArrayPtrs.h.

template<class T, unsigned int size, unsigned int step>
DWORD TArrayPtrs< T, size, step >::GetSize void   )  const [inline]
 

Returns number of items in list.

Returns:
number of items in list

Definition at line 224 of file ArrayPtrs.h.

Referenced by NSShaders::TPixelShaderManager::DestroyUnreferencedShaders(), NSShaders::TVertexShaderManager::DestroyUnreferencedShaders(), NSConfigFile::TConfigFileSection::ExistsItem(), NSXLoader::TXFrame::GetBonesCount(), NSMeshes::TDeclarationManager::GetDeclaration(), NSXLoader::TXLoader::GetFrameByName(), NSXLoader::TXLoader::GetFramesCount(), NSXLoader::TXFrame::GetFramesCount(), NSShaders::TPixelShaderManager::GetPixelShader(), NSConfigFile::TConfigFile::GetSection(), NSConfigFile::TConfigFile::GetSectionCount(), NSConfigFile::TConfigFileSection::GetSize(), TTextureManager::GetTexture(), NSShaders::TPixelShaderManager::GetUnreferencedShaderCount(), NSShaders::TVertexShaderManager::GetUnreferencedShaderCount(), NSConfigFile::TConfigFileSection::GetValue(), NSConfigFile::TConfigFileSection::GetValueAlt(), NSConfigFile::TConfigFileSection::GetValueFromSetOrAlt(), NSShaders::TVertexShaderManager::GetVertexShader(), and NSConfigFile::TConfigFileSection::Remove().

template<class T, unsigned int size = 5, unsigned int step = 5>
typedef TArrayPtrs< T, size, step >::int __cdecl *  cmp_fce  )  const
 

Sorting function sort two items func(a,b): Be carefull - items must be pointers to pointers!!!

	*		< 0		....	a < b
	*		= 0		....	a = b
	*		> 0		....	a > b
	*	

template<class T, unsigned int size, unsigned int step>
BOOL TArrayPtrs< T, size, step >::IsItemInside const TPtr  item  )  const
 

Determine whether specified item is inside array.

Parameters:
item [in] specified item.

Definition at line 580 of file ArrayPtrs.h.

References TRUE.

template<class T, unsigned int size = 5, unsigned int step = 5>
void TArrayPtrs< T, size, step >::operator= const TArrayPtrs< T, size, step > &  orig  ) 
 

fake assignment operator

template<class T, unsigned int size, unsigned int step>
const T * TArrayPtrs< T, size, step >::operator[] const DWORD index  )  const [inline]
 

Gets reference to item on desired index.

Index must be in range <0,count-1>

Parameters:
index [in] index to list
Returns:
reference to item on desired index

Definition at line 548 of file ArrayPtrs.h.

References DBGASSERT.

template<class T, unsigned int size, unsigned int step>
T *& TArrayPtrs< T, size, step >::operator[] const DWORD index  )  [inline]
 

Gets reference to item on desired index.

Index must be in range <0,count-1>

Parameters:
index [in] index to list
Returns:
reference to item on desired index

Definition at line 533 of file ArrayPtrs.h.

References DBGASSERT.

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::RemoveItem const TPtr  item  ) 
 

Remove specified item from array.

Its removed first item with specified address!!! Item is destroyed via operator delete.

Parameters:
item [in] specified item - its pointer (address)

Definition at line 308 of file ArrayPtrs.h.

References FALSE, and TRUE.

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::RemoveItem const DWORD index  ) 
 

Remove item with given index from array.

Item is destroyed via operator delete.

Parameters:
index [in] index of item - must be in range!!!

Definition at line 283 of file ArrayPtrs.h.

References DBGASSERT.

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::RemoveItemFast const TPtr  item  ) 
 

Remove specified item from array.

Its removed first item with specified address!!! Item is destroyed via operator delete.

This method change order of items in array because last item is set to position of removed item.

Parameters:
item [in] specified item - its pointer (address)

Definition at line 402 of file ArrayPtrs.h.

References FALSE, and TRUE.

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::RemoveItemFast const DWORD index  ) 
 

Remove item with given index from array.

This methods change order of items in list!!! Last item is set to deleted item. Item is destroyed via operator delete.

Parameters:
index [in] index of item - must be in range

Definition at line 378 of file ArrayPtrs.h.

References DBGASSERT.

Referenced by NSConfigFile::TConfigFileSection::Remove().

template<class T, unsigned int size, unsigned int step>
T * TArrayPtrs< T, size, step >::RemoveItemFastWithoutDelete const TPtr  item  ) 
 

Remove specified item from array without calling operator delete on it.

Due this reason item is returned. If item is not cointained inside array NULL is returnded.

This method change order of item inside array.

Its removed first item with specified address!!!

Parameters:
item [in] specified item - its pointer (address)

Definition at line 433 of file ArrayPtrs.h.

References FALSE, and TRUE.

template<class T, unsigned int size, unsigned int step>
T * TArrayPtrs< T, size, step >::RemoveItemWithoutDelete const TPtr  item  ) 
 

Remove specified item from array without calling operator delete on it.

Due this reason item is returned. If item is not cointained inside array NULL is returnded.

Its removed first item with specified address!!!

Parameters:
item [in] specified item - its pointer (address)

Definition at line 337 of file ArrayPtrs.h.

References FALSE, and TRUE.

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::RemoveLastItem void   )  [inline]
 

Remove last item in array.

Item is destroyed via operator delete.

Definition at line 468 of file ArrayPtrs.h.

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::ReserveSize const DWORD newSize  ) 
 

Resize array.

Original array items are copy to new array. If size in parameter is less than actual size than new size is set to actual size thus methods do nothing. Items are copy via operator=.

Parameters:
newSize new size of array in number of items

Definition at line 617 of file ArrayPtrs.h.

References TMemManager::new_align().

Referenced by TArrayPtrs< T, size, step >::AddItem(), NSShaders::TPixelShaderManager::DestroyUnreferencedShaders(), and NSShaders::TVertexShaderManager::DestroyUnreferencedShaders().

Here is the call graph for this function:

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::Reverse void   ) 
 

Reverse order of items in array.

Definition at line 642 of file ArrayPtrs.h.

References TMemManager::new_align().

Here is the call graph for this function:

template<class T, unsigned int size, unsigned int step>
DWORD TArrayPtrs< T, size, step >::Size void   )  const [inline]
 

Returns number of items in list.

Returns:
number of items in list

Definition at line 234 of file ArrayPtrs.h.

Referenced by NSMeshes::TMeshManager::DestroyRendererResources(), NSFileSystem::TFSFileSystem::Exists(), NSFileSystem::TFSFileSystem::GetFile(), NSMeshes::TMeshManager::GetMesh(), NSMeshes::TDeclarationManager::Initialize(), and NSMeshes::TMeshManager::LoadRendererResources().

template<class T, unsigned int size, unsigned int step>
void TArrayPtrs< T, size, step >::Sort cmp_fce  func  )  [inline]
 

Sort this list by given sorting function.

Sorting function sort two items func(a,b):

*		< 0		....	a < b
*		= 0		....	a = b
*		> 0		....	a > b
*	

Parameters:
func sorting function

Definition at line 604 of file ArrayPtrs.h.


The documentation for this class was generated from the following file:
Generated on Wed Nov 28 22:41:44 2007 for Joy4D by  doxygen 1.4.6-NO