CircularVector< Contained > Class Template Reference

List of all members.

Classes

class  Incrementor

Public Types

typedef Incrementor< Contained > Iterator
typedef Incrementor< const
Contained > 
ConstIterator

Public Member Functions

void print (Iterator begin, Iterator end)
 CircularVector ()
Iterator begin ()
ConstIterator begin () const
Iterator end ()
ConstIterator end () const
void pushFront (const Contained &contained)
void pushBack (const Contained &contained)
Contained & operator[] (unsigned int i)
void popBack ()
void popFront ()
Contained & front () const
Contained & back () const
unsigned int size () const
unsigned int capacity () const
bool isEmpty () const
void remove (const Contained &contained)

Protected Member Functions

void inc (int &toIncrement, int n)
void enlarge ()
void minimize ()

Protected Attributes

Contained * _elements
unsigned int _size
unsigned int _capacity
int _begin
int _end

Friends

struct Incrementor< Contained >
struct Incrementor< const Contained >


Detailed Description

template<class Contained>
class CircularVector< Contained >

This class is a generic CircularVector implementation that uses dynamically allocated memory representation with adaptable behaviour
Author:
G06

Definition at line 18 of file ep_cvec.h.


Constructor & Destructor Documentation

template<class Contained>
CircularVector< Contained >::CircularVector (  )  [inline]

Default constructor

Definition at line 129 of file ep_cvec.h.


Member Function Documentation

template<class Contained>
Contained& CircularVector< Contained >::back (  )  const [inline]

Returns the CircularVector last Contained reference

Returns:
a reference to the last Contained

Definition at line 231 of file ep_cvec.h.

template<class Contained>
ConstIterator CircularVector< Contained >::begin (  )  const [inline]

Gets a iterator that iterates over const Contained values

Returns:
a ConstIterator that iterates over the CircularVector instance first element

Definition at line 149 of file ep_cvec.h.

template<class Contained>
Iterator CircularVector< Contained >::begin (  )  [inline]

Gets a iterator that iterates over const Contained values

Returns:
a ConstIterator that iterates over the CircularVector instance first element

Definition at line 141 of file ep_cvec.h.

template<class Contained>
unsigned int CircularVector< Contained >::capacity (  )  const [inline]

Returns the current CircularVector instance capacity

Returns:
a unsigned int that is the current maximum number of elements in the CircularVector

Definition at line 247 of file ep_cvec.h.

template<class Contained>
ConstIterator CircularVector< Contained >::end (  )  const [inline]

Gets a iterator that iterates over const Contained values

Returns:
a ConstIterator that iterates over the CircularVector instance end (garbage)

Definition at line 165 of file ep_cvec.h.

template<class Contained>
Iterator CircularVector< Contained >::end (  )  [inline]

Gets a iterator that iterates over const Contained values

Returns:
a ConstIterator that iterates over the CircularVector instance end (garbage)

Definition at line 157 of file ep_cvec.h.

template<class Contained>
void CircularVector< Contained >::enlarge (  )  [inline, protected]

Method that enlarges the CircularVector by the CircularVector adaption rate constant

Definition at line 298 of file ep_cvec.h.

template<class Contained>
Contained& CircularVector< Contained >::front (  )  const [inline]

Returns the CircularVector first Contained reference

Returns:
a reference to the first Contained

Definition at line 223 of file ep_cvec.h.

template<class Contained>
void CircularVector< Contained >::inc ( int &  toIncrement,
int  n 
) [inline, protected]

Increments ciruclarly the passed int

Parameters:
toIncrement the integer that will be incremented
n the reference size

Definition at line 290 of file ep_cvec.h.

template<class Contained>
bool CircularVector< Contained >::isEmpty (  )  const [inline]

Gets whether the CircularVector is empty or not

Returns:
true if the CircularVector is empty and false otherwise

Definition at line 255 of file ep_cvec.h.

template<class Contained>
void CircularVector< Contained >::minimize (  )  [inline, protected]

Method that minimizes the CircularVector by the CircularVector adaption rate constant. Currently inoperant

Definition at line 316 of file ep_cvec.h.

template<class Contained>
void CircularVector< Contained >::popBack (  )  [inline]

Removes the last element of the CircularVector instance

Definition at line 202 of file ep_cvec.h.

template<class Contained>
void CircularVector< Contained >::popFront (  )  [inline]

Removes the first element of the CircularVector instance

Definition at line 212 of file ep_cvec.h.

template<class Contained>
void CircularVector< Contained >::print ( Iterator  begin,
Iterator  end 
) [inline]

Auxiliar print method that shows the internal values of each Contained

Definition at line 118 of file ep_cvec.h.

template<class Contained>
void CircularVector< Contained >::pushBack ( const Contained &  contained  )  [inline]

Inserts the Contained type in the last position of the Vector

Parameters:
contained the object to be inserted

Definition at line 186 of file ep_cvec.h.

template<class Contained>
void CircularVector< Contained >::pushFront ( const Contained &  contained  )  [inline]

Inserts the Contained type in the first position of the Vector

Parameters:
contained the object to be inserted

Definition at line 173 of file ep_cvec.h.

template<class Contained>
void CircularVector< Contained >::remove ( const Contained &  contained  )  [inline]

O(n) remove that iterates over the array elements till it finds the Contained to be removed. Nothing happens if the passed object doesn't exists in the CircularVector instance

Parameters:
contained the Contained to be removed

Definition at line 264 of file ep_cvec.h.

template<class Contained>
unsigned int CircularVector< Contained >::size (  )  const [inline]

Returns the current CircularVector instance size

Returns:
a unsigned int that is the number of elements in the CircularVector

Definition at line 239 of file ep_cvec.h.


Member Data Documentation

template<class Contained>
int CircularVector< Contained >::_begin [protected]

Begin and end pointers

Definition at line 283 of file ep_cvec.h.

template<class Contained>
Contained* CircularVector< Contained >::_elements [protected]

Dynamically allocated array of Contained

Definition at line 278 of file ep_cvec.h.


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

Generated on Mon May 4 09:42:22 2009 for EPOS-- by  doxygen 1.5.8