Public Types | Public Member Functions | Private Attributes

base::TinyArray< COUNT, T > Class Template Reference

Light-weight fixed-length Array class with index-checking. More...

#include <_src_base_array_tiny.hh>

List of all members.

Public Types

typedef T Type

Public Member Functions

 TinyArray (void)
 Template arg count implicitly defines the array's length.
 TinyArray (const T val)
 Construct all elements with the same value.
 TinyArray (const TinyArray< COUNT, T > &src)
 Copy constructor.
 TinyArray (const T src[])
uint GetCount (void) const
void Fill (T val)
 Assign every element the same value.
T & operator[] (uint i)
const T & operator[] (uint i) const
TinyArray< COUNT, T > & operator= (const TinyArray< COUNT, T > &src)
 Amazing that a C++ compiler will accept how this type is written.
bool operator== (const TinyArray< COUNT, T > &src) const
bool operator!= (const TinyArray< COUNT, T > &src) const
bool operator< (const TinyArray< COUNT, T > &src) const
T * PTR (void) const
const T * CONST_PTR (void) const
uint size (void) const
 Limited STL compatibility. Obviously, resize() omitted.
bool empty (void) const

Private Attributes

mArray [COUNT]

Detailed Description

template<uint COUNT, typename T = int>
class base::TinyArray< COUNT, T >

Light-weight fixed-length Array class with index-checking.

Meant for small arrays. Auto-destroys itself. TinyArray is smaller/faster than STL vector but its size is fixed. If instantiated on a function, TinyArray will be stored on call stack. The size of the array is part of TinyArray's type. Tested by base/tests/basic_types.cc.


Member Typedef Documentation

template<uint COUNT, typename T = int>
typedef T base::TinyArray< COUNT, T >::Type

Constructor & Destructor Documentation

template<uint COUNT, typename T = int>
base::TinyArray< COUNT, T >::TinyArray ( void   )  [inline]

Template arg count implicitly defines the array's length.

template<uint COUNT, typename T = int>
base::TinyArray< COUNT, T >::TinyArray ( const T  val  )  [inline, explicit]

Construct all elements with the same value.

template<uint COUNT, typename T = int>
base::TinyArray< COUNT, T >::TinyArray ( const TinyArray< COUNT, T > &  src  )  [inline]

Copy constructor.

template<uint COUNT, typename T = int>
base::TinyArray< COUNT, T >::TinyArray ( const T  src[]  )  [inline]

Member Function Documentation

template<uint COUNT, typename T = int>
const T* base::TinyArray< COUNT, T >::CONST_PTR ( void   )  const [inline]
template<uint COUNT, typename T = int>
bool base::TinyArray< COUNT, T >::empty ( void   )  const [inline]
template<uint COUNT, typename T = int>
void base::TinyArray< COUNT, T >::Fill ( val  )  [inline]

Assign every element the same value.

template<uint COUNT, typename T = int>
uint base::TinyArray< COUNT, T >::GetCount ( void   )  const [inline]
Returns:
Amount of elements.
template<uint COUNT, typename T = int>
bool base::TinyArray< COUNT, T >::operator!= ( const TinyArray< COUNT, T > &  src  )  const [inline]
template<uint COUNT, typename T = int>
bool base::TinyArray< COUNT, T >::operator< ( const TinyArray< COUNT, T > &  src  )  const [inline]
template<uint COUNT, typename T = int>
TinyArray<COUNT,T>& base::TinyArray< COUNT, T >::operator= ( const TinyArray< COUNT, T > &  src  )  [inline]

Amazing that a C++ compiler will accept how this type is written.

template<uint COUNT, typename T = int>
bool base::TinyArray< COUNT, T >::operator== ( const TinyArray< COUNT, T > &  src  )  const [inline]
template<uint COUNT, typename T = int>
const T& base::TinyArray< COUNT, T >::operator[] ( uint  i  )  const [inline]
template<uint COUNT, typename T = int>
T& base::TinyArray< COUNT, T >::operator[] ( uint  i  )  [inline]

Catching access to an uninitialized element would be ideal but there's no way to tell if the element is being read or written.

template<uint COUNT, typename T = int>
T* base::TinyArray< COUNT, T >::PTR ( void   )  const [inline]
template<uint COUNT, typename T = int>
uint base::TinyArray< COUNT, T >::size ( void   )  const [inline]

Limited STL compatibility. Obviously, resize() omitted.


Member Data Documentation

template<uint COUNT, typename T = int>
T base::TinyArray< COUNT, T >::mArray[COUNT] [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Palomino Flight Simulator documents generated by doxygen 1.7.1 on Tue May 15 2012 22:40:10