NSCL DDAS 12.2-009
Support for XIA DDAS at FRIB
ZeroCopyHit.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 ZEROCOPYHIT_H
24#define ZEROCOPYHIT_H
25
26#include "RawChannel.h"
27
28namespace DDASReadout {
29
30struct ReferenceCountedBuffer;
31class BufferArena;
32
54class ZeroCopyHit : public RawChannel {
55private:
56 ReferenceCountedBuffer *m_pBuffer;
57 BufferArena *m_pArena;
58
59public:
70 ZeroCopyHit(size_t nWords, void *pHitData, ReferenceCountedBuffer *pBuffer,
71 BufferArena *pArena);
76 ZeroCopyHit(const ZeroCopyHit &rhs);
84 virtual ~ZeroCopyHit();
85
86 // Support for recycling ZeroCopyHits:
87
95 void setHit(size_t nWords, void *pHitData, ReferenceCountedBuffer *pBuffer,
96 BufferArena *pArena);
98 void freeHit();
99
100private:
102 void reference();
107 void dereference();
108};
109
110} // namespace DDASReadout
111
112#endif
Defines a raw channel hit storage struct for Readout/sorting.
Provides a class for memory management in reference-counted buffers.
Definition: BufferArena.h:50
This class extends RawChannel to produce a raw channel that is zero-copied from a reference counted b...
Definition: ZeroCopyHit.h:54
virtual ~ZeroCopyHit()
Destructor.
Definition: ZeroCopyHit.cpp:76
void freeHit()
Free an existing hit.
Definition: ZeroCopyHit.cpp:118
ZeroCopyHit & operator=(const ZeroCopyHit &rhs)
Assignment operator.
Definition: ZeroCopyHit.cpp:61
void setHit(size_t nWords, void *pHitData, ReferenceCountedBuffer *pBuffer, BufferArena *pArena)
Sets a new hit.
Definition: ZeroCopyHit.cpp:87
ZeroCopyHit()
Default constructor.
Definition: ZeroCopyHit.cpp:35
Definition: BufferArena.cpp:29
A struct containing a pointer to a hit and its properties.
Definition: RawChannel.h:41
A reference-counted buffer with dynamic storage.
Definition: ReferenceCountedBuffer.h:52