PointerRingBuffer< T > Class Template Reference

A RingBuffer for pointers only. <short description="">. More...

#include <PointerRingBuffer.hpp>

List of all members.


Public Member Functions

 PointerRingBuffer (int siz)
 ~PointerRingBuffer ()
 frees the memory of all elements in the RingBuffer
void flushBuffer ()
void put (T &elem, int key)
get (int key)
 returns the element and removes it from the RingBuffer.

Detailed Description

template<class T>
class PointerRingBuffer< T >

A RingBuffer for pointers only. <short description="">.

Would normally be realized as a specialization of RingBuffer but MSVC is too stupid to support this feature

Author:
Peter Schojer
Version:
Id
PointerRingBuffer.hpp,v 1.4 2004/06/07 12:31:40 pschojer Exp

Definition at line 58 of file PointerRingBuffer.hpp.


Member Function Documentation

template<class T>
T PointerRingBuffer< T >::get int  key  )  [inline]
 

returns the element and removes it from the RingBuffer.

Searches form the oldest element to the newest. For optimal performance get Elements in the order you inserted them! Definition at line 118 of file PointerRingBuffer.hpp.

Referenced by IncompleteIO::findAndUnlinkFrame().

00118 { 00119 // endpos always points to the next insert pos 00120 for(int i=startPos;i<endPos;i++) { 00121 if(keys[i%size]==key) { 00122 T dummy=data[i%size]; 00123 data[i%size]=NULL; 00124 keys[i%size]=0; 00125 return dummy; 00126 } 00127 } 00128 return NULL; 00129 };


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