Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

clAlloc Class Reference

Class for memory allocation operations. More...

#include <Alloc.hh>

Inheritance diagram for clAlloc:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 clAlloc ()
 Constructor; initializes empty allocation.

 clAlloc (const clAlloc &CopySrc)
 Copy constructor; copies instance.

 clAlloc (long lAllocSize)
 Constructor; allocates specified amount of memory.

 ~clAlloc ()
 Destructor; frees allocated memory block.

void * Size (long lAllocSize)
 Allocate specified amount of memory, previously allocated block is freed before allocating new one.

void * Resize (long lAllocSize)
 Resize memory block to specified size.

void Free ()
 Free allocated memory block.

void * GetPtr () const
 Get pointer to allocated block.

long GetSize () const
 Get size of allocation.

void Lock ()
 Lock memory block (prevent paging out).

void UnLock ()
 Unlock memory block (allow paging out).

void Copy (const clAlloc &Src)
 Copy specified memory block to this instance.

void CopyTo (clAlloc &Dest)
 Copy contents of this instance to specified memory block.

clAlloc GetCopy ()
 Return copy of this instance.

 operator char * () const
 Return pointer to memory block.

 operator unsigned char * () const
 operator short * () const
 operator unsigned short * () const
 operator int * () const
 operator unsigned int * () const
 operator long * () const
 operator unsigned long * () const
 operator float * () const
 operator double * () const
 operator long double * () const
 operator void * () const
 operator void * ()
clAllocoperator= (const clAlloc &Src)
 Self explanatory.


Protected Attributes

bool bLocked
long lSize
void * vpPtr

Detailed Description

Class for memory allocation operations.

Mainly to avoid memory leaks and to simplify pointer typecasts.

Definition at line 48 of file Alloc.hh.


Constructor & Destructor Documentation

clAlloc::clAlloc  )  [inline]
 

Constructor; initializes empty allocation.

Definition at line 58 of file Alloc.hh.

References bLocked, lSize, and vpPtr.

clAlloc::clAlloc const clAlloc CopySrc  )  [inline]
 

Copy constructor; copies instance.

Definition at line 67 of file Alloc.hh.

References Copy().

clAlloc::clAlloc long  lAllocSize  )  [inline]
 

Constructor; allocates specified amount of memory.

Parameters:
lAllocSize Size, in bytes, of allocation
Exceptions:
runtime_error 

Definition at line 77 of file Alloc.hh.

References bLocked, lSize, Size(), and vpPtr.

clAlloc::~clAlloc  )  [inline]
 

Destructor; frees allocated memory block.

Definition at line 87 of file Alloc.hh.

References Free().


Member Function Documentation

void* clAlloc::Size long  lAllocSize  )  [inline]
 

Allocate specified amount of memory, previously allocated block is freed before allocating new one.

Parameters:
lAllocSize Size, in bytes, of new allocation
Returns:
Pointer to memory block
Exceptions:
runtime_error 

Definition at line 97 of file Alloc.hh.

References ALLOC_ALIGNMENT, Free(), lSize, and vpPtr.

Referenced by clAlloc(), Copy(), clDSPOp::FFTInitialize(), clDSPOp::FIRAllocate(), clDSPOp::FIRFilter(), clIIRDecimator::Get(), clFIRDecimator::Get(), clFFTDecimator::Get(), clReBuffer::GetPtr(), clHankel::InitAbel(), clRecInterpolator::Initialize(), clRecDecimator::Initialize(), clHankel::Initialize(), clFlipBand::Initialize(), clFilter::Initialize(), clIIRInterpolator::Put(), clFIRInterpolator::Put(), and clFFTInterpolator::Put().

void* clAlloc::Resize long  lAllocSize  )  [inline]
 

Resize memory block to specified size.

Parameters:
lAllocSize New size, in bytes, of memory block
Returns:
Pointer to memory block
Exceptions:
runtime_error 

Definition at line 124 of file Alloc.hh.

References ALLOC_ALIGNMENT, bLocked, Free(), lSize, UnLock(), and vpPtr.

Referenced by clReBufferT< TDSPVector_t >::CheckSize(), and clReBuffer::CheckSize().

void clAlloc::Free  )  [inline]
 

Free allocated memory block.

It is not an error to free already freed or non-allocated block.

Definition at line 161 of file Alloc.hh.

References bLocked, lSize, UnLock(), and vpPtr.

