|
GNU CommonC++
|
The StackPager provides a repository to stash and retrieve working data in last-in-first-out order. More...
#include <misc.h>
Public Member Functions | |
| StackPager (size_t pagesize) | |
| Create a lifo pager as a mempager. | |
| void * | push (const void *object, size_t size) |
| Push an arbitrary object onto the stack. | |
| void * | push (const char *string) |
| Push a string onto the stack. | |
| void * | pull (void) |
| Retrieve next object from stack. | |
| void | purge (void) |
| Purge the stack of all objects and memory allocations. | |
Additional Inherited Members | |
Protected Member Functions inherited from ost::MemPager | |
| virtual void * | first (size_t size) |
| Allocate first workspace from paged memory. | |
| virtual void * | alloc (size_t size) |
| Allocate memory from either the currently active page, or allocate a new page for the object. | |
| char * | first (char *str) |
| Allocate a string from the memory pager pool and copy the string into it's new memory area. | |
| char * | alloc (const char *str) |
| Allocate a string from the memory pager pool and copy the string inti it's new memory area. | |
| MemPager (size_t pagesize=4096) | |
| Create a paged memory pool for cumulative storage. | |
| void | purge (void) |
| purge the current memory pool. | |
| void | clean (void) |
| Clean for memory cleanup before exiting. | |
| virtual | ~MemPager () |
| Delete the memory pool and all allocated memory. | |
| int | getPages (void) |
| Return the total number of pages that have been allocated for this memory pool. | |
The StackPager provides a repository to stash and retrieve working data in last-in-first-out order.
The use of a mempager to support it's operation allows storage of arbitrary sized objects with no fixed limit.
last in first out object pager.
| ost::StackPager::StackPager | ( | size_t | pagesize | ) |
Create a lifo pager as a mempager.
| pagesize | for memory allocation |
| void * ost::StackPager::pull | ( | void | ) |
Retrieve next object from stack.
| void ost::StackPager::purge | ( | void | ) |
Purge the stack of all objects and memory allocations.
| void * ost::StackPager::push | ( | const char * | string | ) |
Push a string onto the stack.
| string | pointer. |
| void * ost::StackPager::push | ( | const void * | object, |
| size_t | size ) |
Push an arbitrary object onto the stack.
| object | pointer to data |
| size | of data. |