FbxMap< Key, Type, Compare, Allocator > Class Template Reference
#include <fbxmap.h>
template<typename Key, typename Type, typename Compare = FbxLessCompare<Key>, typename Allocator = FbxBaseAllocator>
class FbxMap< Key, Type, Compare, Allocator >
This class implements an efficient map based on key comparison, which stores key-value pairs.
It executes insertion, deletion and query operations in O(log(n)) time.
Definition at line 68 of file fbxmap.h.
Declaration of the storage type used by the map.
Definition at line 93 of file fbxmap.h.
typedef StorageType::IteratorType Iterator |
void Reserve |
( |
unsigned int |
pRecordCount | ) |
|
|
inline |
Preallocate memory.
- Parameters
-
pRecordCount | The number of elements. |
Definition at line 104 of file fbxmap.h.
106 mTree.Reserve(pRecordCount);
Retrieve the number of key-value pairs it holds.
Definition at line 110 of file fbxmap.h.
112 return mTree.GetSize();
Insert a key-value pair.
- Parameters
-
pKey | The key. |
pValue | The value. |
- Returns
- If the key is already present in the map, returns the existing pair and false; else returns the pointer to the new key-value and true.
Definition at line 119 of file fbxmap.h.
121 return mTree.Insert(KeyValuePair(pKey, pValue));
bool Remove |
( |
const KeyType & |
pKey | ) |
|
|
inline |
Delete a key-value pair.
- Parameters
-
- Returns
true
if success, false
if key is not found.
Definition at line 127 of file fbxmap.h.
129 return mTree.Remove(pKey);
Clear the map.
Definition at line 133 of file fbxmap.h.
Query whether the map is empty.
Definition at line 139 of file fbxmap.h.
141 return mTree.Empty();
Retrieve the begin iterator of the map.
Definition at line 145 of file fbxmap.h.
StorageType::IteratorType Iterator
const RecordType * Minimum() const
Retrieve the key-value pair which is the minimum key in map.
Retrieve the end iterator of the map.
Definition at line 151 of file fbxmap.h.
StorageType::IteratorType Iterator
Retrieve the begin iterator of the map.
Definition at line 157 of file fbxmap.h.
StorageType::ConstIteratorType ConstIterator
const RecordType * Minimum() const
Retrieve the key-value pair which is the minimum key in map.
Retrieve the end iterator of the map.
Definition at line 163 of file fbxmap.h.
StorageType::ConstIteratorType ConstIterator
Query a key.
- Parameters
-
- Returns
- A key-value pair if success, NULL if the key is not found.
Definition at line 171 of file fbxmap.h.
173 return mTree.Find(pKey);
Query a key.
- Parameters
-
- Returns
- A key-value pair if success, NULL if it's not found.
Definition at line 179 of file fbxmap.h.
181 return mTree.Find(pKey);
Find the key-value pair with the smallest key greater than a specified key.
- Parameters
-
- Returns
- The found key-value pair.
Definition at line 187 of file fbxmap.h.
189 return mTree.UpperBound(pKey);
Find the key-value pair with the smallest key greater than a specified key.
- Parameters
-
- Returns
- The found key-value pair.
Definition at line 195 of file fbxmap.h.
197 return mTree.UpperBound(pKey);
Retrieve the reference of the value in the key-value pairs in map.
- Parameters
-
- Returns
- The reference of the value.
Definition at line 204 of file fbxmap.h.
213 return lRecord->GetValue();
const RecordType * Find(const KeyType &pKey) const
Query a key.
FbxPair< RecordType *, bool > Insert(const KeyType &pKey, const ValueType &pValue)
Insert a key-value pair.
StorageType::RecordType RecordType
Retrieve the key-value pair which is the minimum key in map.
Definition at line 217 of file fbxmap.h.
219 return mTree.Minimum();
Retrieve the key-value pair which is the minimum key in map.
Definition at line 223 of file fbxmap.h.
225 return mTree.Minimum();
Retrieve the key-value pair which is the maximum key in map.
Definition at line 229 of file fbxmap.h.
231 return mTree.Maximum();
Retrieve the key-value pair which is the maximum key in map.
Definition at line 235 of file fbxmap.h.
237 return mTree.Maximum();
The documentation for this class was generated from the following file: