FbxSet< Type, Compare, Allocator > Class Template Reference
#include <fbxset.h>
template<typename Type, typename Compare = FbxLessCompare<Type>, typename Allocator = FbxBaseAllocator>
class FbxSet< Type, Compare, Allocator >
This class implements an efficient set based on value comparison, which stores values.
It executes insertion, deletion and query operations in O(log(n)) time.
Definition at line 25 of file fbxset.h.
|
class | Value |
| This class defines the value type used by the set. More...
|
|
|
typedef FbxRedBlackTree< Value, Compare, Allocator > | StorageType |
| Declaration of the storage type used by the set. More...
|
|
Declaration of the storage type used by the set.
Definition at line 56 of file fbxset.h.
typedef StorageType::IteratorType Iterator |
void Reserve |
( |
unsigned int |
pRecordCount | ) |
|
|
inline |
Preallocate memory.
- Parameters
-
pRecordCount | The number of elements. |
Definition at line 67 of file fbxset.h.
69 mTree.Reserve(pRecordCount);
Retrieve the number of values it holds.
Definition at line 73 of file fbxset.h.
75 return mTree.GetSize();
Insert a value.
- Parameters
-
- Returns
- If the value is already present in the map, returns the existing value and false; else returns the pointer to the new value and true.
Definition at line 81 of file fbxset.h.
83 return mTree.Insert(Value(pValue));
Delete a value.
- Parameters
-
- Returns
true
if success, false
if value is not found.
Definition at line 89 of file fbxset.h.
91 return mTree.Remove(pValue);
Clear the set.
Definition at line 95 of file fbxset.h.
Query whether the set is empty.
Definition at line 101 of file fbxset.h.
103 return mTree.Empty();
Retrieve the begin iterator of the set.
Definition at line 107 of file fbxset.h.
const RecordType * Minimum() const
Retrieve the minimum value in the set.
StorageType::IteratorType Iterator
Retrieve the end iterator of the set.
Definition at line 113 of file fbxset.h.
StorageType::IteratorType Iterator
Retrieve the begin iterator of the set.
Definition at line 119 of file fbxset.h.
const RecordType * Minimum() const
Retrieve the minimum value in the set.
StorageType::ConstIteratorType ConstIterator
Retrieve the end iterator of the set.
Definition at line 125 of file fbxset.h.
StorageType::ConstIteratorType ConstIterator
Find a given value in the set.
- Parameters
-
- Returns
- The value in the set, or NULL if the value is not found in the set.
Definition at line 133 of file fbxset.h.
135 return mTree.Find(pValue);
Find a given value in the set.
- Parameters
-
- Returns
- The value in the set, or NULL if the value is not found in the set.
Definition at line 141 of file fbxset.h.
143 return mTree.Find(pValue);
Retrieve the minimum value in the set.
Definition at line 147 of file fbxset.h.
149 return mTree.Minimum();
Retrieve the minimum value in the set.
Definition at line 153 of file fbxset.h.
155 return mTree.Minimum();
Retrieve the maximum value in the set.
Definition at line 159 of file fbxset.h.
161 return mTree.Maximum();
Retrieve the maximum value in the set.
Definition at line 165 of file fbxset.h.
167 return mTree.Maximum();
bool operator== |
( |
const FbxSet< Type, Compare, Allocator > & |
pOther | ) |
const |
|
inline |
Equality operator.
Definition at line 171 of file fbxset.h.
173 return (
this == &pOther) || (mTree == pOther.mTree);
bool operator!= |
( |
const FbxSet< Type, Compare, Allocator > & |
pOther | ) |
const |
|
inline |
Inequality operator.
Definition at line 177 of file fbxset.h.
179 return !(*
this == pOther);
FbxSet Intersect |
( |
const FbxSet< Type, Compare, Allocator > & |
pOther | ) |
const |
|
inline |
Intersect with another set.
- Parameters
-
- Returns
- The intersection set of the two sets.
Definition at line 185 of file fbxset.h.
189 for (; lBegin !=
End(); ++lBegin)
191 if (pOther.
Find(lBegin->GetValue()) !=
NULL)
192 lReturn.
Insert(lBegin->GetValue());
Iterator Begin()
Retrieve the begin iterator of the set.
FbxPair< RecordType *, bool > Insert(const ValueType &pValue)
Insert a value.
const RecordType * Find(const ValueType &pValue) const
Find a given value in the set.
This class implements an efficient set based on value comparison, which stores values.
StorageType::ConstIteratorType ConstIterator
Iterator End()
Retrieve the end iterator of the set.
FbxSet Union |
( |
const FbxSet< Type, Compare, Allocator > & |
pOther | ) |
const |
|
inline |
Unite with another set.
- Parameters
-
- Returns
- The union set of the two sets (no duplicated items).
Definition at line 200 of file fbxset.h.
204 for (; lBegin !=
End(); ++lBegin)
206 if (
Find(lBegin->GetValue()) ==
NULL)
207 lReturn.Insert(lBegin->GetValue());
Iterator Begin()
Retrieve the begin iterator of the set.
const RecordType * Find(const ValueType &pValue) const
Find a given value in the set.
This class implements an efficient set based on value comparison, which stores values.
StorageType::ConstIteratorType ConstIterator
Iterator End()
Retrieve the end iterator of the set.
The documentation for this class was generated from the following file: