NSCL DDAS 12.2-009
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 <cstddef>
27#include <deque>
28
30namespace DDASReadout {
31
32struct ReferenceCountedBuffer;
33
51private:
52 std::deque<ReferenceCountedBuffer *> m_BufferPool;
53
54public:
56 virtual ~BufferArena();
57
64 ReferenceCountedBuffer *allocate(size_t nBytes);
69 void free(ReferenceCountedBuffer *pBuffer);
70};
71
72} // namespace DDASReadout
73
74#endif
Provides a class for memory management in reference-counted buffers.
Definition: BufferArena.h:50
ReferenceCountedBuffer * allocate(size_t nBytes)
Allocate and return a buffer.
Definition: BufferArena.cpp:49
virtual ~BufferArena()
Destructor.
Definition: BufferArena.cpp:37
void free(ReferenceCountedBuffer *pBuffer)
Returns a buffer to the pool.
Definition: BufferArena.cpp:63
Definition: BufferArena.cpp:29
A reference-counted buffer with dynamic storage.
Definition: ReferenceCountedBuffer.h:52