SOFA API  1a4bb3e7
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

◆ head

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

◆ tail

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

Constructor details

◆ OneThreadPerEnd()

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

Function details

◆ init()

template<class T >
void sofa::helper::system::thread::OneThreadPerEnd::init ( array[],
unsigned  maxCapacity 
)
protected

◆ isEmpty()

SOFA_HELPER_API bool sofa::helper::system::thread::OneThreadPerEnd::isEmpty ( unsigned  maxSize) const
inlineprotected

◆ isFull()

SOFA_HELPER_API bool sofa::helper::system::thread::OneThreadPerEnd::isFull ( unsigned  maxSize) const
inlineprotected

◆ pop() [1/2]

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

◆ pop() [2/2]

template<class T >
bool sofa::helper::system::thread::OneThreadPerEnd::pop ( array[],
unsigned  maxSize,
unsigned  maxCapacity,
T &  item,
bool  clear = true 
)
protected

◆ push()

template<class T >
bool sofa::helper::system::thread::OneThreadPerEnd::push ( array[],
unsigned  maxSize,
unsigned  maxCapacity,
const T &  item 
)
protected

◆ size()

SOFA_HELPER_API unsigned sofa::helper::system::thread::OneThreadPerEnd::size ( unsigned  maxSize) const
inlineprotected

◆ skip()

template<class T >
unsigned sofa::helper::system::thread::OneThreadPerEnd::skip ( array[],
unsigned  maxSize,
unsigned  maxCapacity,
unsigned  outmaxsize,
bool  clear = true 
)
protected