Fovia's C++ Client/Server API
Public Member Functions | List of all members
IAllocator Struct Referenceabstract
Inheritance diagram for IAllocator:
IRoot

Public Member Functions

virtual void * Alloc (unsigned int cb)=0
 
virtual void * AllocEx (unsigned int cb, char *strID)=0
 
virtual signed int AskInterface (const BGUID *piid, IRoot **ppr)=0
 
virtual signed int DecRef ()=0
 
virtual void Free (void *p)=0
 
virtual signed int IncRef ()=0
 
- Public Member Functions inherited from IRoot
template<class T >
signed int AskInterface (T **pp)
 

Detailed Description

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().

Member Function Documentation

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
cbThe 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
cbThe number of bytes to allocate.
strIDIn 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
piidThe BGUID of the requested interface.
pprThe 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
pThe 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.