AVRCpp::Collection::StaticArray< DataType, SizeType, array_capacity > Class Template Reference

#include <StaticArray.h>

Inherits AVRCpp::Collection::BaseArray< DataType, SizeType, DataType[array_capacity]>.

List of all members.

Public Member Functions

 StaticArray ()
 Constructor.
bool Resize (const SizeType size, const DataType &values=DataType())
 Resize array to certain length.
bool Add (const DataType &value)
 Add item to the end of array.
bool Insert (const DataType &value, const SizeType pos)
 Insert item to the pos.
bool Remove (const SizeType pos)
 Remove item at pos.
SizeType GetCapacity (void)
 Return array capacity.
bool IsFull (void)
 Return whether the array is full or not.
SizeType GetSize (void)
 Return array size.
bool IsEmpty (void)
 Return whether the array is empty or not.
bool Clear ()
 Clear array.
DataType & At (SizeTypepos)
 Return reference of item at specified position NB! For speed purposes does not check constraints!

Protected Attributes

DataType data
SizeType current_size


Detailed Description

template<typename DataType, typename SizeType, SizeType array_capacity>
class AVRCpp::Collection::StaticArray< DataType, SizeType, array_capacity >

Definition at line 54 of file StaticArray.h.


Constructor & Destructor Documentation

template<typename DataType, typename SizeType, SizeType array_capacity>
AVRCpp::Collection::StaticArray< DataType, SizeType, array_capacity >::StaticArray (  )  [inline]

Constructor.

Definition at line 61 of file StaticArray.h.

00062                 {                       
00063                         BaseArray<DataType, SizeType, DataType[array_capacity]>();
00064                 }


Member Function Documentation

template<typename DataType, typename SizeType, SizeType array_capacity>
bool AVRCpp::Collection::StaticArray< DataType, SizeType, array_capacity >::Resize ( const SizeType  size,
const DataType &  values = DataType() 
) [inline]

Resize array to certain length.

Reimplemented from AVRCpp::Collection::BaseArray< DataType, SizeType, DataType[array_capacity]>.

Definition at line 69 of file StaticArray.h.

00070                 {
00071                         // If new size is larger than maximum capacity then abort
00072                         if (size >= array_capacity) return false;
00073 
00074                         return BaseArray<DataType, SizeType, DataType[array_capacity]>::Resize(size, values);
00075                 }

template<typename DataType, typename SizeType, SizeType array_capacity>
bool AVRCpp::Collection::StaticArray< DataType, SizeType, array_capacity >::Add ( const DataType &  value  )  [inline]

Add item to the end of array.

Reimplemented from AVRCpp::Collection::BaseArray< DataType, SizeType, DataType[array_capacity]>.

Definition at line 80 of file StaticArray.h.

00081                 {
00082                         // If new size is larger than maximum capacity then abort
00083                         if (this->current_size >= array_capacity) return false;
00084 
00085                         return BaseArray<DataType, SizeType, DataType[array_capacity]>::Add(value);
00086                 }

template<typename DataType, typename SizeType, SizeType array_capacity>
bool AVRCpp::Collection::StaticArray< DataType, SizeType, array_capacity >::Insert ( const DataType &  value,
const SizeType  pos 
) [inline]

Insert item to the pos.

Reimplemented from AVRCpp::Collection::BaseArray< DataType, SizeType, DataType[array_capacity]>.

Definition at line 91 of file StaticArray.h.

00092                 {
00093                         // If new size is larger than maximum capacity then abort
00094                         if (this->current_size >= array_capacity) return false;
00095 
00096                         // Check constraints
00097                         if (pos > this->current_size) return false;
00098 
00099                         return BaseArray<DataType, SizeType, DataType[array_capacity]>::Insert(value, pos);
00100                 }

template<typename DataType, typename SizeType, SizeType array_capacity>
bool AVRCpp::Collection::StaticArray< DataType, SizeType, array_capacity >::Remove ( const SizeType  pos  )  [inline]

Remove item at pos.

Reimplemented from AVRCpp::Collection::BaseArray< DataType, SizeType, DataType[array_capacity]>.

Definition at line 105 of file StaticArray.h.

template<typename DataType, typename SizeType, SizeType array_capacity>
SizeType AVRCpp::Collection::StaticArray< DataType, SizeType, array_capacity >::GetCapacity ( void   )  [inline]

Return array capacity.

Definition at line 113 of file StaticArray.h.

00114                 {
00115                         return array_capacity;
00116                 }

template<typename DataType, typename SizeType, SizeType array_capacity>
bool AVRCpp::Collection::StaticArray< DataType, SizeType, array_capacity >::IsFull ( void   )  [inline]

Return whether the array is full or not.

Definition at line 121 of file StaticArray.h.

00122                 {
00123                         return (this->current_size == array_capacity);
00124                 }

SizeType AVRCpp::Collection::BaseArray< DataType , SizeType , DataType >::GetSize ( void   )  [inline, inherited]

Return array size.

Definition at line 145 of file BaseArray.h.

00146                 {
00147                         return this->current_size;
00148                 }

bool AVRCpp::Collection::BaseArray< DataType , SizeType , DataType >::IsEmpty ( void   )  [inline, inherited]

Return whether the array is empty or not.

Definition at line 153 of file BaseArray.h.

00154                 {
00155                         return (this->current_size == 0);
00156                 }

bool AVRCpp::Collection::BaseArray< DataType , SizeType , DataType >::Clear (  )  [inline, inherited]

Clear array.

Definition at line 161 of file BaseArray.h.

00162                 {
00163                         this->current_size = 0;
00164 
00165                         return true;
00166                 }

DataType & AVRCpp::Collection::BaseArray< DataType , SizeType , DataType >::At ( SizeType   pos  )  [inline, inherited]

Return reference of item at specified position NB! For speed purposes does not check constraints!

Definition at line 172 of file BaseArray.h.

00173                 {
00174                         return this->data[pos];
00175                 }


Member Data Documentation

DataType AVRCpp::Collection::BaseArray< DataType , SizeType , DataType >::data [protected, inherited]

Definition at line 55 of file BaseArray.h.

SizeType AVRCpp::Collection::BaseArray< DataType , SizeType , DataType >::current_size [protected, inherited]

Definition at line 56 of file BaseArray.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 15 23:41:48 2007 for AVR C++ Lib (common) by  doxygen 1.5.2
SourceForge.net Logo MTÜ TTÜ Robotiklubi