9 #ifndef _RINGBUFFER_HPP_
10 #define _RINGBUFFER_HPP_
12 #include <QtCore/QMutex>
13 #include <QtCore/QWaitCondition>
107 for (
size_t i=0; i<
_buffer.size(); ++i)
108 _buffer[i].element = std::tr1::shared_ptr<T>(
new T());
171 #ifdef RINGBUFFER_BLOCKING
258 iter->processed =
true;
259 iter->filled =
false;
331 iter->processed = !fillstatus;
332 iter->filled = fillstatus;
360 for (; it !=
end; ++it)
361 if (!it->processed || it->inUse)
an element of the ringbuffer.
QWaitCondition _processcondition
sync the processing part
iter_type nextToFill(unsigned long timeout=ULONG_MAX)
retrieve the "to be filled" element.
void waitUntilEmpty()
wait until no element that needs processing is on the list
iter_type nextToProcess(unsigned long timeout=ULONG_MAX)
return the next filled but non processed element.
things written only at end of run H5Dump ProcessorSummary size
std::vector< Element > buffer_t
type of the container of all elements
file contains custom exceptions used in cass
bool inUse
status whether the element is workend on right now
bool findNextFillable()
advances the _nextToFill itertor to the next fillable element.
void doneFilling(iter_type iter, bool fillstatus=true)
putting the filled element back to the buffer.
QWaitCondition _fillcondition
sync the filling part
QMutex _mutex
mutex to protect the iterators and the buffer elements
A Ringbuffer, handles communication between Input and Worker Threads.
wait(QMutex *mutex, unsigned long time=ULONG_MAX)
int countProcessing()
count how many elements of the buffer are not processed
buffer_t::iterator iter_type
type of the interator over the elements of the container
void doneProcessing(iter_type iter)
putting the processed element back to the buffer.
file contains global definitions for project cass
buffer_t _buffer
the ringbuffer container
std::tr1::shared_ptr< T > element
the pointer to the element
bool filled
status whether the element has been filled
RingBuffer(size_t size)
constructor.
iter_type _nextToProcess
iterator to the next processable element
bool findNextProcessable()
advances the _nextToProcess iterator to the next processable element.
bool processed
status whether the element has been worked on
iter_type _nextToFill
iterator to the next fillable element