Template Class epicsRingPointer

Class Documentation

template<class T>
class epicsRingPointer

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.

Public Functions

inline epicsRingPointer(int size, bool locked)

Constructor.

Parameters
  • size – Maximum number of elements (pointers) that can be stored

  • locked – If true, the spin lock secured variant is created

inline ~epicsRingPointer()

Destructor.

inline bool push(T *p)

Push a new entry on the ring.

Returns

True on success, False if the buffer was full

inline T *pop()

Take an element off the ring.

Returns

The element, or NULL if the ring was empty

inline void flush()

Remove all elements from the ring.

Note

If this operation is performed on a ring buffer of the unsecured kind, all access to the ring should be locked.

inline int getFree() const

Get how much free space remains in the ring.

Returns

The number of additional elements the ring could hold.

inline int getUsed() const

Get how many elements are stored on the ring.

Returns

The number of elements currently stored.

inline int getSize() const

Get the size of the ring.

Returns

The size specified when the ring was created.

inline bool isEmpty() const

Test if the ring is currently empty.

Returns

True if the ring is empty, otherwise false.

inline bool isFull() const

Test if the ring is currently full.

Returns

True if the ring is full, otherwise false.

inline int getHighWaterMark() const

See how full the ring has got since it was last checked.

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

inline void resetHighWaterMark()

Reset high water mark.

High water mark will be set to the current usage