OpenTTD
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes
SmallArray< T, B, N > Class Template Reference

Flexible array with size limit. More...

#include <array.hpp>

Public Member Functions

 SmallArray ()
 implicit constructor
void Clear ()
 Clear (destroy) all items.
uint Length () const
 Return actual number of items.
bool IsEmpty ()
 return true if array is empty
bool IsFull ()
 return true if array is full
T * Append ()
 allocate but not construct new item
T * AppendC ()
 allocate and construct new item
T & operator[] (uint index)
 indexed access (non-const)
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

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
dmpThe location to dump to.

Definition at line 106 of file array.hpp.


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