Referenced by clReBufferT< TDSPVector_t >::Clear(), clReBuffer::Clear(), Copy(), clDSPOp::FFTUninitialize(), clDSPOp::FIRFree(), Resize(), Size(), clHankel::UninitAbel(), clRecInterpolator::Uninitialize(), clRecDecimator::Uninitialize(), clIIRInterpolator::Uninitialize(), clIIRDecimator::Uninitialize(), clHankel::Uninitialize(), clFlipBand::Uninitialize(), clFIRInterpolator::Uninitialize(), clFIRDecimator::Uninitialize(), clFilter::Uninitialize(), clFFTInterpolator::Uninitialize(), clFFTDecimator::Uninitialize(), and ~clAlloc().

void* clAlloc::GetPtr  )  const [inline]
 

Get pointer to allocated block.

Returns:
Pointer to memory block

Definition at line 180 of file Alloc.hh.

References vpPtr.

Referenced by clReBufferT< TDSPVector_t >::CopyGet(), and clHankel::DoAbel().

long clAlloc::GetSize  )  const [inline]
 

Get size of allocation.

Returns:
Size, in bytes, of allocation

Definition at line 187 of file Alloc.hh.

References lSize.

Referenced by clReBufferT< TDSPVector_t >::CheckSize(), and clReBuffer::CheckSize().

void clAlloc::Lock  )  [inline]
 

Lock memory block (prevent paging out).

Definition at line 192 of file Alloc.hh.

References bLocked, lSize, and vpPtr.

void clAlloc::UnLock  )  [inline]
 

Unlock memory block (allow paging out).

Definition at line 204 of file Alloc.hh.

References bLocked, lSize, and vpPtr.

Referenced by Free(), and Resize().

void clAlloc::Copy const clAlloc Src  )  [inline]
 

Copy specified memory block to this instance.

Parameters:
Src Source of copy
Exceptions:
runtime_error 

Definition at line 219 of file Alloc.hh.

References Free(), lSize, Size(), and vpPtr.

Referenced by clAlloc(), CopyTo(), GetCopy(), clReBuffer::operator=(), and operator=().

void clAlloc::CopyTo clAlloc Dest  )  [inline]
 

Copy contents of this instance to specified memory block.

Parameters:
Dest Destination of copy
Exceptions:
runtime_error 

Definition at line 231 of file Alloc.hh.

References Copy().

clAlloc clAlloc::GetCopy  )  [inline]
 

Return copy of this instance.

Returns:
Copy of this memory block

Definition at line 240 of file Alloc.hh.

References Copy().

clAlloc::operator char *  )  const [inline]
 

Return pointer to memory block.

Definition at line 250 of file Alloc.hh.

References vpPtr.

clAlloc::operator unsigned char *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 253 of file Alloc.hh.

References vpPtr.

clAlloc::operator short *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 256 of file Alloc.hh.

References vpPtr.

clAlloc::operator unsigned short *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 259 of file Alloc.hh.

References vpPtr.

clAlloc::operator int *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 262 of file Alloc.hh.

References vpPtr.

clAlloc::operator unsigned int *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 265 of file Alloc.hh.

References vpPtr.

clAlloc::operator long *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 268 of file Alloc.hh.

References vpPtr.

clAlloc::operator unsigned long *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 271 of file Alloc.hh.

References vpPtr.

clAlloc::operator float *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 274 of file Alloc.hh.

References vpPtr.

clAlloc::operator double *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 277 of file Alloc.hh.

References vpPtr.

clAlloc::operator long double *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 280 of file Alloc.hh.

References vpPtr.

clAlloc::operator void *  )  const [inline]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 283 of file Alloc.hh.

References vpPtr.

clAlloc::operator void *  )  [inline]
 

Definition at line 285 of file Alloc.hh.

References vpPtr.

clAlloc& clAlloc::operator= const clAlloc Src  )  [inline]
 

Self explanatory.

Parameters:
Src Source of copy
Returns:
Reference to this
Exceptions:
runtime_error 

Definition at line 294 of file Alloc.hh.

References Copy().


Member Data Documentation

bool clAlloc::bLocked [protected]
 

Definition at line 51 of file Alloc.hh.

Referenced by clAlloc(), Free(), Lock(), Resize(), and UnLock().

long clAlloc::lSize [protected]
 

Definition at line 52 of file Alloc.hh.

Referenced by clAlloc(), Copy(), Free(), GetSize(), Lock(), Resize(), Size(), and UnLock().

void* clAlloc::vpPtr [protected]
 

Definition at line 53 of file Alloc.hh.

Referenced by clAlloc(), Copy(), Free(), GetPtr(), Lock(), operator char *(), operator double *(), operator float *(), operator int *(), operator long *(), operator long double *(), operator short *(), operator unsigned char *(), operator unsigned int *(), operator unsigned long *(), operator unsigned short *(), operator void *(), Resize(), Size(), and UnLock().


The documentation for this class was generated from the following file:
Generated on Tue Mar 2 19:47:06 2004 for libDSP by doxygen 1.3.6