ucommon::MemoryProtocol Class Reference

Inheritance diagram for ucommon::MemoryProtocol:

Inheritance graph
[legend]

Public Member Functions

void * alloc (size_t size)
 Convenience function.
void * dup (void *memory, size_t size)
 Duplicate existing memory block into allocated memory.
char * dup (char *string)
 Duplicate NULL terminated string into allocated memory.
void * zalloc (size_t size)
 Allocate memory from the pager heap.

Protected Member Functions

virtual void * _alloc (size_t size)=0
 Protocol to allocate memory from the pager heap.
virtual void fault (void)
 Allocation failure handler.

Friends

class MemoryRedirect

Detailed Description

Definition at line 42 of file protocols.h.


Member Function Documentation

virtual void* ucommon::MemoryProtocol::_alloc ( size_t  size  )  [protected, pure virtual]

Protocol to allocate memory from the pager heap.

The size of the request must be less than the size of the memory page used. The actual method is in a derived or stacked object.

Parameters:
size of memory request.
Returns:
allocated memory or NULL if not possible.

Implemented in ucommon::memalloc, ucommon::mempager, ucommon::bufpager, and ucommon::MemoryRedirect.

void* ucommon::MemoryProtocol::alloc ( size_t  size  )  [inline]

Convenience function.

Parameters:
size of memory request.
Returns:
alocated memory or NULL if not possible.

Definition at line 69 of file protocols.h.

void* ucommon::MemoryProtocol::dup ( void *  memory,
size_t  size 
)

Duplicate existing memory block into allocated memory.

This uses alloc.

Parameters:
memory to data copy from.
size of memory to allocate.
Returns:
allocated memory with copy or NULL if cannot allocate.

char* ucommon::MemoryProtocol::dup ( char *  string  ) 

Duplicate NULL terminated string into allocated memory.

This uses alloc.

Parameters:
string to copy into memory.
Returns:
allocated memory with copy of string or NULL if cannot allocate.

void* ucommon::MemoryProtocol::zalloc ( size_t  size  ) 

Allocate memory from the pager heap.

The size of the request must be less than the size of the memory page used. The memory is initialized to zero. This uses alloc.

Parameters:
size of memory request.
Returns:
allocated memory or NULL if not possible.


The documentation for this class was generated from the following file:
Generated on 14 Aug 2013 for UCommon by  doxygen 1.4.7