UT_RingBuffer< utPtr > Class Template Reference

#include <UT_RingBuffer.h>

List of all members.

Public Member Functions

 UT_RingBuffer ()
 UT_RingBuffer (int capacity)
 ~UT_RingBuffer ()
void insert (int id, utPtr data)
void remove (int id)
utPtr popFirst ()
int push (utPtr data)
void pop ()
 Pop a single element from the start of the buffer.
void pop (int number)
 Pop the next "number" elements from the buffer.
int entries () const
int peakUsage () const
utPtr operator[] (int id) const
utPtr operator() (int id) const
utPtr front () const
int frontId () const
utPtr back () const
int backId () const
void display () const


Detailed Description

template<class utPtr>
class UT_RingBuffer< utPtr >

A UT_RingBuffer is an indexable queue. The buffer uses indices that represent the insertion order of items in the buffer. The buffer may contain "holes", which have no associated data but still have an order number.

Definition at line 30 of file UT_RingBuffer.h.


Constructor & Destructor Documentation

template<class utPtr >
UT_RingBuffer< utPtr >::UT_RingBuffer (  )  [inline]

Definition at line 32 of file UT_RingBuffer.h.

template<class utPtr >
UT_RingBuffer< utPtr >::UT_RingBuffer ( int  capacity  )  [inline]

Definition at line 33 of file UT_RingBuffer.h.

template<class utPtr >
UT_RingBuffer< utPtr >::~UT_RingBuffer (  )  [inline]

Definition at line 34 of file UT_RingBuffer.h.


Member Function Documentation

template<class utPtr >
utPtr UT_RingBuffer< utPtr >::back (  )  const [inline]

Definition at line 76 of file UT_RingBuffer.h.

template<class utPtr >
int UT_RingBuffer< utPtr >::backId (  )  const [inline]

Definition at line 77 of file UT_RingBuffer.h.

template<class utPtr >
void UT_RingBuffer< utPtr >::display (  )  const [inline]

Definition at line 79 of file UT_RingBuffer.h.

template<class utPtr >
int UT_RingBuffer< utPtr >::entries ( void   )  const [inline]

Definition at line 61 of file UT_RingBuffer.h.

template<class utPtr >
utPtr UT_RingBuffer< utPtr >::front (  )  const [inline]

In order to iterate over the contents of the ring buffer for (i = rbuf.frontId(); i <= rbuf.backId(); i++) element = rbuf(i); The backId is *inclusive*!!! There shouldn't be holes in the array.

Definition at line 74 of file UT_RingBuffer.h.

template<class utPtr >
int UT_RingBuffer< utPtr >::frontId (  )  const [inline]

Definition at line 75 of file UT_RingBuffer.h.

template<class utPtr >
void UT_RingBuffer< utPtr >::insert ( int  id,
utPtr  data 
) [inline]

Null-padded insertion. If the id of the incoming object is greater than the next order number that would be assigned by push(), holes are created in the buffer.

Definition at line 39 of file UT_RingBuffer.h.

template<class utPtr >
utPtr UT_RingBuffer< utPtr >::operator() ( int  id  )  const [inline]

Definition at line 67 of file UT_RingBuffer.h.

template<class utPtr >
utPtr UT_RingBuffer< utPtr >::operator[] ( int  id  )  const [inline]

operator [] is the bounds checked version of the operator. The id is the order number of the object being indexed.

Definition at line 66 of file UT_RingBuffer.h.

template<class utPtr >
int UT_RingBuffer< utPtr >::peakUsage (  )  const [inline]

Definition at line 62 of file UT_RingBuffer.h.

template<class utPtr >
void UT_RingBuffer< utPtr >::pop ( int  number  )  [inline]

Pop the next "number" elements from the buffer.

Definition at line 59 of file UT_RingBuffer.h.

template<class utPtr >
void UT_RingBuffer< utPtr >::pop (  )  [inline]

Pop a single element from the start of the buffer.

Definition at line 56 of file UT_RingBuffer.h.

template<class utPtr >
utPtr UT_RingBuffer< utPtr >::popFirst (  )  [inline]

Pop the first element off the head of the list, moving the first entry to the next element.

Definition at line 44 of file UT_RingBuffer.h.

template<class utPtr >
int UT_RingBuffer< utPtr >::push ( utPtr  data  )  [inline]

Insert the data into the buffer, and return the order number that it is assigned.

Definition at line 53 of file UT_RingBuffer.h.

template<class utPtr >
void UT_RingBuffer< utPtr >::remove ( int  id  )  [inline]

Definition at line 40 of file UT_RingBuffer.h.


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

Generated on Fri May 25 00:10:52 2012 for HDK by  doxygen 1.5.9