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. More... | |
void * | push (const void *object, size_t size) |
Push an arbitrary object onto the stack. More... | |
void * | push (const char *string) |
Push a string onto the stack. More... | |
void * | pull (void) |
Retrieve next object from stack. More... | |
void | purge (void) |
Purge the stack of all objects and memory allocations. More... | |
Additional Inherited Members | |
![]() | |
virtual void * | first (size_t size) |
Allocate first workspace from paged memory. More... | |
virtual void * | alloc (size_t size) |
Allocate memory from either the currently active page, or allocate a new page for the object. More... | |
char * | first (char *str) |
Allocate a string from the memory pager pool and copy the string into it's new memory area. More... | |
char * | alloc (const char *str) |
Allocate a string from the memory pager pool and copy the string inti it's new memory area. More... | |
MemPager (size_t pagesize=4096) | |
Create a paged memory pool for cumulative storage. More... | |
void | purge (void) |
purge the current memory pool. More... | |
void | clean (void) |
Clean for memory cleanup before exiting. More... | |
virtual | ~MemPager () |
Delete the memory pool and all allocated memory. More... | |
int | getPages (void) |
Return the total number of pages that have been allocated for this memory pool. More... | |
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. |