base::Array< T > Class Template Reference

Array template class similar to STL vector but checks index and can be Shared. More...

#include <_src_base_array.hh>

Inheritance diagram for base::Array< T >:

base::Shared threads::NonThreadable

List of all members.

Public Types

typedef T Type

Public Member Functions

 Array (void)
 Array (uint count)
 ~Array ()
T * PTR (void) const
const T * CONST_PTR (void) const
T & operator[] (uint i)
const T & operator[] (uint i) const
void push_back (const T &v)
bool empty (void) const
void clear (void)
uint size (void) const
void resize (uint count)
void reserve (uint count)

Private Attributes

vector< T > mVector
CLASS_CONST uint MAX_ELEMS = 20 * MILLION

Friends

bool operator< (const Array &a, const Array &b)


Detailed Description

template<typename T>
class base::Array< T >

Array template class similar to STL vector but checks index and can be Shared.

///
/// Thin wrapper over STL vector which does bounds checking.
/// PTR() returns raw C array.
/// If size of array is pre-determined, for speed,
/// construct and write elements using Array(uint) and operator[] resp.
/// Rules for writing elements:
/// - Must use push_back() if constructed by Array(void).
/// - Writing elements by operator[] allowed if constructed by Array(uint).
///
/// Array currently doesn't but could allocate an extra element to tolerate off-by-one errors.
///
/// 

Member Typedef Documentation

template<typename T>
typedef T base::Array< T >::Type


Constructor & Destructor Documentation

template<typename T>
base::Array< T >::Array ( void   )  [inline]

template<typename T>
base::Array< T >::Array ( uint  count  )  [inline, explicit]

template<typename T>
base::Array< T >::~Array (  )  [inline]


Member Function Documentation

template<typename T>
T* base::Array< T >::PTR ( void   )  const [inline]

Returns:
Raw C array. PTR() IS UNDEFINED IF ARRAY IS EMPTY! Subtlety: &vector[0] is in fact a C array. But &vector is address of STL vector object.

template<typename T>
const T* base::Array< T >::CONST_PTR ( void   )  const [inline]

template<typename T>
T& base::Array< T >::operator[] ( uint  i  )  [inline]

template<typename T>
const T& base::Array< T >::operator[] ( uint  i  )  const [inline]

template<typename T>
void base::Array< T >::push_back ( const T &  v  )  [inline]

template<typename T>
bool base::Array< T >::empty ( void   )  const [inline]

template<typename T>
void base::Array< T >::clear ( void   )  [inline]

template<typename T>
uint base::Array< T >::size ( void   )  const [inline]

template<typename T>
void base::Array< T >::resize ( uint  count  )  [inline]

template<typename T>
void base::Array< T >::reserve ( uint  count  )  [inline]


Friends And Related Function Documentation

template<typename T>
bool operator< ( const Array< T > &  a,
const Array< T > &  b 
) [friend]


Member Data Documentation

template<typename T>
vector<T> base::Array< T >::mVector [private]

template<typename T>
CLASS_CONST uint base::Array< T >::MAX_ELEMS = 20 * MILLION [private]


The documentation for this class was generated from the following file:
Palomino Flight Simulator documents generated by doxygen 1.5.6 on Tue Sep 28 11:37:49 2010