LRAUV  revA
RingBufferVoid Class Reference

Thread-safe ring buffer for storing void pointers. More...

#include <RingBuffer.h>

Inheritance diagram for RingBufferVoid:
Collaboration diagram for RingBufferVoid:

Public Member Functions

 RingBufferVoid (const bool freeOnCleanup=true)
 
virtual ~RingBufferVoid ()
 
bool isEmpty ()
 
void freeAll ()
 
void push (void *item)
 
void * pop ()
 
void * peek ()
 

Protected Attributes

ListEntry< void * > * start_
 
ListEntry< void * > * end_
 
const bool freeOnCleanup_
 
Mutex mutex_
 

Private Member Functions

 RingBufferVoid (const RingBufferVoid &old)
 

Detailed Description

Thread-safe ring buffer for storing void pointers.

  • On Construction: start_ = end_ = NULL
  • On push(T1), start_ = end_ = ListEntry1(T1–>ListEntry1);
  • On push(T2), start_ = ListEntry1(T1–>ListEntry2), end_ = ListEntry2(T2–>ListEntry1);
  • On push(T3), start_ = ListEntry1(T1–>ListEntry2), end_ = ListEntry3(T3–>ListEntry1);
  • On pop()–>T1, start_ = ListEntry2(T2–>ListEntry3), end_ = ListEntry3(T3–>ListEntry1);
  • On pop()–>T2, start_ = ListEntry3(T3–>ListEntry1), end_ = ListEntry3(T3–>ListEntry1);
  • On pop()–>T3, start_ = NULL, end_ = ListEntry3(T3–>ListEntry1);
  • On push(T4), start_ = end_ = ListEntry3(T3–>ListEntry1);
  • On push(T5), start_ = ListEntry3(T3–>ListEntry2), end_ = ListEntry1(T5–>ListEntry2);
  • On pop()–>T4, start_ = end_ = ListEntry1(T5–>ListEntry2);
  • On pop()–>T5, start_ = NULL, end_ = ListEntry1(T5–>ListEntry1);
  • isEmpty true when start_ == NULL

Constructor & Destructor Documentation

RingBufferVoid::RingBufferVoid ( const bool  freeOnCleanup = true)
RingBufferVoid::~RingBufferVoid ( )
virtual
RingBufferVoid::RingBufferVoid ( const RingBufferVoid old)
private

Member Function Documentation

void RingBufferVoid::freeAll ( )

References freeOnCleanup_, isEmpty(), and pop().

Referenced by ~RingBufferVoid().

bool RingBufferVoid::isEmpty ( void  )
void * RingBufferVoid::peek ( void  )
void * RingBufferVoid::pop ( void  )
void RingBufferVoid::push ( void *  item)

Member Data Documentation

ListEntry<void*>* RingBufferVoid::end_
protected

Referenced by pop(), push(), and ~RingBufferVoid().

const bool RingBufferVoid::freeOnCleanup_
protected
Mutex RingBufferVoid::mutex_
protected

Referenced by peek(), pop(), and push().

ListEntry<void*>* RingBufferVoid::start_
protected

Referenced by isEmpty(), peek(), pop(), push(), and ~RingBufferVoid().


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