The tcDspBufPool class is a singleton that manages a set of standard buffer pools ranging in size from 16 bytes to 64K bytes. More...
#include <core/DspBufPool.h>
Classes | |
struct | buf_info |
structure defining buffer and size More... | |
Public Types | |
typedef struct MityDSP::tcDspBufPool::buf_info | tsBuffer |
structure defining buffer and size | |
typedef const tsBuffer * | thBufHandle |
Public Member Functions | |
thBufHandle | Alloc (int anMinSize) |
Allocates a new buffer of at least the specified number of bytes. | |
void * | GetAddr (thBufHandle ahHandle) |
Returns the actual address of the buffer associated with a provided buffer handle. | |
void | Free (thBufHandle ahHandle) |
Returns a previously allocated buffer to the free pool. | |
int | GetStats (const unsigned int *&aaSize, const unsigned int *&aaFree, const unsigned int *&aaAlloc) |
Provides access to buffer statistics. | |
Static Public Member Functions | |
static tcDspBufPool * | GetInstance (void) |
Singleton accessor. | |
Protected Types | |
enum | teBufSizes { ee16Bytes = 0, ee64Bytes = 1, ee256Bytes = 2, ee1KBytes = 3, ee4KBytes = 4, ee16KBytes = 5, ee64KBytes = 6, eeNumSizes = 7 } |
available buffer sizes More... | |
Protected Member Functions | |
tcDspBufPool (void) | |
This constructor is used to create an automatically sized, semi-static buffer pool. | |
~tcDspBufPool (void) | |
tcDspBufPool Destructor (not reached). | |
void | Lock (unsigned int &arCsr) |
void | Unlock (unsigned int anCsr) |
Protected Attributes | |
LCK_Handle | mhMutex |
thread-safe mutex | |
unsigned int | maBufSizes [eeNumSizes] |
total buffers of each size alloc'd | |
unsigned int | maNumAlloc [eeNumSizes] |
total buffers of each size alloc'd | |
unsigned int | maNumFree [eeNumSizes] |
number of each buffer size in free pool | |
tsBuffer * | maFreePool [eeNumSizes] |
list of free buffers | |
Static Protected Attributes | |
static tcDspBufPool * | gpBufPool = NULL |
the singleton pointer |
The tcDspBufPool class is a singleton that manages a set of standard buffer pools ranging in size from 16 bytes to 64K bytes.
typedef struct MityDSP::tcDspBufPool::buf_info MityDSP::tcDspBufPool::tsBuffer |
structure defining buffer and size
typedef const tsBuffer* MityDSP::tcDspBufPool::thBufHandle |
enum MityDSP::tcDspBufPool::teBufSizes [protected] |
tcDspBufPool::tcDspBufPool | ( | void | ) | [protected] |
This constructor is used to create an automatically sized, semi-static buffer pool.
The constructor is private and is only called by the singleton accessor, GetInstance.
tcDspBufPool::~tcDspBufPool | ( | void | ) | [protected] |
tcDspBufPool Destructor (not reached).
tcDspBufPool * tcDspBufPool::GetInstance | ( | void | ) | [static] |
Singleton accessor.
If the object exists, returns pointer to the singleton, otherwise constructs it and returns it.
const tcDspBufPool::tsBuffer * tcDspBufPool::Alloc | ( | int | anMinSize | ) |
Allocates a new buffer of at least the specified number of bytes.
Returns a handle to the allocated buffer, not the buffer itself.
[in] | anMinSize | The minimum size of the allocated buffer. |
void * tcDspBufPool::GetAddr | ( | thBufHandle | ahHandle | ) |
Returns the actual address of the buffer associated with a provided buffer handle.
[in] | ahHandle | Previously allocated buffer handle. |
void tcDspBufPool::Free | ( | thBufHandle | ahHandle | ) |
Returns a previously allocated buffer to the free pool.
[in] | ahHandle | Previously allocated buffer handle. |
int tcDspBufPool::GetStats | ( | const unsigned int *& | aaSize, | |
const unsigned int *& | aaFree, | |||
const unsigned int *& | aaAlloc | |||
) |
Provides access to buffer statistics.
[in] | aaSize | Reference to an array of buffer sizes. |
[in] | aaFree | Reference to an array of free buffers of each size. |
[in] | aaAlloc | Reference to an array of allocated buffers of each size. |
void MityDSP::tcDspBufPool::Lock | ( | unsigned int & | arCsr | ) | [inline, protected] |
void MityDSP::tcDspBufPool::Unlock | ( | unsigned int | anCsr | ) | [inline, protected] |
tcDspBufPool * tcDspBufPool::gpBufPool = NULL [static, protected] |
the singleton pointer
LCK_Handle MityDSP::tcDspBufPool::mhMutex [protected] |
thread-safe mutex
unsigned int MityDSP::tcDspBufPool::maBufSizes[eeNumSizes] [protected] |
total buffers of each size alloc'd
unsigned int MityDSP::tcDspBufPool::maNumAlloc[eeNumSizes] [protected] |
total buffers of each size alloc'd
unsigned int MityDSP::tcDspBufPool::maNumFree[eeNumSizes] [protected] |
number of each buffer size in free pool
tsBuffer* MityDSP::tcDspBufPool::maFreePool[eeNumSizes] [protected] |
list of free buffers