SmallArray< T, B, N > Class Template Reference

Flexible array with size limit. More...

#include <array.hpp>

Public Member Functions

FORCEINLINE SmallArray ()
 implicit constructor
FORCEINLINE void Clear ()
 Clear (destroy) all items.
FORCEINLINE uint Length () 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 T * Append ()
 allocate but not construct new item
FORCEINLINE T * AppendC ()
 allocate and construct new item
FORCEINLINE T & operator[] (uint index)
 indexed access (non-const)
FORCEINLINE const T & operator[] (uint index) const
 indexed access (const)
template<typename D >
void Dump (D &dmp) const
 Helper for creating a human readable output of this data.

Protected Types

typedef FixedSizeArray< T, B > SubArray
 inner array
typedef FixedSizeArray
< SubArray, N > 
SuperArray
 outer array

Protected Member Functions

FORCEINLINE SubArrayFirstFreeSubArray ()
 return first sub-array with free space for new item

Protected Attributes

SuperArray data
 array of arrays of items

Static Protected Attributes

static const uint Tcapacity = B * N
 total max number of items

Detailed Description

template<class T, uint B = 1024, uint N = B>
class SmallArray< T, B, N >

Flexible array with size limit.

Implemented as fixed size array of fixed size arrays

Definition at line 23 of file array.hpp.


Member Function Documentation

template<class T, uint B = 1024, uint N = B>
template<typename D >
void SmallArray< T, B, N >::Dump ( D &  dmp  )  const [inline]

Helper for creating a human readable output of this data.

Parameters:
dmp The location to dump to.

Definition at line 83 of file array.hpp.


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

Generated on Fri Jun 3 05:20:27 2011 for OpenTTD by  doxygen 1.6.1