CircularBufferIter< T > Class Template Reference

Iterator over a circular buffer. More...

#include <CircularBuffer.h>

List of all members.

Public Member Functions

 CircularBufferIter (CircularBuffer< T > *pCircularBufferInit)
void reset ()
 Resets the iterator to the initial starting position.
void operator++ ()
 Increments the iterator position.
T & operator * ()
 
Returns:
reference to the entry at the current iterator position

bool end ()
 
Returns:
true if the the iterator is positioned past the end of the buffer

bool done ()
 
Returns:
true if all possible entries in the underlying buffer have been iterated over

uint getCurrPos ()
 
Returns:
current position within the iterator

void setCurrPos (uint pos)
 Sets the current position of the iterator.
void removeFront ()
 Removes the first entry from the underlying circular buffer.

Private Attributes

CircularBuffer< T > * pCircularBuffer
 Underlying circular buffer object.
uint currPos
 Current position of this iterator within the underlying circular buffer.


Detailed Description

template<class T>
class CircularBufferIter< T >

Iterator over a circular buffer.

The iterator starts at the 0th position in the underlying circular buffer and always increases, even as positions in the underlying circular buffer are recycled.

Incrementing this iterator has not affect on the contents of the underlying buffer.

Definition at line 237 of file CircularBuffer.h.


Constructor & Destructor Documentation

template<class T>
CircularBufferIter< T >::CircularBufferIter ( CircularBuffer< T > *  pCircularBufferInit  )  [inline, explicit]

Definition at line 252 of file CircularBuffer.h.

00253     {
00254         pCircularBuffer = pCircularBufferInit;
00255         reset();
00256     }


Member Function Documentation

template<class T>
void CircularBufferIter< T >::reset (  )  [inline]

Resets the iterator to the initial starting position.

Definition at line 261 of file CircularBuffer.h.

Referenced by CircularBufferIter< LcsRidRun >::CircularBufferIter(), LcsRowScanExecStream::open(), and LcsClusterReader::open().

00262     {
00263         currPos = 0;
00264     }

template<class T>
void CircularBufferIter< T >::operator++ (  )  [inline]

Increments the iterator position.

Definition at line 269 of file CircularBuffer.h.

00270     {
00271         assert(!pCircularBuffer->empty());
00272         currPos++;
00273     }

template<class T>
T& CircularBufferIter< T >::operator * (  )  [inline]

Returns:
reference to the entry at the current iterator position

Definition at line 278 of file CircularBuffer.h.

00279     {
00280         assert(!pCircularBuffer->empty());
00281         assert(
00282             currPos >= pCircularBuffer->getFirstPos() &&
00283             currPos <= pCircularBuffer->getLastPos());
00284         return (*pCircularBuffer)[currPos];
00285     }

template<class T>
bool CircularBufferIter< T >::end (  )  [inline]

Returns:
true if the the iterator is positioned past the end of the buffer

Definition at line 291 of file CircularBuffer.h.

Referenced by CircularBufferIter< LcsRidRun >::done(), and LcsClusterReader::getFetchRids().

00292     {
00293         return
00294             (pCircularBuffer->empty() ||
00295                 currPos > pCircularBuffer->getLastPos());
00296     }

template<class T>
bool CircularBufferIter< T >::done (  )  [inline]

Returns:
true if all possible entries in the underlying buffer have been iterated over

Definition at line 302 of file CircularBuffer.h.

Referenced by LcsRowScanExecStream::execute(), and LcsClusterReader::getNextPageForPrefetch().

00303     {
00304         return end() && pCircularBuffer->isReadOnly();
00305     }

template<class T>
uint CircularBufferIter< T >::getCurrPos (  )  [inline]

Returns:
current position within the iterator

Definition at line 310 of file CircularBuffer.h.

Referenced by LcsClusterReader::catchUp(), and LcsRowScanExecStream::execute().

00311     {
00312         return currPos;
00313     }

template<class T>
void CircularBufferIter< T >::setCurrPos ( uint  pos  )  [inline]

Sets the current position of the iterator.

Parameters:
pos the posititon to be set

Definition at line 320 of file CircularBuffer.h.

Referenced by LcsClusterReader::catchUp().

00321     {
00322         currPos = pos;
00323     }

template<class T>
void CircularBufferIter< T >::removeFront (  )  [inline]

Removes the first entry from the underlying circular buffer.

Definition at line 328 of file CircularBuffer.h.

Referenced by LcsClusterReader::getFetchRids().

00329     {
00330         pCircularBuffer->pop_front();
00331     }


Member Data Documentation

template<class T>
CircularBuffer<T>* CircularBufferIter< T >::pCircularBuffer [private]

Underlying circular buffer object.

Definition at line 242 of file CircularBuffer.h.

Referenced by CircularBufferIter< LcsRidRun >::CircularBufferIter(), CircularBufferIter< LcsRidRun >::done(), CircularBufferIter< LcsRidRun >::end(), CircularBufferIter< LcsRidRun >::operator *(), CircularBufferIter< LcsRidRun >::operator++(), and CircularBufferIter< LcsRidRun >::removeFront().

template<class T>
uint CircularBufferIter< T >::currPos [private]

Current position of this iterator within the underlying circular buffer.

Definition at line 248 of file CircularBuffer.h.

Referenced by CircularBufferIter< LcsRidRun >::end(), CircularBufferIter< LcsRidRun >::getCurrPos(), CircularBufferIter< LcsRidRun >::operator *(), CircularBufferIter< LcsRidRun >::operator++(), CircularBufferIter< LcsRidRun >::reset(), and CircularBufferIter< LcsRidRun >::setCurrPos().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:28 2009 for Fennel by  doxygen 1.5.1