knight/shared/KePageAllocator.h
author Nicholas Hastings <skamonkey@gmail.com>
Sat Aug 10 12:22:09 2013 -0400 (2013-08-10)
changeset 3981 af3681eade3f
parent 3980 dc7dfcd855dc
permissions -rw-r--r--
Debug build fixes.
     1 #ifndef _INCLUDE_KNIGHT_KE_PAGE_ALLOCATOR_H_
     2 #define _INCLUDE_KNIGHT_KE_PAGE_ALLOCATOR_H_
     3 
     4 #include <stddef.h>
     5 #include <stdint.h>
     6 
     7 namespace Knight
     8 {
     9 	class KePageAllocator;
    10 
    11 	/**
    12 	 * @brief Creates a page allocator.
    13 	 *
    14 	 * @return				New page allocator.
    15 	 */
    16 	extern KePageAllocator *KE_CreatePageAllocator();
    17 
    18 	/**
    19 	 * @brief Destroys a page allocator, freeing all live pages it owns.
    20 	 *
    21 	 * @param				Page allocator.
    22 	 */
    23 	extern void KE_DestroyPageAllocator(KePageAllocator *alloc);
    24 
    25 	/**
    26 	 * @brief Allocates a page of memory.
    27 	 *
    28 	 * @param alloc			Page allocator.
    29 	 * @return				Page of memory.
    30 	 */
    31 	extern void *KE_PageAlloc(KePageAllocator *alloc);
    32 
    33 	/**
    34 	* @brief Frees a page of memory.
    35 	*
    36 	* @param alloc			Page allocator.
    37 	* @param page			Page of memory.
    38 	*/
    39 	extern void KE_PageFree(KePageAllocator *alloc, void *page);
    40 
    41 	/**
    42 	* @brief Returns the size of a page.
    43 	*
    44 	* @param alloc			Page allocator.
    45 	* @return				Page size.
    46 	*/
    47 	extern size_t KE_PageSize(KePageAllocator *alloc);
    48 }
    49 
    50 #endif //_INCLUDE_KNIGHT_KE_PAGE_ALLOCATOR_H_