|
coastline 0.0.4
|
Hash map from 16-bit words to borrowed pointers, with pooled associations. More...
#include <mfc.h>


Public Member Functions | |
| CMapWordToPtr (int blockSize=10) | |
| Initialise an empty map with 17 buckets allocated on first insertion. | |
| ~CMapWordToPtr () override | |
| Release buckets and association pools without deleting pointer values. | |
| int | GetCount () const |
| UINT | GetHashTableSize () const |
| BOOL | IsEmpty () const |
| BOOL | Lookup (WORD key, void *&value) const |
| Look up a pointer without changing the output on a missing key. | |
| void | SetAt (WORD key, void *value) |
| Insert or replace a pointer without releasing the previous value. | |
| BOOL | RemoveKey (WORD key) |
| Remove an association and release all storage when the map becomes empty. | |
| void | RemoveAll () |
| Release all associations and buckets without deleting pointer values. | |
| POSITION | GetStartPosition () const |
| void | GetNextAssoc (POSITION &position, WORD &key, void *&value) const |
| Retrieve an association in hash-bucket order and advance the cursor. | |
| void | InitHashTable (UINT hashSize, BOOL allocate=TRUE) |
| Replace bucket storage in an empty map without changing the association-pool configuration. | |
| Public Member Functions inherited from CObject | |
| virtual CRuntimeClass * | GetRuntimeClass () const |
| virtual | ~CObject () |
| The base destructor does not perform additional cleanup. | |
| virtual void | Serialize (CArchive &archive) |
| Do not serialise archive data. | |
| virtual void | AssertValid () const |
| Do not validate object state. | |
| virtual void | Dump (CDumpContext &context) const |
| Do not emit diagnostic output. | |
Hash map from 16-bit words to borrowed pointers, with pooled associations.
Pointer values are never deleted. Positions become invalid after their associations are removed or all storage is released. Hash-table reinitialisation requires an empty map.
|
explicit |
Initialise an empty map with 17 buckets allocated on first insertion.
| blockSize | The positive number of associations allocated per pool block. |
|
override |
Release buckets and association pools without deleting pointer values.
| int CMapWordToPtr::GetCount | ( | ) | const |
| UINT CMapWordToPtr::GetHashTableSize | ( | ) | const |
| BOOL CMapWordToPtr::IsEmpty | ( | ) | const |
Look up a pointer without changing the output on a missing key.
| key | The word-sized key. |
| value | The output borrowed pointer, possibly null for a registered null value. |
| void CMapWordToPtr::SetAt | ( | WORD | key, |
| void * | value ) |
Insert or replace a pointer without releasing the previous value.
| key | The word-sized key. |
| value | The borrowed pointer, possibly null. |
Remove an association and release all storage when the map becomes empty.
| key | The word-sized key. |
| void CMapWordToPtr::RemoveAll | ( | ) |
Release all associations and buckets without deleting pointer values.
| POSITION CMapWordToPtr::GetStartPosition | ( | ) | const |
Retrieve an association in hash-bucket order and advance the cursor.
| position | A non-null cursor from this map, replaced with the next cursor or null. |
| key | The output word-sized key. |
| value | The output borrowed pointer, valid while the external object remains allocated. |
Replace bucket storage in an empty map without changing the association-pool configuration.
| hashSize | The positive bucket count. |
| allocate | Whether to allocate buckets immediately rather than on first insertion. |