This template class provides a data structure and operations for administrating an unordered set of elements of an arbitrary type.
More...
|
| OFUnorderedSet () |
| Default constructor.
|
|
| OFUnorderedSet (const OFUnorderedSet< T > &src) |
| Copy constructor.
|
|
virtual | ~OFUnorderedSet () |
| Destructor.
|
|
const OFUnorderedSet< T > & | operator= (const OFUnorderedSet< T > &src) |
| operator=.
|
|
virtual OFBool | operator== (const OFUnorderedSet< T > &other) const |
| Determines if two sets are identical.
|
|
virtual OFBool | operator!= (const OFUnorderedSet< T > &other) const |
| Determines if two sets are not identical.
|
|
virtual void | Insert (const T &item) |
| Inserts a new item into the set.
|
|
virtual void | Insert (const OFUnorderedSet< T > &other) |
| Inserts all items of another set into this set.
|
|
virtual void | Remove (const T &item) |
| Removes one item from the set.
|
|
virtual void | RemoveByIndex (unsigned int index) |
| Removes one item from the set.
|
|
virtual T * | Find (const T &item) const |
| Tries to find a given object in the set.
|
|
virtual OFBool | Contains (const T &item) const |
| Determines if a certain item is contained in the set.
|
|
virtual OFBool | IsSupersetOf (const OFUnorderedSet< T > &other) const |
| Determines if this is an actual superset of other, i.e.
|
|
virtual OFBool | IsSubsetOf (const OFUnorderedSet< T > &other) const |
| Determines if this is an actual subset of other, i.e.
|
|
OFUnorderedSet< T > | Union (const OFUnorderedSet< T > &other) const |
| Determines the union of the two sets this and other, i.e.
|
|
OFUnorderedSet< T > | Intersection (const OFUnorderedSet< T > &other) const |
| Determines the intersection of the two sets this and other, i.e.
|
|
OFUnorderedSet< T > | Difference (const OFUnorderedSet< T > &other) const |
| Determines the difference this - other, i.e.
|
|
OFUnorderedSet< T > | SymmetricDifference (const OFUnorderedSet< T > &other) const |
| Determines the symmetric difference of this and other, i.e.
|
|
| OFSet () |
| Default constructor.
|
|
void | init () |
| This function is a workaround for avoiding a compiler warning on Solaris 2.5.1 using compiler SC 2.0.1.
|
|
| OFSet (const OFSet< T > &src) |
| Copy constructor.
|
|
void | init (const OFSet< T > &src) |
| This function is a workaround for avoiding a compiler warning on Solaris 2.5.1 using compiler SC 2.0.1.
|
|
virtual | ~OFSet () |
| Destructor.
|
|
const OFSet< T > & | operator= (const OFSet< T > &src) |
| operator=.
|
|
virtual T & | operator[] (unsigned int i) const |
| Returns a certain element which is contained in the set.
|
|
virtual void | Resize (unsigned int newSize) |
| Resizes the set.
|
|
virtual void | Clear () |
| Removes all items from the set.
|
|
virtual OFBool | IsEmpty () const |
| Determines if the set is an empty set.
|
|
virtual unsigned int | NumberOfElements () const |
| Returns the number of elements in the set.
|
|
virtual void | Insert (const T &item)=0 |
| Inserts a new item into the set.
|
|
virtual void | Remove (const T &item)=0 |
| Removes one item from the set.
|
|
virtual void | RemoveByIndex (unsigned int idx)=0 |
| Removes one item from the set.
|
|
virtual T * | Find (const T &item) const =0 |
| Tries to find a given object in the set.
|
|
virtual OFBool | Contains (const T &item) const =0 |
| Determines if a certain item is contained in the set.
|
|
template<class T>
class OFUnorderedSet< T >
This template class provides a data structure and operations for administrating an unordered set of elements of an arbitrary type.
Note the following properties of this class:
- an element which is inserted into the set will be copied
- the datatype of the set's elements has to support operator== so that it is possible to find a certain element
- it is allowed to insert identical elements into the set
- if a user requires to remove a certain element and if there are several elements which are identical to this element, only one element will be removed from the set
- after removing an element of a set, the indices of the set's elements might have changed; hence, looping over all elements of a set must be restarted if an element was removed from the set within the loop
- the order of the elements is arbitrary, but it will not be changed unless an element is removed from the set