class CRingItemSorter : public CProcessingElement { public: typedef struct _Item { uint64_t s_timestamp; RingItem s_item; } Item, *pItem; // signature. public: CRingItemSorter( CReceiver& fanin, CSender& sink, uint64_t window, size_t nWorkers ); virtual void operator()(); virtual void process(void* pData, size_t nBytes); };
Processor that emits ring items in timestamp sorted order.
The input stream of data is that produced by e.g.
CRingItemMarkingWorker
.
That consist of a uint32_t client id, followed by
an array of uint64_timstamp/ring items pairs.
The output of this worker is a stream of
ring item arrays. This is suitable for use with
a CRingBlockDataSink
.
When constructing this a fanin
receiver must be provided to get data from the workers.
this receiver must be capable of fanning in the
data from all workers.
sink
provides the sender to
pass data to the next stage.
window
is an obsolete parameter
and no longer used.
nWorkers
is the number
of workers fanning into this stage of processing.
As each receiver sends an end of data, it is marked as exited. When the last remaining receiver has sent its end and all data sorted and emitted, an end is sent to the sender.