Queue< Type > Class Template Reference

#include <Queue.h>

List of all members.


Detailed Description

template<typename Type>
class Queue< Type >

Template queue implementation with Lists base.

Public Member Functions

 Queue (int size=DEFAULT_PAGE_SIZE, int PageSize=DEFAULT_PAGE_SIZE)
 Constructor. PageSize is the chunks of memory allocated at run-time as needed. Size is just the inital queuesize if wanted.
 ~Queue ()
 Destructor.
Type Enqueue (Type newData)
 Add an element into the back of the queue.
Type Dequeue ()
 Remove an element from the front and return it. Returns the first element (even if garbage) if out of bounds or empty.
int GetSize ()
 Returns the current size.
bool IsEmpty ()
 Returns true if empty (No elements).

Private Attributes

List< Type > data
 Data.
int front
 Front queue index.
int back
 Back queue index.
int count
 The number of elements of the queue.
int pageSize
 The size of a page of memory in the list (in elements).

Static Private Attributes

static const int DEFAULT_PAGE_SIZE = 16
 Define the default page size.

Constructor & Destructor Documentation

template<typename Type>
Queue< Type >::Queue ( int  size = DEFAULT_PAGE_SIZE,
int  PageSize = DEFAULT_PAGE_SIZE 
) [inline]

Constructor. PageSize is the chunks of memory allocated at run-time as needed. Size is just the inital queuesize if wanted.

template<typename Type>
Queue< Type >::~Queue (  )  [inline]

Destructor.


Member Function Documentation

template<typename Type>
Type Queue< Type >::Enqueue ( Type  newData  )  [inline]

Add an element into the back of the queue.

template<typename Type>
Type Queue< Type >::Dequeue (  )  [inline]

Remove an element from the front and return it. Returns the first element (even if garbage) if out of bounds or empty.

template<typename Type>
int Queue< Type >::GetSize (  )  [inline]

Returns the current size.

template<typename Type>
bool Queue< Type >::IsEmpty (  )  [inline]

Returns true if empty (No elements).


Member Data Documentation

template<typename Type>
const int Queue< Type >::DEFAULT_PAGE_SIZE = 16 [static, private]

Define the default page size.

template<typename Type>
List<Type> Queue< Type >::data [private]

Data.

template<typename Type>
int Queue< Type >::front [private]

Front queue index.

template<typename Type>
int Queue< Type >::back [private]

Back queue index.

template<typename Type>
int Queue< Type >::count [private]

The number of elements of the queue.

template<typename Type>
int Queue< Type >::pageSize [private]

The size of a page of memory in the list (in elements).


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

Generated on Sun Feb 21 00:00:11 2010 for Penn State Robotics Club: Mini Grand Challenge 2010 by  doxygen 1.5.5