.TH "include/Zycore/Allocator.h" 3 "Version 1.5.0.0" "Zycore" \" -*- nroff -*- .ad l .nh .SH NAME include/Zycore/Allocator.h .SH SYNOPSIS .br .PP \fC#include \fP .br \fC#include \fP .br .SS "Classes" .in +1c .ti -1c .RI "struct \fBZyanAllocator_\fP" .br .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef \fBZyanStatus\fP(* \fBZyanAllocatorAllocate\fP) (struct \fBZyanAllocator_\fP *allocator, void **p, ZyanUSize element_size, ZyanUSize n)" .br .ti -1c .RI "typedef \fBZyanStatus\fP(* \fBZyanAllocatorDeallocate\fP) (struct \fBZyanAllocator_\fP *allocator, void *p, ZyanUSize element_size, ZyanUSize n)" .br .ti -1c .RI "typedef struct \fBZyanAllocator_\fP \fBZyanAllocator\fP" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "\fBZYCORE_EXPORT\fP \fBZyanStatus\fP \fBZyanAllocatorInit\fP (\fBZyanAllocator\fP *allocator, \fBZyanAllocatorAllocate\fP allocate, \fBZyanAllocatorAllocate\fP reallocate, \fBZyanAllocatorDeallocate\fP deallocate)" .br .ti -1c .RI "\fBZYCORE_EXPORT\fP \fBZYAN_REQUIRES_LIBC\fP \fBZyanAllocator\fP * \fBZyanAllocatorDefault\fP (void)" .br .in -1c .SH "Typedef Documentation" .PP .SS "typedef struct \fBZyanAllocator_\fP \fBZyanAllocator\fP" Defines the \fCZyanAllocator\fP struct\&. .PP This is the base class for all custom allocator implementations\&. .PP All fields in this struct should be considered as 'private'\&. Any changes may lead to unexpected behavior\&. .SS "typedef \fBZyanStatus\fP(* ZyanAllocatorAllocate) (struct \fBZyanAllocator_\fP *allocator, void **p, ZyanUSize element_size, ZyanUSize n)" Defines the \fCZyanAllocatorAllocate\fP function prototype\&. .PP \fBParameters\fP .RS 4 \fIallocator\fP A pointer to the \fCZyanAllocator\fP instance\&. .br \fIp\fP Receives a pointer to the first memory block sufficient to hold an array of \fCn\fP elements with a size of \fCelement_size\fP\&. .br \fIelement_size\fP The size of a single element\&. .br \fIn\fP The number of elements to allocate storage for\&. .RE .PP \fBReturns\fP .RS 4 A zyan status code\&. .RE .PP This prototype is used for the \fCallocate()\fP and \fCreallocate()\fP functions\&. .PP The result of the \fCreallocate()\fP function is undefined, if \fCp\fP does not point to a memory block previously obtained by \fC(re-)allocate()\fP\&. .SS "typedef \fBZyanStatus\fP(* ZyanAllocatorDeallocate) (struct \fBZyanAllocator_\fP *allocator, void *p, ZyanUSize element_size, ZyanUSize n)" Defines the \fCZyanAllocatorDeallocate\fP function prototype\&. .PP \fBParameters\fP .RS 4 \fIallocator\fP A pointer to the \fCZyanAllocator\fP instance\&. .br \fIp\fP The pointer obtained from \fC(re-)allocate()\fP\&. .br \fIelement_size\fP The size of a single element\&. .br \fIn\fP The number of elements earlier passed to \fC(re-)allocate()\fP\&. .RE .PP \fBReturns\fP .RS 4 A zyan status code\&. .RE .PP .SH "Function Documentation" .PP .SS "\fBZYCORE_EXPORT\fP \fBZYAN_REQUIRES_LIBC\fP \fBZyanAllocator\fP * ZyanAllocatorDefault (void)" Returns the default \fCZyanAllocator\fP instance\&. .PP \fBReturns\fP .RS 4 A pointer to the default \fCZyanAllocator\fP instance\&. .RE .PP The default allocator uses the default memory manager to allocate memory on the heap\&. .PP You should in no case modify the returned allocator instance to avoid unexpected behavior\&. .SS "\fBZYCORE_EXPORT\fP \fBZyanStatus\fP ZyanAllocatorInit (\fBZyanAllocator\fP * allocator, \fBZyanAllocatorAllocate\fP allocate, \fBZyanAllocatorAllocate\fP reallocate, \fBZyanAllocatorDeallocate\fP deallocate)" Initializes the given \fCZyanAllocator\fP instance\&. .PP \fBParameters\fP .RS 4 \fIallocator\fP A pointer to the \fCZyanAllocator\fP instance\&. .br \fIallocate\fP The allocate function\&. .br \fIreallocate\fP The reallocate function\&. .br \fIdeallocate\fP The deallocate function\&. .RE .PP \fBReturns\fP .RS 4 A zyan status code\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Zycore from the source code\&.