NSCL DDAS  12.1-001
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 
28 namespace DDASReadout {
29 
30 struct ReferenceCountedBuffer;
31 class BufferArena;
32 
54  class ZeroCopyHit : public RawChannel
55  {
56  private:
57  ReferenceCountedBuffer* m_pBuffer;
58  BufferArena* m_pArena;
59 
60  public:
62  ZeroCopyHit();
72  size_t nWords, void* pHitData, ReferenceCountedBuffer* pBuffer,
73  BufferArena* pArena
74  );
79  ZeroCopyHit(const ZeroCopyHit& rhs);
85  ZeroCopyHit& operator=(const ZeroCopyHit& rhs);
87  virtual ~ZeroCopyHit();
88 
89  // Support for recycling ZeroCopyHits:
90 
98  void setHit(
99  size_t nWords, void* pHitData, ReferenceCountedBuffer* pBuffer,
100  BufferArena* pArena
101  );
103  void freeHit();
104 
105  private:
107  void reference();
112  void dereference();
113 
114  };
115 
116 } // Namespace.
117 
118 #endif
Defines a raw channel hit storage struct for Readout/sorting.
Provides a class for memory management in reference-counted buffers.
Definition: BufferArena.h:51
This class extends RawChannel to produce a raw channel that is zero-copied from a reference counted b...
Definition: ZeroCopyHit.h:55
virtual ~ZeroCopyHit()
Destructor.
Definition: ZeroCopyHit.cpp:86
void freeHit()
Free an existing hit.
Definition: ZeroCopyHit.cpp:134
ZeroCopyHit & operator=(const ZeroCopyHit &rhs)
Assignment operator.
Definition: ZeroCopyHit.cpp:70
void setHit(size_t nWords, void *pHitData, ReferenceCountedBuffer *pBuffer, BufferArena *pArena)
Sets a new hit.
Definition: ZeroCopyHit.cpp:99
ZeroCopyHit()
Default constructor.
Definition: ZeroCopyHit.cpp:37
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:53