Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::Fifo< T > Class Template Reference

#include <Fifo.h>

Inheritance diagram for util::Fifo< T >:

util::List< T > util::Iterator< T > util::Object List of all members.

Detailed Description

template<class T>
class util::Fifo< T >

Fifo is a first-in-first-out buffer built on top of List.

When an element is put on a Fifo, the last element will "pop out". For performance reasons, Fifo is implemented as a circular buffer. For that reason, one might get unexpected results when using List's elementAt method or the [] operator.


Public Methods

 Fifo (int capacity, T initialValue=0)
 Create a new Fifo with the given capacity.

 Fifo (const Fifo &other)
 Copy a Fifo.

 Fifo (const List< T > &other)
 Copy a List.

Fifo & operator= (const Fifo &other)
 Copy a Fifo.

Fifo & operator= (const List< T > &other)
 Copy a List.

put (T value)
 Put a value into a fifo.

void addElement (const T &element)
 Put a value into a fifo.

T & operator[] (int index)
 Get the value at index.

const T & operator[] (int index) const
 Get the value at index.

getElementAt (int index)
T & elementAt (int index)
const T & elementAt (int index) const


Constructor & Destructor Documentation

template<class T>
util::Fifo< T >::Fifo int    capacity,
  initialValue = 0
 

Create a new Fifo with the given capacity.

The contents of the Fifo will be filled with initialValue.


Member Function Documentation

template<class T>
const T& util::Fifo< T >::elementAt int    index const [inline, virtual]
 

See also:
operator[](int)

Reimplemented from util::List< T >.

template<class T>
T& util::Fifo< T >::elementAt int    index [inline, virtual]
 

See also:
operator[](int)

Reimplemented from util::List< T >.

template<class T>
T util::Fifo< T >::getElementAt int    index [inline]
 

See also:
operator[](int)

template<class T>
const T& util::Fifo< T >::operator[] int    index const [inline]
 

Get the value at index.

Const version.

Reimplemented from util::List< T >.

template<class T>
T& util::Fifo< T >::operator[] int    index [inline]
 

Get the value at index.

Use this operator if you want to access the circularly indexed buffer so that index 0 always references the oldest item.

Reimplemented from util::List< T >.

template<class T>
T util::Fifo< T >::put   value
 

Put a value into a fifo.

This will pop out the last value.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.