Standard allocator interface. If you wish to create a custom allocator, you should impleent this interface in your object. If you wish to use the standard IAllocator objects in your library, you should call ILibrary::GetAllocator().
virtual void* IAllocator::Alloc |
( |
unsigned int |
cb | ) |
|
|
pure virtual |
Allocates a buffer of cb bytes and returns it. If the allcoation fails, NULL is returned.
- Parameters
-
cb | The number of bytes to allocate. |
- Returns
- The address of the allocated buffer or NULL if the allocation failed.
virtual void* IAllocator::AllocEx |
( |
unsigned int |
cb, |
|
|
char * |
strID |
|
) |
| |
|
pure virtual |
Allocates a buffer of cb bytes and returns it. If the allcoation fails, NULL is returned. The second parameter is used by Fovia's memory mapped allocator for naming the memory mapped file that is associated with the requested buffer.
- Parameters
-
cb | The number of bytes to allocate. |
strID | In Fovia's memory mapped allcoator, this is the name of the memory mapped file created. For DICOM files loaded by Fovia, the string will be in the form "fovia_map <path to file>". For RAW files loaded by Fovia, the string will be in the form "fovia_map <path to file> <slice index in file>". |
- Returns
- The address of the allocated buffer or NULL if the allocation failed.
virtual signed int IAllocator::AskInterface |
( |
const BGUID * |
piid, |
|
|
IRoot ** |
ppr |
|
) |
| |
|
pure virtual |
Queries this object to see if the interface piid is supported and returns the result in ppr.
- Parameters
-
piid | The BGUID of the requested interface. |
ppr | The address of an IRoot pointer which will receive the new interface. |
- Returns
- S_OK if the interface is supported. E_FAIL if it is not.
Implements IRoot.
virtual signed int IAllocator::DecRef |
( |
| ) |
|
|
pure virtual |
Decreases the reference count on this object by 1. If the reference count reaches 0, the object is deallocated.
Implements IRoot.
virtual void IAllocator::Free |
( |
void * |
p | ) |
|
|
pure virtual |
Free memory block.
Frees a buffer allocated with this allocater at the address p.
- Parameters
-
p | The pointer value returned by the Alloc() or AllocEx() function on this same allocator. |
virtual signed int IAllocator::IncRef |
( |
| ) |
|
|
pure virtual |
Increases the reference count on this object by 1. You do not need to call this after an object is first created. It is 1 by default.
Implements IRoot.