- Main Page
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Types | Protected Attributes

# FbxSet2< VALUE_TYPE, KEY_COMPARE_FUNCTOR, ALLOCATOR > Class Template Reference

Search for all occurrences

## Detailed Description

### template<typename VALUE_TYPE, typename KEY_COMPARE_FUNCTOR = FbxLessCompare<VALUE_TYPE>, typename ALLOCATOR = FbxBaseAllocator>
class FbxSet2< VALUE_TYPE, KEY_COMPARE_FUNCTOR, 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 1617 of file fbxmap.h.

`#include <fbxmap.h>`

List of all members.

## Classes
class | FbxValue
## Public Types
typedef VALUE_TYPE | ValueType
typedef StorageType::RecordType | RecordType
typedef StorageType::IteratorType | Iterator
typedef StorageType::ConstIteratorType | ConstIterator
## Public Member Functions
| FbxSet2 ()
| Constructor.
| FbxSet2 (const FbxSet2 &pSet)
| Copy constructor.
| ~FbxSet2 ()
| Destructor.
void | Reserve (unsigned int pRecordCount)
| Preallocate memory.
int | GetSize () const
| Retrieve the number of values it holds.
FbxPair< RecordType *, bool > | Insert (const ValueType &pValue)
| Insert a value.
int | Remove (const ValueType &pValue)
| Delete a value.
void | Clear ()
| Clear the set.
bool | Empty () const
| Query whether the set is empty.
Iterator | Begin ()
| Retrieve the begin iterator of the set.
Iterator | End ()
| Retrieve the end iterator of the set.
ConstIterator | Begin () const
| Retrieve the begin iterator of the set.
ConstIterator | End () const
| Retrieve the end iterator of the set.
const RecordType * | Find (const ValueType &pValue) const
| Query a value in the set.
RecordType * | Find (const ValueType &pValue)
| Query a value in the set.
const RecordType * | Minimum () const
| Retrieve the minimum value in the set.
RecordType * | Minimum ()
| Retrieve the minimum value in the set.
const RecordType * | Maximum () const
| Retrieve the maximum value in the set.
RecordType * | Maximum ()
| Retrieve the maximum value in the set.
bool | operator== (const FbxSet2< VALUE_TYPE, KEY_COMPARE_FUNCTOR, ALLOCATOR > &pOther) const
| Equality operator.
bool | operator!= (const FbxSet2< VALUE_TYPE, KEY_COMPARE_FUNCTOR, ALLOCATOR > &pOther) const
| Inequality operator.
FbxSet2 | Intersect (const FbxSet2 &pOther) const
| Intersect with another set.
FbxSet2 | Union (const FbxSet2 &pOther) const
| Unite with another set.
## Protected Types
typedef FbxRedBlackTree < FbxValue, KEY_COMPARE_FUNCTOR, ALLOCATOR > | StorageType
## Protected Attributes
StorageType | mTree

## Member Typedef Documentation

typedef FbxRedBlackTree<FbxValue, KEY_COMPARE_FUNCTOR, ALLOCATOR> StorageType `[protected]`

Search for all occurrences

Definition at line 1646 of file fbxmap.h.

typedef VALUE_TYPE ValueType

Search for all occurrences

Definition at line 1652 of file fbxmap.h.

typedef StorageType::RecordType RecordType

Search for all occurrences

Definition at line 1653 of file fbxmap.h.

typedef StorageType::IteratorType Iterator

Search for all occurrences

Definition at line 1654 of file fbxmap.h.

typedef StorageType::ConstIteratorType ConstIterator

Search for all occurrences

Definition at line 1655 of file fbxmap.h.

## Constructor & Destructor Documentation

FbxSet2 | ( |  | ) | `[inline]`

Constructor.

Definition at line 1658 of file fbxmap.h.

    {}

FbxSet2 | ( | const FbxSet2< VALUE_TYPE, KEY_COMPARE_FUNCTOR, ALLOCATOR > & | pSet | ) | `[inline]`

Copy constructor.

Definition at line 1660 of file fbxmap.h.

    : mTree(pSet.mTree) {}

~FbxSet2 | ( |  | ) | `[inline]`

Destructor.

Definition at line 1662 of file fbxmap.h.

    {Clear();}

## Member Function Documentation

void Reserve | ( | unsigned int | pRecordCount | ) | `[inline]`

Search for all occurrences

Preallocate memory.

Parameters:

  pRecordCount | The number of elements.

Definition at line 1667 of file fbxmap.h.

        {
            mTree.Reserve(pRecordCount);
        }

int GetSize | ( |  | ) | const `[inline]`

Search for all occurrences

Retrieve the number of values it holds.

Definition at line 1673 of file fbxmap.h.

        {
            return mTree.GetSize();
        }

FbxPair<RecordType*, bool> Insert | ( | const ValueType & | pValue | ) | `[inline]`

Search for all occurrences

Insert a value.

Parameters:

  pValue | The value.

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 1683 of file fbxmap.h.

        {
            return mTree.Insert(FbxValue(pValue));
        }

int Remove | ( | const ValueType & | pValue | ) | `[inline]`

Search for all occurrences

