EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | List of all members
epicsRingPointer< T > Class Template Reference

A C++ template class providing methods for creating and using a ring buffer (a first in, first out circular buffer) that stores pointers to objects of the template type.

#include <epicsRingPointer.h>

Public Member Functions

 epicsRingPointer (int size, bool locked)
 Constructor. More...
 
 ~epicsRingPointer ()
 Destructor.
 
bool push (T *p)
 Push a new entry on the ring. More...
 
T * pop ()
 Take an element off the ring. More...
 
void flush ()
 Remove all elements from the ring. More...
 
int getFree () const
 Get how much free space remains in the ring. More...
 
int getUsed () const
 Get how many elements are stored on the ring. More...
 
int getSize () const
 Get the size of the ring. More...
 
bool isEmpty () const
 Test if the ring is currently empty. More...
 
bool isFull () const
 Test if the ring is currently full. More...
 
int getHighWaterMark () const
 See how full the ring has got since it was last checked. More...
 
void resetHighWaterMark ()
 Reset high water mark. More...
 

Detailed Description

template<class T>
class epicsRingPointer< T >

Definition at line 42 of file epicsRingPointer.h.

Constructor & Destructor Documentation

template<class T >
epicsRingPointer< T >::epicsRingPointer ( int  size,
bool  locked 
)
inline
Parameters
sizeMaximum number of elements (pointers) that can be stored
lockedIf true, the spin lock secured variant is created

Definition at line 220 of file epicsRingPointer.h.

Member Function Documentation

template<class T >
bool epicsRingPointer< T >::push ( T *  p)
inline
Returns
True on success, False if the buffer was full

Definition at line 236 of file epicsRingPointer.h.

template<class T >
T * epicsRingPointer< T >::pop ( )
inline
Returns
The element, or NULL if the ring was empty

Definition at line 255 of file epicsRingPointer.h.

template<class T >
void epicsRingPointer< T >::flush ( )
inline
Note
If this operation is performed on a ring buffer of the unsecured kind, all access to the ring should be locked.

Definition at line 272 of file epicsRingPointer.h.

template<class T >
int epicsRingPointer< T >::getFree ( ) const
inline
Returns
The number of additional elements the ring could hold.

Definition at line 281 of file epicsRingPointer.h.

template<class T >
int epicsRingPointer< T >::getUsed ( ) const
inline
Returns
The number of elements currently stored.

Definition at line 299 of file epicsRingPointer.h.

template<class T >
int epicsRingPointer< T >::getSize ( ) const
inline
Returns
The size specified when the ring was created.

Definition at line 308 of file epicsRingPointer.h.

template<class T >
bool epicsRingPointer< T >::isEmpty ( ) const
inline
Returns
True if the ring is empty, otherwise false.

Definition at line 314 of file epicsRingPointer.h.

template<class T >
bool epicsRingPointer< T >::isFull ( ) const
inline
Returns
True if the ring is full, otherwise false.

Definition at line 324 of file epicsRingPointer.h.

template<class T >
int epicsRingPointer< T >::getHighWaterMark ( ) const
inline

Returns the maximum number of elements the ring buffer has held since the water mark was last reset. A new ring buffer starts with a water mark of 0.

Returns
Actual highwater mark

Definition at line 333 of file epicsRingPointer.h.

template<class T >
void epicsRingPointer< T >::resetHighWaterMark ( )
inline

High water mark will be set to the current usage

Definition at line 339 of file epicsRingPointer.h.


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