NSCL DDAS 12.2-009
Support for XIA DDAS at FRIB
DDASSorter.h
Go to the documentation of this file.
1/*
2 This software is Copyright by the Board of Trustees of Michigan
3 State University (c) Copyright 2017.
4
5 You may use this software under the terms of the GNU public license
6 (GPL). The terms of this license are described at:
7
8 http://www.gnu.org/licenses/gpl.txt
9
10 Authors:
11 Ron Fox
12 Giordano Cerriza
13 NSCL
14 Michigan State University
15 East Lansing, MI 48824-1321
16*/
17
23#ifndef DDASSORTER_H
24#define DDASSORTER_H
25
26#include <deque>
27
28#include <CRingBufferChunkAccess.h>
29
30class CRingBuffer;
31
32namespace DDASReadout {
33class BufferArena;
34class ReferenceCountedBuffer;
35class ZeroCopyHit;
36class HitManager;
37} // namespace DDASReadout
38
39typedef struct _RingItemHeader *pRingItemHeader;
40
55private:
56 CRingBuffer &m_source;
57 CRingBuffer &m_sink;
59 DDASReadout::BufferArena *m_pArena;
60 std::deque<DDASReadout::ZeroCopyHit *> m_hits;
61 uint32_t m_sid;
62 double m_lastEmittedTimestamp;
63
64public:
71 DDASSorter(CRingBuffer &source, CRingBuffer &sink, float window = 10.0);
74
76 void operator()();
77
78private:
83 void processChunk(CRingBufferChunkAccess::Chunk &chunk);
88 void outputRingItem(pRingItemHeader pItem);
95 void processHits(pRingItemHeader pItem);
97 void flushHitManager();
103 DDASReadout::ZeroCopyHit *allocateHit();
109 void freeHit(DDASReadout::ZeroCopyHit *pHit);
111 void outputHit(DDASReadout::ZeroCopyHit *pHit);
112};
113
114#endif
struct _RingItemHeader * pRingItemHeader
Definition: DDASSorter.h:39
Provides a class for memory management in reference-counted buffers.
Definition: BufferArena.h:50
Collect hits from modules and retains them in a sorted deque.
Definition: HitManager.h:46
This class extends RawChannel to produce a raw channel that is zero-copied from a reference counted b...
Definition: ZeroCopyHit.h:54
Class to manage data flow and timestamp ordering.
Definition: DDASSorter.h:54
DDASSorter(CRingBuffer &source, CRingBuffer &sink, float window=10.0)
Constructor.
Definition: DDASSorter.cpp:44
~DDASSorter()
Destructor.
Definition: DDASSorter.cpp:55
void operator()()
Defines the dataflow of the sorter.
Definition: DDASSorter.cpp:64
Definition: BufferArena.cpp:29