Delete a value.

Parameters:

  pValue | The value.

Returns:
  `true` if success, `false` if value is not found.

Definition at line 1692 of file fbxmap.h.

        {
            return mTree.Remove(pValue);
        }

void Clear | ( |  | ) | `[inline]`

Search for all occurrences

Clear the set.

Definition at line 1698 of file fbxmap.h.

        {
            mTree.Clear();
        }

bool Empty | ( |  | ) | const `[inline]`

Search for all occurrences

Query whether the set is empty.

Definition at line 1704 of file fbxmap.h.

        {
            return mTree.Empty();
        }

Iterator Begin | ( |  | ) | `[inline]`

Search for all occurrences

Retrieve the begin iterator of the set.

Definition at line 1710 of file fbxmap.h.

        {
            return Iterator(Minimum());
        }

Iterator End | ( |  | ) | `[inline]`

Search for all occurrences

Retrieve the end iterator of the set.

Definition at line 1716 of file fbxmap.h.

        {
            return Iterator();
        }

ConstIterator Begin | ( |  | ) | const `[inline]`

Search for all occurrences

Retrieve the begin iterator of the set.

Definition at line 1722 of file fbxmap.h.

        {
            return ConstIterator(Minimum());
        }

ConstIterator End | ( |  | ) | const `[inline]`

Search for all occurrences

Retrieve the end iterator of the set.

Definition at line 1728 of file fbxmap.h.

        {
            return ConstIterator();
        }

const RecordType* Find | ( | const ValueType & | pValue | ) | const `[inline]`

Search for all occurrences

Query a value in the set.

Parameters:

  pKey | The key.

Returns:
  The key if success, NULL if it's not found.

Definition at line 1737 of file fbxmap.h.

        {
            return mTree.Find(pValue);
        }

RecordType* Find | ( | const ValueType & | pValue | ) | `[inline]`

Search for all occurrences

Query a value in the set.

Parameters:

  pKey | The key.

Returns:
  The key if success, NULL if it's not found.

Definition at line 1746 of file fbxmap.h.

        {
            return mTree.Find(pValue);
        }

const RecordType* Minimum | ( |  | ) | const `[inline]`

Search for all occurrences

Retrieve the minimum value in the set.

Definition at line 1752 of file fbxmap.h.

        {
            return mTree.Minimum();
        }

RecordType* Minimum | ( |  | ) | `[inline]`

Search for all occurrences

Retrieve the minimum value in the set.

Definition at line 1758 of file fbxmap.h.

        {
            return mTree.Minimum();
        }

const RecordType* Maximum | ( |  | ) | const `[inline]`

Search for all occurrences

Retrieve the maximum value in the set.

Definition at line 1764 of file fbxmap.h.

        {
            return mTree.Maximum();
        }

RecordType* Maximum | ( |  | ) | `[inline]`

Search for all occurrences

Retrieve the maximum value in the set.

Definition at line 1770 of file fbxmap.h.

        {
            return mTree.Maximum();
        }

bool operator== | ( | const FbxSet2< VALUE_TYPE, KEY_COMPARE_FUNCTOR, ALLOCATOR > & | pOther | ) | const `[inline]`

Equality operator.

Definition at line 1776 of file fbxmap.h.

        {
            return (this == &pOther) || (mTree == pOther.mTree);
        }

bool operator!= | ( | const FbxSet2< VALUE_TYPE, KEY_COMPARE_FUNCTOR, ALLOCATOR > & | pOther | ) | const `[inline]`

Inequality operator.

Definition at line 1782 of file fbxmap.h.

        {
            return !(*this == pOther);
        }

FbxSet2 Intersect | ( | const FbxSet2< VALUE_TYPE, KEY_COMPARE_FUNCTOR, ALLOCATOR > & | pOther | ) | const `[inline]`

Search for all occurrences

Intersect with another set.

Parameters:

  The | other set.

Returns:
  The intersection set of the two sets.

Definition at line 1791 of file fbxmap.h.

        {
            FbxSet2 lReturn;
            ConstIterator lBegin = Begin();
            for (; lBegin != End(); ++lBegin)
            {
                if (pOther.Find(lBegin->GetValue()) != NULL)
                    lReturn.Insert(lBegin->GetValue());
            }
            return lReturn;
        }

FbxSet2 Union | ( | const FbxSet2< VALUE_TYPE, KEY_COMPARE_FUNCTOR, ALLOCATOR > & | pOther | ) | const `[inline]`

Search for all occurrences

Unite with another set.

Parameters:

  The | other set.

Returns:
  The union set of the two sets (no duplicated items).

Definition at line 1807 of file fbxmap.h.

        {
            FbxSet2 lReturn(*this);
            ConstIterator lBegin = pOther.Begin();
            for (; lBegin != End(); ++lBegin)
            {
                if (Find(lBegin->GetValue()) == NULL)
                    lReturn.Insert(lBegin->GetValue());
            }
            return lReturn;
        }

## Member Data Documentation

StorageType mTree `[protected]`

Search for all occurrences

Definition at line 1647 of file fbxmap.h.

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

- fbxsdk/core/base/fbxmap.h