NSCL DDAS  12.1-001
Support for XIA DDAS at FRIB
BufferArena.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 BUFFERARENA_H
24 #define BUFFERARENA_H
25 
26 #include <stddef.h>
27 
28 #include <deque>
29 
31 namespace DDASReadout {
32 
33  struct ReferenceCountedBuffer;
34 
51  class BufferArena {
52  private:
53  std::deque<ReferenceCountedBuffer*> m_BufferPool;
54 
55  public:
57  virtual ~BufferArena();
58 
65  ReferenceCountedBuffer* allocate(size_t nBytes);
70  void free(ReferenceCountedBuffer* pBuffer);
71 
72  };
73 
74 } // Namespace.
75 
76 #endif
Provides a class for memory management in reference-counted buffers.
Definition: BufferArena.h:51
ReferenceCountedBuffer * allocate(size_t nBytes)
Allocate and return a buffer.
Definition: BufferArena.cpp:51
virtual ~BufferArena()
Destructor.
Definition: BufferArena.cpp:37
void free(ReferenceCountedBuffer *pBuffer)
Returns a buffer to the pool.
Definition: BufferArena.cpp:67
Definition: BufferArena.cpp:29
A reference-counted buffer with dynamic storage.
Definition: ReferenceCountedBuffer.h:53