#include <ConcurrentQueue.h>
Public Types | |
typedef SizeType | ReturnType |
typedef std::list< T > | SequenceType |
typedef SequenceType::size_type | SizeType |
typedef std::pair< T, size_t > | ValueType |
Static Public Member Functions | |
static ReturnType | doEnq (T const &item, SequenceType &elements, SizeType &size, SizeType &capacity, detail::MemoryType &used, detail::MemoryType &memory, size_t &elementsDropped, boost::condition &nonempty) |
static void | doInsert (T const &item, SequenceType &elements, SizeType &size, detail::MemoryType const &itemSize, detail::MemoryType &used, boost::condition &nonempty) |
Definition at line 175 of file ConcurrentQueue.h.
typedef SizeType stor::KeepNewest< T >::ReturnType |
Definition at line 180 of file ConcurrentQueue.h.
typedef std::list<T> stor::KeepNewest< T >::SequenceType |
Definition at line 178 of file ConcurrentQueue.h.
typedef SequenceType::size_type stor::KeepNewest< T >::SizeType |
Definition at line 179 of file ConcurrentQueue.h.
typedef std::pair<T,size_t> stor::KeepNewest< T >::ValueType |
Definition at line 177 of file ConcurrentQueue.h.
static ReturnType stor::KeepNewest< T >::doEnq | ( | T const & | item, |
SequenceType & | elements, | ||
SizeType & | size, | ||
SizeType & | capacity, | ||
detail::MemoryType & | used, | ||
detail::MemoryType & | memory, | ||
size_t & | elementsDropped, | ||
boost::condition & | nonempty | ||
) | [inline, static] |
Definition at line 199 of file ConcurrentQueue.h.
References stor::KeepNewest< T >::doInsert(), asciidump::elements, stor::detail::memoryUsage(), and findQualityFiles::size.
{ SizeType elementsRemoved(0); detail::MemoryType itemSize = detail::memoryUsage(item); while ( (size==capacity || used+itemSize > memory) && !elements.empty() ) { SequenceType holder; // Move the item out of elements in a manner that will not throw. holder.splice(holder.begin(), elements, elements.begin()); // Record the change in the length of elements. --size; used -= detail::memoryUsage( holder.front() ); ++elementsRemoved; } if (size < capacity && used+itemSize <= memory) // we succeeded to make enough room for the new element { doInsert(item, elements, size, itemSize, used, nonempty); } else { // we cannot add the new element ++elementsRemoved; } elementsDropped += elementsRemoved; return elementsRemoved; }
static void stor::KeepNewest< T >::doInsert | ( | T const & | item, |
SequenceType & | elements, | ||
SizeType & | size, | ||
detail::MemoryType const & | itemSize, | ||
detail::MemoryType & | used, | ||
boost::condition & | nonempty | ||
) | [inline, static] |
Definition at line 183 of file ConcurrentQueue.h.
References findQualityFiles::size.
Referenced by stor::KeepNewest< T >::doEnq().