Classes | |
struct | CAssoc |
Association in CFX_MapPtrToPtr. More... | |
Public Member Functions | |
CFX_MapPtrToPtr (int nBlockSize=10, IFX_Allocator *pAllocator=0) | |
Construct with specified block size. More... | |
~CFX_MapPtrToPtr () | |
The Destructor. | |
int | GetCount () const |
Get the number of elements. More... | |
FX_DWORD | GetHashTableSize () const |
Get the internal hash table size. Advanced features for derived classes. More... | |
void | GetNextAssoc (FX_POSITION &rNextPosition, void *&rKey, void *&rValue) const |
Get the current association and set the position to next association. More... | |
FX_POSITION | GetStartPosition () const |
Get the first key-value pair position. iterating all (key, value) pairs. More... | |
void * | GetValueAt (void *key) const |
Get a value pointer by a key. More... | |
void | InitHashTable (FX_DWORD hashSize, FX_BOOL bAllocNow=1) |
Initialize the hash table. More... | |
FX_BOOL | IsEmpty () const |
Verify whether the map is empty. More... | |
FX_BOOL | Lookup (void *key, void *&rValue) const |
Lookup by a key. More... | |
void *& | operator[] (void *key) |
Subscript([]) operator overload. Lookup and add if not there. More... | |
void | RemoveAll () |
Remove all the (key, value) pairs in the map. More... | |
FX_BOOL | RemoveKey (void *key) |
Removing existing (key, ?) pair. More... | |
void | SetAt (void *key, void *newValue) |
Add a new (key, value) pair. Add if not exist, otherwise modify. More... | |
The class represents POINTER/DWORD TO POINTER/DWORD MAP.
CFX_MapPtrToPtr::CFX_MapPtrToPtr | ( | int | nBlockSize = 10 , |
IFX_Allocator * | pAllocator = 0 |
||
) |
Construct with specified block size.
[in] | nBlockSize | The internal block. This parameter must be > 0. |
[in] | pAllocator | Allocator used in this class. NULL means to use default allocator. Default value: NULL. |
|
inline |
Get the number of elements.
|
inline |
Get the internal hash table size. Advanced features for derived classes.
void CFX_MapPtrToPtr::GetNextAssoc | ( | FX_POSITION & | rNextPosition, |
void *& | rKey, | ||
void *& | rValue | ||
) | const |
Get the current association and set the position to next association.
Never call this function on an empty map.
[in,out] | rNextPosition | Input a position, and receive the next association position as result. This parameter will be NULL when reaching the end of the map. |
[out] | rKey | Receive a key. |
[out] | rValue | Receive a value. |
|
inline |
Get the first key-value pair position. iterating all (key, value) pairs.
void* CFX_MapPtrToPtr::GetValueAt | ( | void * | key | ) | const |
Get a value pointer by a key.
[in] | key | The key, whose mapping value is to be retrieved. |
Initialize the hash table.
[in] | hashSize | Initialize the hash table size. |
[in] | bAllocNow | A boolean value to decide whether to allocate the hash table now. TRUE means to allocate the hash table now, while FALSE means not. |
|
inline |
Verify whether the map is empty.
FX_BOOL CFX_MapPtrToPtr::Lookup | ( | void * | key, |
void *& | rValue | ||
) | const |
Lookup by a key.
[in] | key | The key to lookup. |
[out] | rValue | A reference of a typeless pointer to receive the found value. |
void*& CFX_MapPtrToPtr::operator[] | ( | void * | key | ) |
Subscript([]) operator overload. Lookup and add if not there.
[in] | key | The key to lookup. |
void CFX_MapPtrToPtr::RemoveAll | ( | ) |
Remove all the (key, value) pairs in the map.
FX_BOOL CFX_MapPtrToPtr::RemoveKey | ( | void * | key | ) |
Removing existing (key, ?) pair.
[in] | key | The key to be removed. |
|
inline |
Add a new (key, value) pair. Add if not exist, otherwise modify.
[in] | key | The key to specify a position. |
[in] | newValue | The new value. |