SOFA API  6a688117
Open source framework for multi-physics simuation
sofa::helper::system::thread::OneThreadPerEnd Class Reference

#include <CircularQueue.h>

Detailed Description

This is a lock-free single-producer single-consumer implementation of a circular queue matching the ThreadAccessPolicy of CircularQueue.

Protected Attributes

volatile unsigned head
 
volatile unsigned tail
 

Protected Member Functions

 OneThreadPerEnd ()
 
bool isEmpty (unsigned maxSize) const
 
bool isFull (unsigned maxSize) const
 
unsigned size (unsigned maxSize) const
 
template<class T >
void init (T array[], unsigned maxCapacity)
 
template<class T >
bool push (T array[], unsigned maxSize, unsigned maxCapacity, const T &item)
 
template<class T >
bool pop (T array[], unsigned maxSize, unsigned maxCapacity, T &item, bool clear=true)
 
template<class T >
unsigned skip (T array[], unsigned maxSize, unsigned maxCapacity, unsigned outmaxsize, bool clear=true)
 
template<class T , class OutputIterator >
unsigned pop (T array[], unsigned maxSize, unsigned maxCapacity, OutputIterator out, unsigned outmaxsize, bool clear=true)
 

Attribute details

volatile unsigned sofa::helper::system::thread::OneThreadPerEnd::head
protected
volatile unsigned sofa::helper::system::thread::OneThreadPerEnd::tail
protected

Constructor details

SOFA_HELPER_API sofa::helper::system::thread::OneThreadPerEnd::OneThreadPerEnd ( )
inlineprotected

Function details

template<class T >
void sofa::helper::system::thread::OneThreadPerEnd::init ( array[],
unsigned  maxCapacity 
)
protected
SOFA_HELPER_API bool sofa::helper::system::thread::OneThreadPerEnd::isEmpty ( unsigned  maxSize) const
inlineprotected
SOFA_HELPER_API bool sofa::helper::system::thread::OneThreadPerEnd::isFull ( unsigned  maxSize) const
inlineprotected
template<class T >
bool sofa::helper::system::thread::OneThreadPerEnd::pop ( array[],
unsigned  maxSize,
unsigned  maxCapacity,
T &  item,
bool  clear = true 
)
protected
template<class T , class OutputIterator >
unsigned sofa::helper::system::thread::OneThreadPerEnd::pop ( array[],
unsigned  maxSize,
unsigned  maxCapacity,
OutputIterator  out,
unsigned  outmaxsize,
bool  clear = true 
)
protected
template<class T >
bool sofa::helper::system::thread::OneThreadPerEnd::push ( array[],
unsigned  maxSize,
unsigned  maxCapacity,
const T &  item 
)
protected
SOFA_HELPER_API unsigned sofa::helper::system::thread::OneThreadPerEnd::size ( unsigned  maxSize) const
inlineprotected
template<class T >
unsigned sofa::helper::system::thread::OneThreadPerEnd::skip ( array[],
unsigned  maxSize,
unsigned  maxCapacity,
unsigned  outmaxsize,
bool  clear = true 
)
protected