coastline 0.0.4
Loading...
Searching...
No Matches
CMapPtrToPtr Class Reference

Hash map from pointer keys to borrowed pointer values, with pooled associations. More...

#include <mfc.h>

Inheritance diagram for CMapPtrToPtr:
Collaboration diagram for CMapPtrToPtr:

Public Member Functions

 CMapPtrToPtr (int blockSize=10)
 Initialise an empty map with 17 buckets allocated on first insertion.
 ~CMapPtrToPtr () override
 Release buckets and association pools without deleting key or value objects.
int GetCount () const
UINT GetHashTableSize () const
void SetAt (void *key, void *value)
 Insert or replace a pointer without releasing the previous value.
BOOL RemoveKey (void *key)
 Remove an association and release all storage when the map becomes empty.
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.

Detailed Description

Hash map from pointer keys to borrowed pointer values, with pooled associations.

Keys are compared as pointer values without dereferencing; neither keys nor values are deleted. Hash-table reinitialisation requires an empty map.

Constructor & Destructor Documentation

◆ CMapPtrToPtr()

CMapPtrToPtr::CMapPtrToPtr ( int blockSize = 10)
explicit

Initialise an empty map with 17 buckets allocated on first insertion.

Parameters
blockSizeThe positive number of associations allocated per pool block.

◆ ~CMapPtrToPtr()

CMapPtrToPtr::~CMapPtrToPtr ( )
override

Release buckets and association pools without deleting key or value objects.

Member Function Documentation

◆ GetCount()

int CMapPtrToPtr::GetCount ( ) const
Returns
The number of registered associations.

◆ GetHashTableSize()

UINT CMapPtrToPtr::GetHashTableSize ( ) const
Returns
The configured bucket count, even before bucket allocation.

◆ SetAt()

void CMapPtrToPtr::SetAt ( void * key,
void * value )

Insert or replace a pointer without releasing the previous value.

Parameters
keyThe pointer-valued key, possibly null.
valueThe borrowed pointer value, possibly null.

◆ RemoveKey()

BOOL CMapPtrToPtr::RemoveKey ( void * key)

Remove an association and release all storage when the map becomes empty.

Parameters
keyThe pointer-valued key supplied at insertion.
Returns
TRUE when an association was removed; otherwise FALSE.

◆ InitHashTable()

void CMapPtrToPtr::InitHashTable ( UINT hashSize,
BOOL allocate = TRUE )

Replace bucket storage in an empty map without changing the association-pool configuration.

Parameters
hashSizeThe positive bucket count.
allocateWhether to allocate buckets immediately rather than on first insertion.

The documentation for this class was generated from the following file: