CArrayT< Titem_, Tblock_size_, Tnum_blocks_ > Class Template Reference

Flexible array with size limit. More...

#include <array.hpp>


Public Types

typedef Titem_ Titem
 Titem is now visible from outside.
typedef CFixedSizeArrayT
< Titem_, Tblock_size_ > 
CSubArray
 inner array
typedef CFixedSizeArrayT
< CSubArray, Tnum_blocks_ > 
CSuperArray
 outer array

Public Member Functions

FORCEINLINE CArrayT ()
 implicit constructor
FORCEINLINE void Clear ()
 Clear (destroy) all items.
FORCEINLINE int Size () const
 Return actual number of items.
FORCEINLINE bool IsEmpty ()
 return true if array is empty
FORCEINLINE bool IsFull ()
 return true if array is full
FORCEINLINE CSubArrayFirstFreeSubArray ()
 return first sub-array with free space for new item
FORCEINLINE Titem_ & AddNC ()
 allocate but not construct new item
FORCEINLINE Titem_ & Add ()
 allocate and construct new item
FORCEINLINE Titemoperator[] (int idx)
 indexed access (non-const)
FORCEINLINE const Titemoperator[] (int idx) const
 indexed access (const)
template<typename D>
void Dump (D &dmp) const

Static Public Attributes

static const int Tblock_size = Tblock_size_
 block size is now visible from outside
static const int Tnum_blocks = Tnum_blocks_
 number of blocks is now visible from outside
static const int Tcapacity = Tblock_size * Tnum_blocks
 total max number of items

Protected Attributes

CSuperArray m_a
 array of arrays of items


Detailed Description

template<class Titem_, int Tblock_size_ = 1024, int Tnum_blocks_ = Tblock_size_>
class CArrayT< Titem_, Tblock_size_, Tnum_blocks_ >

Flexible array with size limit.

Implemented as fixed size array of fixed size arrays

Definition at line 13 of file array.hpp.


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

Generated on Fri Jul 31 22:33:37 2009 for OpenTTD by  doxygen 1.5.6