13 #ifndef _FBXSDK_CORE_BASE_SET_H_
14 #define _FBXSDK_CORE_BASE_SET_H_
25 template <
typename Type,
typename Compare=FbxLessCompare<Type>,
typename Allocator=FbxBaseAllocator>
class FbxSet
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 typedef const Type KeyType;
37 typedef const Type ConstKeyType;
39 typedef const Type ConstValueType;
41 inline Value(
const Type& pValue) : mValue(pValue){}
42 inline KeyType& GetKey()
const {
return mValue; }
43 inline ConstKeyType& GetKey(){
return mValue; }
44 inline ValueType& GetValue()
const {
return mValue; }
45 inline ConstValueType& GetValue(){
return mValue; }
56 typedef FbxRedBlackTree<Value, Compare, Allocator>
StorageType;
61 typedef typename StorageType::IteratorType
Iterator;
67 inline void Reserve(
unsigned int pRecordCount)
69 mTree.Reserve(pRecordCount);
75 return mTree.GetSize();
83 return mTree.Insert(
Value(pValue));
89 inline int Remove(
const ValueType& pValue)
91 return mTree.Remove(pValue);
103 return mTree.Empty();
133 inline const RecordType*
Find(
const ValueType& pValue)
const
135 return mTree.Find(pValue);
141 inline RecordType*
Find(
const ValueType& pValue)
143 return mTree.Find(pValue);
149 return mTree.Minimum();
155 return mTree.Minimum();
161 return mTree.Maximum();
167 return mTree.Maximum();
173 return (
this == &pOther) || (mTree == pOther.mTree);
179 return !(*
this == pOther);
188 ConstIterator lBegin =
Begin();
189 for (; lBegin !=
End(); ++lBegin)
191 if (pOther.
Find(lBegin->GetValue()) !=
NULL)
192 lReturn.
Insert(lBegin->GetValue());
203 ConstIterator lBegin = pOther.
Begin();
204 for (; lBegin !=
End(); ++lBegin)
206 if (
Find(lBegin->GetValue()) ==
NULL)
207 lReturn.
Insert(lBegin->GetValue());
215 #ifndef DOXYGEN_SHOULD_SKIP_THIS
RecordType * Minimum()
Retrieve the minimum value in the set.
FBX SDK environment definition.
bool operator!=(const FbxSet< Type, Compare, Allocator > &pOther) const
Inequality operator.
Iterator Begin()
Retrieve the begin iterator of the set.
FbxPair< RecordType *, bool > Insert(const ValueType &pValue)
Insert a value.
const RecordType * Minimum() const
Retrieve the minimum value in the set.
This class defines the value type used by the set.
StorageType::RecordType RecordType
RecordType * Find(const ValueType &pValue)
Find a given value in the set.
FbxRedBlackTree< Value, Compare, Allocator > StorageType
Declaration of the storage type used by the set.
StorageType::IteratorType Iterator
FbxSet Intersect(const FbxSet &pOther) const
Intersect with another set.
bool operator==(const FbxSet< Type, Compare, Allocator > &pOther) const
Equality operator.
const RecordType * Find(const ValueType &pValue) const
Find a given value in the set.
void Clear()
Clear the set.
int GetSize() const
Retrieve the number of values it holds.
const RecordType * Maximum() const
Retrieve the maximum value in the set.
void Reserve(unsigned int pRecordCount)
Preallocate memory.
int Remove(const ValueType &pValue)
Delete a value.
bool Empty() const
Query whether the set is empty.
This class template holds a pair of objects.
This class implements an efficient set based on value comparison, which stores values.
RecordType * Maximum()
Retrieve the maximum value in the set.
StorageType::ConstIteratorType ConstIterator
ConstIterator End() const
Retrieve the end iterator of the set.
ConstIterator Begin() const
Retrieve the begin iterator of the set.
FbxSet Union(const FbxSet &pOther) const
Unite with another set.
Iterator End()
Retrieve the end iterator of the set.