MityDSP Documentation Index

MityDSP::tcDspBufPool Class Reference

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>

List of all members.

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 tsBufferthBufHandle

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 tcDspBufPoolGetInstance (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
tsBuffermaFreePool [eeNumSizes]
 list of free buffers

Static Protected Attributes

static tcDspBufPoolgpBufPool = NULL
 the singleton pointer

Detailed Description

The tcDspBufPool class is a singleton that manages a set of standard buffer pools ranging in size from 16 bytes to 64K bytes.

See also:
tcDspBufPool Page

Member Typedef Documentation

structure defining buffer and size


Member Enumeration Documentation

available buffer sizes

Enumerator:
ee16Bytes 
ee64Bytes 
ee256Bytes 
ee1KBytes 
ee4KBytes 
ee16KBytes 
ee64KBytes 
eeNumSizes 

Constructor & Destructor Documentation

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.

See also:
DspBufPool.h
tcDspBufPool::~tcDspBufPool ( void   )  [protected]

tcDspBufPool Destructor (not reached).

See also:
DspBufPool.h

Member Function Documentation

tcDspBufPool * tcDspBufPool::GetInstance ( void   )  [static]

Singleton accessor.

If the object exists, returns pointer to the singleton, otherwise constructs it and returns it.

Returns:
Pointer to singleton tcDspBufPool object
See also:
DspBufPool.h
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.

Parameters:
[in] anMinSize The minimum size of the allocated buffer.
Returns:
Buffer handle if successful, NULL otherwise.
See also:
DspBufPool.h
void * tcDspBufPool::GetAddr ( thBufHandle  ahHandle  ) 

Returns the actual address of the buffer associated with a provided buffer handle.

Parameters:
[in] ahHandle Previously allocated buffer handle.
Returns:
Address of the buffer.
See also:
DspBufPool.h
void tcDspBufPool::Free ( thBufHandle  ahHandle  ) 

Returns a previously allocated buffer to the free pool.

Parameters:
[in] ahHandle Previously allocated buffer handle.
Returns:
None.
See also:
DspBufPool.h
int tcDspBufPool::GetStats ( const unsigned int *&  aaSize,
const unsigned int *&  aaFree,
const unsigned int *&  aaAlloc 
)

Provides access to buffer statistics.

Parameters:
[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.
Returns:
Number of different buffer sizes in each array.
See also:
DspBufPool.h
void MityDSP::tcDspBufPool::Lock ( unsigned int &  arCsr  )  [inline, protected]
void MityDSP::tcDspBufPool::Unlock ( unsigned int  anCsr  )  [inline, protected]

Member Data Documentation

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


  
Generated on Fri Sep 23 16:33:47 2011 for MityDSP Core by  Doxygen Version 1.6.1
Copyright © 2009, Critical Link LLC, All rights reserved.