A typed template for using a key association with typed objects.
More...
#include <memory.h>
Public Member Functions |
bool | assign (char *name, T *pointer) |
| Assign a name for a pointer to a typed object.
|
| assoc_pointer () |
| Construct an associated pointer hash map based on the class template.
|
bool | create (char *name, T *pointer) |
| Create a new name in the association table and assign typed object.
|
unsigned | getCount (void) |
| Get the count of typed objects stored in our hash map.
|
unsigned | getPages (void) |
| Access to number of pages allocated from heap for our associated index pointer.
|
T * | locate (char *name) |
| Lookup a typed object by name.
|
T * | operator() (char *name) |
| Reference a typed object directly by name.
|
void | purge (void) |
| Purge the hash map of typed objects.
|
void | remove (char *name) |
| Remove a name and typed pointer association.
|
unsigned | utilization (void) |
| Access to pager utilization stats.
|
Additional Inherited Members |
bool | assign (char *name, void *pointer) |
| Assign a name to a data pointer.
|
bool | create (char *name, void *pointer) |
| Create a new name in the association table and assign it's value.
|
unsigned | getCount (void) |
| Get the number of associations we have in our object.
|
| keyassoc (unsigned indexing=177, size_t max=0, size_t page=0) |
| Create a key associated memory pointer table.
|
void * | locate (char *name) |
| Lookup the data pointer by the string name given.
|
void * | operator() (char *name) |
| Lookup the data pointer of a string by direct operation.
|
void | purge (void) |
| Purge all associations and return allocated pages to heap.
|
void * | remove (char *name) |
| Remove a name and pointer association.
|
| ~keyassoc () |
| Destroy association object.
|
Detailed Description
template<class T, unsigned I = 177, size_t M = 0, size_t P = 0>
class ucommon::assoc_pointer< T, I, M, P >
A typed template for using a key association with typed objects.
This essentially forms a form of "smart pointer" that is a reference to specific typed objects by symbolic name. This is commonly used as for associated indexing of typed objects.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 705 of file memory.h.
Member Function Documentation
template<class T , unsigned I = 177, size_t M = 0, size_t P = 0>
Assign a name for a pointer to a typed object.
If the name exists, it is re-assigned with the new pointer value, otherwise it is created.
- Parameters
-
name | to assign. |
pointer | of typed object to assign with name. |
- Returns
- false if failed because name is too long for managed table.
Definition at line 749 of file memory.h.
template<class T , unsigned I = 177, size_t M = 0, size_t P = 0>
Create a new name in the association table and assign typed object.
- Parameters
-
name | to create. |
pointer | of typed object to assign with name. |
- Returns
- false if already exists or name is too long for managed table.
Definition at line 758 of file memory.h.
template<class T , unsigned I = 177, size_t M = 0, size_t P = 0>
Get the count of typed objects stored in our hash map.
- Returns
- typed objects in map.
Definition at line 717 of file memory.h.
template<class T , unsigned I = 177, size_t M = 0, size_t P = 0>
Access to number of pages allocated from heap for our associated index pointer.
This is needed because we inherit keyassoc privately.
- Returns
- count of heap pages used.
Definition at line 783 of file memory.h.
template<class T , unsigned I = 177, size_t M = 0, size_t P = 0>
Lookup a typed object by name.
- Parameters
-
name | of typed object to locate. |
- Returns
- typed object pointer or NULL if not found.
Definition at line 731 of file memory.h.
template<class T , unsigned I = 177, size_t M = 0, size_t P = 0>
Reference a typed object directly by name.
- Parameters
-
name | of typed object to locate. |
- Returns
- typed object pointer or NULL if not found.
Definition at line 739 of file memory.h.
template<class T , unsigned I = 177, size_t M = 0, size_t P = 0>
Remove a name and typed pointer association.
If managed key names are used then the memory allocated for the name will be re-used.
- Parameters
-
Definition at line 766 of file memory.h.
template<class T , unsigned I = 177, size_t M = 0, size_t P = 0>
Access to pager utilization stats.
This is needed because we inherit keyassoc privately.
- Returns
- pager utilization, 0-100.
Definition at line 774 of file memory.h.
The documentation for this class was generated from the following file: